瀏覽代碼

线上数据准备~

zhengkun 2 年之前
父節點
當前提交
597409aa12

+ 0 - 1
fieldproject_medical/data_preparation/src/class/initdata.go

@@ -55,7 +55,6 @@ var (
 )
 
 func InitClass() {
-	//IsLocal = true //本地
 	initMgo()
 	initMysql()
 	initLocalData() //医院相关使用

+ 7 - 6
fieldproject_medical/data_preparation/src/hospital/hospital.go

@@ -18,12 +18,13 @@ func RunHospital() {
 	RunBuildHospitalInfo()
 	RunCleanHospitalInfo()
 	RunResetHospitalInfo(save_hospital_coll)
-	//增加索引 repeat_id
+	//增加索引
 	createMgoIndex(save_hospital_coll, []string{"repeat_id"})
 	RunMergeHospitalInfo(save_hospital_coll, merge_hospital_coll_1)
+
 	RunRepairHospitalInfo()
 	RunResetHospitalInfo(merge_hospital_coll_1)
-	//增加索引 repeat_id
+	//增加索引
 	createMgoIndex(merge_hospital_coll_1, []string{"repeat_id", "name"})
 	RunMergeHospitalInfo(merge_hospital_coll_1, merge_hospital_coll_2)
 }
@@ -58,12 +59,12 @@ func RunMergeHospitalInfo(source_coll string, output_coll string) {
 
 //修复信息~历史别名校验
 func RunRepairHospitalInfo() {
-	//repairHospital()
-	//time.Sleep(10 * time.Second)
+	repairHospital()
+	time.Sleep(10 * time.Second)
 	compareHospital()
 	time.Sleep(10 * time.Second)
-	//updateMarkIdHospital()
-	//time.Sleep(10 * time.Second)
+	updateMarkIdHospital()
+	time.Sleep(10 * time.Second)
 }
 
 //创建mgo索引

+ 5 - 4
fieldproject_medical/data_preparation/src/hospital/hospital_repair.go

@@ -74,23 +74,24 @@ func updateMarkIdHospital() {
 	it := sess.DB(class.Save_Mgo.DbName).C(merge_hospital_coll_2).Find(&q).Sort("_id").Iter()
 	total, isok := 0, 0
 	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
-		if total%1000 == 0 {
+		if total%10000 == 0 {
 			log.Debug("cur index ", total, isok)
 		}
 		tmpid := class.BsonTOStringId(tmp["_id"])
 		company_id := qu.ObjToString(tmp["company_id"])
 		mark_id := qu.IntAll(tmp["mark_id"])
 		if mark_id == 0 && company_id == "" {
+			isok++
 			c_id := uuid.New().String()
 			c_id = strings.ReplaceAll(c_id, "-", "")
-			class.Save_Mgo.UpdateById(merge_hospital_coll_1, tmpid, map[string]interface{}{
+			class.Save_Mgo.UpdateById(merge_hospital_coll_2, tmpid, map[string]interface{}{
 				"$set": map[string]interface{}{
 					"company_id": c_id,
-					"mark_id":    0,
+					"mark_id":    3,
 				},
 			})
 		}
 		tmp = make(map[string]interface{})
 	}
-	log.Debug("更新机构~自生id~~over~~ ", total)
+	log.Debug("更新机构~自生id~~over~~ ", total, isok)
 }

+ 2 - 1
fieldproject_medical/data_preparation/src/main.go

@@ -10,6 +10,7 @@ import (
 )
 
 func init() {
+	//class.IsLocal = true
 	class.InitClass()
 }
 func main() {
@@ -17,7 +18,7 @@ func main() {
 	//处理医院
 	hospital.RunHospital()
 	//导入信息~医疗关联sql表
-	//hospital.ExportHospitalInfoToMysql()
+	hospital.ExportHospitalInfoToMysql()
 
 	//代码表构建
 	//vcode.RunVCodeData()