zhengkun 3 년 전
부모
커밋
3343af7808
5개의 변경된 파일93개의 추가작업 그리고 14개의 파일을 삭제
  1. 4 5
      listen_data/src/main.go
  2. 69 1
      listen_data/src/zkmethod.go
  3. 1 1
      process_medical/src/main.go
  4. 6 3
      process_medical/src/medical_bidding.go
  5. 13 4
      process_medical/src/medical_prepare.go

+ 4 - 5
listen_data/src/main.go

@@ -109,11 +109,11 @@ func main()  {
 	//save_mgo.InitPool()
 
 	save_mgo = &MongodbSim{
-		MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
+		MongodbAddr: "172.17.4.85:27080",
 		DbName:      "qfw",
 		Size:        10,
-		UserName: "zhengkun",
-		Password: "zk@123123",
+		UserName: "",
+		Password: "",
 	}
 	save_mgo.InitPool()
 
@@ -123,11 +123,10 @@ func main()  {
 		dealWithClassData()			//AB 匹配
 		repairEqRegNoClassData()	//注册号-截取匹配
 		repairEqClassData()			//同分类-补充-0123
-
 	*/
 
 
-	decodeJyUrl()
+	repairRepeatTag()
 
 	return
 

+ 69 - 1
listen_data/src/zkmethod.go

@@ -40,7 +40,7 @@ var MysqlTool	*Mysql
 
 //解密
 func decodeJyUrl()  {
-	test := "AbLY1wEcT0FOyo4NHNxZ3IkCCQCIDFjcWhwKS8wOT0wWmpzfVJUCds%3D"
+	test := "ALPY1wIdDIvUC06AlFzcE8zJicCCj1mdmB0Py8nLz0wc35zcFpUCgQ%3D"
 	var Decode  = qu.CommonDecodeArticle("content", test)
 	log.Debug(Decode[0])
 	return
@@ -53,7 +53,75 @@ func encodeJyUrl()  {
 	log.Debug(Encode)
 }
 
+//修复重复标记
+func repairRepeatTag()  {
+	log.Debug("6064aa900000000000000000")
+	log.Debug("遍历-result_20220218~查询~result_20210108")
+	log.Debug("重复标记~更新~repeat,repeat_reason,repeat_id")
+	log.Debug("不重复标记~更新~repeat_ids,是否存在")
+	log.Debug("~~~~~~~~~~~~~")
+	log.Debug("~~~~~~~~~~~~~")
+	sess := save_mgo.GetMgoConn()
+	defer save_mgo.DestoryMongoConn(sess)
+	q := map[string]interface{}{
+		"_id": map[string]interface{}{
+			"$lte": StringTOBsonId("6064aa900000000000000000"),
+		},
+	}
+	total,ok_1,ok_2,err_3,err_4 := 0,0,0,0,0
+	it := sess.DB("qfw").C("result_20220218").Find(&q).Sort("_id").Select(map[string]interface{}{
+		"_id":1,
+	}).Iter()
+	for tmp := make(map[string]interface{}); it.Next(&tmp);total++{
+		if total%10000==0 {
+			log.Debug("curent index ",total,"~",ok_1,ok_2,err_3,err_4)
+		}
+
+		tmpid := BsonTOStringId(tmp["_id"])
+
+		data := save_mgo.FindById("result_20210108",tmpid)
+		if data!=nil && len(data)>2 {
+			repeat := qu.IntAll(data["repeat"])
+			if repeat==1 {
+				update := map[string]interface{}{
+					"repeat":1,
+				}
+				if data["repeat_id"]!="" {
+					update["repeat_id"] = data["repeat_id"]
+				}
+				if data["repeat_reason"]!="" {
+					update["repeat_reason"] = data["repeat_reason"]
+				}
+				save_mgo.UpdateById("result_20220218",tmpid, map[string]interface{}{
+					"$set": update,
+				})
+				ok_1++
+			}else {
+				if data["repeat_ids"]!=nil {
+					ok_2++
+					save_mgo.UpdateById("result_20220218",tmpid, map[string]interface{}{
+						"$set": map[string]interface{}{
+							"repeat_ids": data["repeat_ids"],
+						},
+					})
+				}else {
+					err_3++
+				}
+			}
+		}else {
+			log.Debug("异常~",tmpid)
+			err_4++
+		}
+		tmp = make(map[string]interface{})
+	}
+
+	log.Debug("is bidding over ",total,ok_1,ok_2,err_3,err_4)
+
+}
+
+
 
+//统计医疗器械数据
 func tongjiYLQX() {
 	//ylhydata
 	sess := save_mgo.GetMgoConn()

+ 1 - 1
process_medical/src/main.go

@@ -38,12 +38,12 @@ func init()  {
 
 
 func main()  {
+
 	//initMySqlMgoData()
 	//saveBiddingPurMysql()
 
 
 	//exportAreaMysql()
-	exportAreaMysql()
 }
 
 

+ 6 - 3
process_medical/src/medical_bidding.go

@@ -25,10 +25,13 @@ func saveBiddingPurMysql() {
 		}
 		tmpid := BsonTOStringId(tmp["_id"])
 		repeat:= qu.IntAll(tmp["repeat"])
+		subtype:= qu.ObjToString(tmp["subtype"])
 		if repeat!=1 {
-			isok++
-			dealWithBidData(tmp,tmpid)
-			dealWithPurData(tmp,tmpid)
+			if subtype=="单一"||subtype=="中标"||subtype=="成交"||subtype=="合同" {
+				isok++
+				dealWithBidData(tmp,tmpid)
+				dealWithPurData(tmp,tmpid)
+			}
 		}
 		tmp = make(map[string]interface{})
 	}

+ 13 - 4
process_medical/src/medical_prepare.go

@@ -66,21 +66,30 @@ func init_area() {
 
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
+
+	data ,_:= save_mgo.Find(o_area_coll,nil,nil,nil)
+	code_map := make(map[string]string,0)
+	for _,v := range data{
+		name := qu.ObjToString(v["name"])
+		code := qu.ObjToString(v["code"])
+		code_map[code]=name
+	}
+	log.Debug(len(code_map))
 	q,total:=map[string]interface{}{},0
 	it := sess.DB(save_mgo.DbName).C(o_area_coll).Find(&q).Iter()
 	for tmp := make(map[string]interface{}); it.Next(&tmp);total++{
 		name := qu.ObjToString(tmp["name"])
 		code := qu.ObjToString(tmp["code"])
-		p_name := qu.ObjToString(tmp["p_name"])
-		c_name := qu.ObjToString(tmp["c_name"])
+		pcode :=qu.ObjToString(tmp["pcode"])
 		level := qu.ObjToString(tmp["level"])
 		key := ""
 		if level=="1" {
 			key = name+"_"+"_"
 		}else if level=="2" {
-			key = p_name+"_"+name+"_"
+			key = code_map[pcode]+"_"+name+"_"
 		}else if level=="3" {
-			key = p_name+"_"+c_name+"_"+name
+			pc := code[:2]+"0000"
+			key = code_map[pc]+"_"+code_map[pcode]+"_"+name
 		}else {
 
 		}