zhengkun 3 лет назад
Родитель
Сommit
fb79334dcc

+ 4 - 2
process_ medical/src/config.json

@@ -28,13 +28,15 @@
     "s_area_coll": "address_jy_2021",
     "s_product_coll": "nmpa_product",
     "s_company_coll": "nmpa_company",
-    "s_qybase_coll": "company_base"
+    "s_qybase_coll": "company_base",
+    "s_bidding_coll": "ylhydata"
   },
   "data_output": {
     "o_area_coll":"zktest_mysql_area",
     "o_class_coll":"zktest_mysql_ylqxclass",
     "o_company_coll":"zktest_mysql_company_info",
     "o_company_err_coll":"zktest_mysql_company_info_err",
-    "o_product_coll":"zktest_mysql_product_info"
+    "o_product_coll":"zktest_mysql_product_info",
+    "0_bidding_coll": ""
   }
 }

+ 8 - 20
process_ medical/src/main.go

@@ -36,30 +36,18 @@ func init()  {
 
 
 func main()  {
+	exportUsefulPurMysql()
+}
 
 
 
-	//产品信息-
-	//init_proclass()
-	//log.Debug("临时加载分类配置-",len(proclass_name_dict),len(proclass_code_dict))
-	//exportProductMysql()
-
-	//生产-经营企业信息
-	//exportCompanyMysql()
-
-	//备案信息
-	exportForReferenceMysql()
 
-	//v-表
-	//exportAreaCitysMysql()
-	//exportMedicalClassMysql()
-}
 
 
-func dealWithSource() {
-	dealWithBiddingSource()
-}
-func exportSource() {
-	exportUsefulPurchasing()
+//插入数据
+func insertMysqlData(name string,data map[string]interface{},mark string) {
+	inb := MysqlTool.Insert(name,data)
+	if inb == -1 {
+		log.Debug("插入数据异常...",name,"~",mark)
+	}
 }
-

+ 3 - 7
process_ medical/src/medical_bidding.go

@@ -95,8 +95,7 @@ func saveBidMysqlData(tmp map[string]interface{}){
 	data["industry_code"] = industry_code
 	data["industry_code_other"] = industry_code_other
 
-	//保存mysql
-	MysqlTool.Insert("f_bidding",data)
+	insertMysqlData("f_bidding",data,"")
 }
 
 //导出标的物-mysql
@@ -162,10 +161,7 @@ func savePurMysqlData(tmp map[string]interface{}){
 			pro_key := fmt.Sprintf("%s_%s_%s",product_class_1,product_class_2,product_class_3)
 			data["product_code"] = proclass_name_dict[pro_key]
 		}
-
-
-		//保存mysql
-		MysqlTool.Insert("f_bidproduct",data)
+		insertMysqlData("f_bidproduct",data,"")
 	}
 
 
@@ -175,7 +171,7 @@ func savePurMysqlData(tmp map[string]interface{}){
 
 
 //导出源数据...
-func exportUsefulPurchasing() {
+func exportUsefulPurMysql() {
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
 	q,total:=map[string]interface{}{},0

+ 3 - 1
process_ medical/src/medical_company.go

@@ -49,8 +49,9 @@ func saveCompanyMysql()  {
 		if total%10000==0 {
 			log.Debug("curent index ",total)
 		}
+		tmpid := BsonTOStringId(tmp["_id"])
 		delete(tmp,"_id")
-		MysqlTool.Insert("f_company",tmp)
+		insertMysqlData("f_company",tmp,tmpid)
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is company over ",total)
@@ -75,6 +76,7 @@ func exportCompanyMysql()  {
 			}else {//企业未匹配-记录
 				save_mgo.Save(o_company_err_coll, map[string]interface{}{
 					"company_name":company,
+					"business_type":type_str,
 				})
 			}
 		}

+ 2 - 2
process_ medical/src/medical_product.go

@@ -18,8 +18,9 @@ func saveProductMysql()  {
 		if total%10000==0 {
 			log.Debug("curent index ",total)
 		}
+		tmpid := BsonTOStringId(tmp["_id"])
 		delete(tmp,"_id")
-		MysqlTool.Insert("f_product",tmp)
+		insertMysqlData("f_product",tmp,tmpid)
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is product over ",total)
@@ -28,7 +29,6 @@ func saveProductMysql()  {
 
 //导出-产品信息
 func exportProductMysql() {
-
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
 	q,total:=map[string]interface{}{},0

+ 4 - 3
process_ medical/src/medical_reference.go

@@ -9,7 +9,7 @@ import (
 
 
 //企业许可备案信息
-func exportForReferenceMysql()  {
+func saveReferenceMysql()  {
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
 	q,total:=map[string]interface{}{},0
@@ -21,15 +21,16 @@ func exportForReferenceMysql()  {
 		}
 		class := qu.ObjToString(tmp["class"])
 		company := qu.ObjToString(tmp["company"])
+		tmpid := BsonTOStringId(tmp["_id"])
 		if company!="" {
 			if class=="生产型"{
 				ok1++
 				data := dealWithSCX(tmp)
-				MysqlTool.Insert("f_production_register",data)
+				insertMysqlData("f_production_register",data,tmpid)
 			}else if class=="经营型" {
 				ok2++
 				data := dealWithJYX(tmp)
-				MysqlTool.Insert("f_business_register",data)
+				insertMysqlData("f_business_register",data,tmpid)
 			}else {
 
 			}

+ 4 - 2
process_ medical/src/medical_vdata.go

@@ -26,8 +26,9 @@ func saveYlqxclassMysql() {
 		if total%1000==0 {
 			log.Debug("curent index ",total)
 		}
+		tmpid := BsonTOStringId(tmp["_id"])
 		delete(tmp,"_id")
-		MysqlTool.Insert("v_ylqxclass",tmp)
+		insertMysqlData("v_ylqxclass",tmp,tmpid)
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is over ",total)
@@ -41,8 +42,9 @@ func saveAreaMysql() {
 		if total%1000==0 {
 			log.Debug("curent index ",total)
 		}
+		tmpid := BsonTOStringId(tmp["_id"])
 		delete(tmp,"_id")
-		MysqlTool.Insert("v_area",tmp)
+		insertMysqlData("v_area",tmp,tmpid)
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is over ",total)

+ 2 - 1
process_ medical/src/mysql.go

@@ -167,7 +167,8 @@ func (m *Mysql) ExecBySqlByTx(tx *sql.Tx, q string, args ...interface{}) (sql.Re
 	defer stmtIns.Close()
 	result, err := stmtIns.Exec(args...)
 	if err != nil {
-		log.Println(args, err)
+		//log.Println(args, err)
+		log.Println(err)
 		return nil, err
 	}
 	return result, nil