Procházet zdrojové kódy

处理~医疗信息~备份

zhengkun před 3 roky
rodič
revize
ee4431247c

+ 40 - 66
data_medical/src/company.go

@@ -7,9 +7,8 @@ import (
 	"time"
 )
 
-
 //处理企业基本信息
-func dealWithCompanyInfo()  {
+func dealWithCompanyInfo() {
 	//来源mgo~181
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
@@ -17,10 +16,10 @@ func dealWithCompanyInfo()  {
 	it := sess.DB(save_mgo.DbName).C("zktest_mysql_company_info").Find(&q).Sort("_id").Iter()
 	pool := make(chan bool, 1)
 	wg := &sync.WaitGroup{}
-	total ,isok1,isok2:= 0,0,0
+	total, isok1, isok2 := 0, 0, 0
 	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
-		if total %100 == 0 {
-			log.Debug("cur index ", total,isok1,isok2)
+		if total%100 == 0 {
+			log.Debug("cur index ", total, isok1, isok2)
 		}
 		pool <- true
 		wg.Add(1)
@@ -30,52 +29,56 @@ func dealWithCompanyInfo()  {
 				wg.Done()
 			}()
 			company_name := qu.ObjToString(tmp["company_name"])
-			business_type:= qu.ObjToString(tmp["business_type"])
-			sc_info,jy_info := treatCompanyTypeInfo(company_name,business_type)
+			business_type := qu.ObjToString(tmp["business_type"])
+			sc_info, jy_info := treatCompanyTypeInfo(company_name, business_type)
 
 			datalock.Lock()
-			isok1+=len(sc_info)
-			isok2+=len(jy_info)
+			isok1 += len(sc_info)
+			isok2 += len(jy_info)
 			datalock.Unlock()
 		}(tmp)
 		tmp = make(map[string]interface{})
 	}
 	wg.Wait()
 
-	log.Debug("is over ",total,isok1,isok2)
+	log.Debug("is over ", total, isok1, isok2)
 }
 
-
 //构建产品信息~
-func treatCompanyTypeInfo(company_name string,company_type string)([]map[string]interface{},[]map[string]interface{})  {
+func treatCompanyTypeInfo(company_name string, company_type string) ([]map[string]interface{}, []map[string]interface{}) {
 	sc_info := []map[string]interface{}{}
 	jy_info := []map[string]interface{}{}
-
-	dataArr,_ := save_mgo.Find("zktest_mysql_product_info", map[string]interface{}{
-		"company_name":company_name,
-	},nil,nil)
+	arr := *MysqlTool.Find("v_bidclass", nil, "", "", -1, -1)
+	log.Debug(arr)
+	//关联的有product.id 需要生成产品表
+	dataArr := *MysqlTool.Find("f_product", map[string]interface{}{
+		"company_name": company_name,
+	}, "id,product_name,approve_date,company_id,medical_equipment_code", "", -1, -1)
+	//dataArr,_ := save_mgo.Find("zktest_mysql_product_info", map[string]interface{}{
+	//	"company_name":company_name,
+	//},nil,nil)
 
 	//是否过滤~信息~根绝名称去重~选取一个有效的信息
 	keys := map[string]map[string]interface{}{}
-	new_dataArr := make([]map[string]interface{},0)
-	for _,data := range dataArr {
+	new_dataArr := make([]map[string]interface{}, 0)
+	for _, data := range dataArr {
 		product_name := qu.ObjToString(data["product_name"])
-		if keys[product_name]==nil {
-			new_dataArr = append(new_dataArr,data)
+		if keys[product_name] == nil {
+			new_dataArr = append(new_dataArr, data)
 			keys[product_name] = data
-		}else {
+		} else {
 			pre_v := keys[product_name]
 			pre_approve_date := qu.ObjToString(pre_v["approve_date"])
 			cur_approve_date := qu.ObjToString(data["approve_date"])
-			pre_approve_time ,_ :=  time.Parse(timeTmeplate ,pre_approve_date)
-			cur_approve_time ,_ :=  time.Parse(timeTmeplate ,cur_approve_date)
+			pre_approve_time, _ := time.Parse(timeTmeplate, pre_approve_date)
+			cur_approve_time, _ := time.Parse(timeTmeplate, cur_approve_date)
 			if cur_approve_time.Unix() > pre_approve_time.Unix() {
 				keys[product_name] = data
 				//替换数据
-				index :=0
+				index := 0
 				isreplace := false
-				for k,v := range new_dataArr {
-					if qu.ObjToString(v["product_name"])==product_name {
+				for k, v := range new_dataArr {
+					if qu.ObjToString(v["product_name"]) == product_name {
 						index = k
 						isreplace = true
 						break
@@ -88,48 +91,19 @@ func treatCompanyTypeInfo(company_name string,company_type string)([]map[string]
 		}
 	}
 
-	for _,v := range dataArr {
+	for _, v := range dataArr {
 		dict := map[string]interface{}{}
-		dict["company_name"] = qu.ObjToString(v["company_name"])
 		dict["company_id"] = qu.ObjToString(v["company_id"])
-		dict["regno"] = qu.ObjToString(v["regno"])
-		dict["manage_type"] = qu.ObjToString(v["manage_type"])
-		dict["product_name"] = qu.ObjToString(v["product_name"])
-		dict["product_code"] = qu.ObjToString(v["product_code"])
-		dict["product_class1"] = qu.ObjToString(v["product_class1"])
-		dict["product_class2"] = qu.ObjToString(v["product_class2"])
-		dict["product_class3"] = qu.ObjToString(v["product_class3"])
-		dict["product_class4"] = qu.ObjToString(v["product_class4"])
-
-		if company_type=="1" { //生产
-			sc_info = append(sc_info,dict)
-		}else if company_type=="2" { //经营
-			jy_info = append(jy_info,dict)
-		}else if company_type=="3" { //生产&经营
-			sc_info = append(sc_info,dict)
-			jy_info = append(jy_info,dict)
+		dict["product_id"] = qu.ObjToString(v["id"])
+		dict["medical_equipment_code"] = qu.ObjToString(v["medical_equipment_code"])
+		if company_type == "1" { //生产
+			sc_info = append(sc_info, dict)
+		} else if company_type == "2" { //经营
+			jy_info = append(jy_info, dict)
+		} else if company_type == "3" { //生产&经营
+			sc_info = append(sc_info, dict)
+			jy_info = append(jy_info, dict)
 		}
 	}
-	return sc_info,jy_info
+	return sc_info, jy_info
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 63 - 53
data_medical/src/hospital.go

@@ -5,21 +5,35 @@ import (
 	qu "qfw/util"
 	"strings"
 	"sync"
+	"time"
 	"unicode/utf8"
 )
 
 var data_hospitals = map[string][]map[string]interface{}{}
 
-//重复数据~判断
-func repeatHospital() {
+//整合医院数据
+func confirmHospitalData(save_coll string) {
+	//处理~医院信息
+	log.Debug("整合医院信息~", len(data_hospitals))
+	for _, v := range data_hospitals {
+		data := mergeHospitalInfo(v)
+		save_mgo.Save(save_coll, data)
+	}
+	log.Debug("待判重数据存储完毕~")
+	time.Sleep(10 * time.Second)
+	repeatHospital(save_coll)
+}
+
+//判重~医院数据
+func repeatHospital(save_coll string) {
+	log.Debug("开始判重医院数据...")
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
 	data_hospitals_alias := make(map[string][]string, 0)
 	data_hospitals_id := make(map[string]string, 0)
 	data_hospitals_region := make(map[string]map[string]string, 0)
-
 	q := map[string]interface{}{}
-	it := sess.DB(save_mgo.DbName).C("zzzzzz").Find(&q).Sort("name").Select(map[string]interface{}{
+	it := sess.DB(save_mgo.DbName).C(save_coll).Find(&q).Sort("_id").Select(map[string]interface{}{
 		"name":  1,
 		"alias": 1,
 	}).Iter()
@@ -38,7 +52,7 @@ func repeatHospital() {
 		alias_arr := strings.Split(alias, ",")
 		alias_arr = append(alias_arr, name)
 
-		//减少重复
+		//减少重复...待
 
 		tmpid := BsonTOStringId(tmp["_id"])
 		if data_hospitals_alias[name] == nil {
@@ -77,13 +91,12 @@ func repeatHospital() {
 				if is_r_n != "" {
 
 				}
-				//log.Debug(name, "~", is_r_n)
-				//save_mgo.UpdateById("zzzzzz", tmpid, map[string]interface{}{
-				//	"$set": map[string]interface{}{
-				//		"repeat":    1,
-				//		"repeat_id": data_hospitals_id[is_r_n],
-				//	},
-				//})
+				save_mgo.UpdateById(save_coll, tmpid, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"repeat":    1,
+						"repeat_id": data_hospitals_id[is_r_n],
+					},
+				})
 			}
 			data_hospitals_id[name] = tmpid
 			data_hospitals_region[name] = region
@@ -92,46 +105,33 @@ func repeatHospital() {
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is over ", total, "~", isok)
-}
 
-//是否相同地域
-func repeatRegion(region map[string]string, data map[string]string) bool {
-	if region["district"] != "" && data["district"] != "" &&
-		region["district"] != data["district"] {
-		return false
-	}
-	if region["city"] != "" && data["city"] != "" &&
-		region["city"] != data["city"] {
-		return false
-	}
-	if region["area"] != "" && data["area"] != "" &&
-		region["area"] != data["area"] &&
-		region["area"] != "全国" && data["area"] != "全国" {
-		return false
-	}
-
-	return true
+	//合并判重后的数据
+	mergeRepeatHospital(save_coll)
 }
 
-//整合医院数据
-func confirmhHospitalData() {
-	//处理~医院信息
-	log.Debug("is ", len(data_hospitals))
-	for k, v := range data_hospitals {
-		data := mergeHospitalInfo(v)
-		if data != nil && len(data) > 2 {
-			//保存新表~
-			save_mgo.Save("zzzzzz", data)
-		} else {
-			log.Debug("异常数据...", k)
-			save_mgo.Save("kkkkkk", data)
+//最终合并判重后的医院数据
+func mergeRepeatHospital(save_coll string) {
+	log.Debug("开始合并重复后的数据~待")
+	return
+	sess := save_mgo.GetMgoConn()
+	defer save_mgo.DestoryMongoConn(sess)
+	q := map[string]interface{}{}
+	it := sess.DB(save_mgo.DbName).C(save_coll).Find(&q).Sort("_id").Iter()
+	total, isok := 0, 0
+	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
+		if total%1000 == 0 {
+			log.Debug("cur index ", total, "~", isok)
 		}
+		//最终保存
+
+		tmp = make(map[string]interface{})
 	}
-	log.Debug("最终~", len(data_hospitals))
+	log.Debug("is over ", total, "~", isok)
 }
 
 //处理医院基本信息~涉及多张表
-func dealWithHospitalInfo(hos_coll string, depart_coll string) {
+func dealWithHospitalBaseInfo(hos_coll string, depart_coll string) {
 	log.Debug("处理医疗~医院基本信息")
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
@@ -188,16 +188,10 @@ func treatHospitalInfo(tmp map[string]interface{}) map[string]interface{} {
 	hospitalname := qu.ObjToString(tmp["hospitalname"])
 	hospitalname = strings.ReplaceAll(hospitalname, " ", "")
 	//医院名称~
-	data["mi_name"] = hospitalname
+	data["name"] = hospitalname
 	//医院简介
 	data["introduce"] = qu.ObjToString(tmp["introduce"])
 
-	//等级~性质~代码
-	n_level, n_type, n_bus_type := inquirHospitalLevelType(qu.ObjToString(tmp["level"]), qu.ObjToString(tmp["type"]), qu.ObjToString(tmp["business_type"]))
-	data["level"] = n_level
-	data["type"] = n_type
-	data["business_type"] = n_bus_type
-
 	//医院地址
 	data["address"] = qu.ObjToString(tmp["address"])
 	//医院设备
@@ -223,19 +217,31 @@ func treatHospitalInfo(tmp map[string]interface{}) map[string]interface{} {
 	data["fax_number"] = qu.ObjToString(tmp["fax_number"])
 	//医院网站
 	data["website"] = qu.ObjToString(tmp["website"])
+
+	//等级~性质~代码
+	//n_level, n_type, n_bus_type := inquirHospitalLevelType(qu.ObjToString(tmp["level"]), qu.ObjToString(tmp["type"]), qu.ObjToString(tmp["business_type"]))
+	//data["level_code"] = n_level
+	//data["mi_type_code"] = n_type
+	//data["business_type"] = qu.IntAll(n_bus_type)
+	data["level"] = qu.ObjToString(tmp["level"])
+	data["type"] = qu.ObjToString(tmp["type"])
+	data["business_type"] = qu.ObjToString(tmp["business_type"])
+
 	//省~市~区 ~可完善
 	area := qu.ObjToString(tmp["area"])
 	city := qu.ObjToString(tmp["city"])
 	district := qu.ObjToString(tmp["district"])
 	if city == "" { //补充~省份城市信息
-		//supplementRegionally(&area,&city,&district,hospitalname,qu.ObjToString(tmp["address"]))
+		//supplementRegionally(&area, &city, &district, hospitalname, qu.ObjToString(tmp["address"]))
 	}
 	data["area"] = area
 	data["city"] = city
 	data["district"] = district
 
+	company_id := ""
 	//关联企业信息~查询顺序~企业~特殊~自生
-	inquirBaseInfoid(hospitalname)
+	//company_id = inquirBaseInfoid(hospitalname)
+	data["company_id"] = company_id
 
 	//入库时间
 	//data["comeintime"] = time.Unix(qu.Int64All(tmp["comeintime"]), 0).Format(timeLayout)
@@ -281,6 +287,10 @@ func mergeHospitalInfo(dataArr []map[string]interface{}) map[string]interface{}
 		temp := dataArr[0]
 		for k, v := range temp {
 			isMerge := false
+			//合并别名~
+
+			//合并科室信息
+
 			//选取最优值
 			if new_v, ok := v.(string); ok {
 				if new_v == "" { //查询其他数据~补充

+ 20 - 0
data_medical/src/hospital_method.go

@@ -34,6 +34,7 @@ func inquirHospitalLevelType(med_level string, med_type string, med_bus_type str
 
 	//医疗类型相关~采集异常~需要清洗
 	if med_type != "" && new_type == "" {
+
 		//医疗类型
 		new_type = relevanceType(med_type)
 
@@ -178,3 +179,22 @@ func supplementRegionally(area *string, city *string, district *string, name str
 		}
 	}
 }
+
+//是否相同地域
+func repeatRegion(region map[string]string, data map[string]string) bool {
+	if region["district"] != "" && data["district"] != "" &&
+		region["district"] != data["district"] {
+		return false
+	}
+	if region["city"] != "" && data["city"] != "" &&
+		region["city"] != data["city"] {
+		return false
+	}
+	if region["area"] != "" && data["area"] != "" &&
+		region["area"] != data["area"] &&
+		region["area"] != "全国" && data["area"] != "全国" {
+		return false
+	}
+
+	return true
+}

+ 4 - 3
data_medical/src/initdata.go

@@ -16,8 +16,8 @@ func initMgo() {
 		//	MongodbAddr: "192.168.3.207:27092",
 		//	DbName:      "zhengkun",
 		//	Size:        10,
-		//	UserName: "",
-		//	Password: "",
+		//	UserName:    "",
+		//	Password:    "",
 		//}
 		//save_mgo.InitPool()
 
@@ -73,9 +73,10 @@ func initMysql() {
 		Address:  "192.168.3.217:4000",
 		UserName: "root",
 		PassWord: "=PDT49#80Z!RVv52_z",
-		DBName:   "medical_lycp",
+		DBName:   "jy_lycp",
 	}
 	MysqlTool.Init()
+
 }
 
 func initClassCode() {

+ 8 - 8
data_medical/src/main.go

@@ -26,12 +26,11 @@ func main() {
 	log.Debug("领域化产品准备......")
 
 	//医院信息处理
-	dealWithHospitalInfo("f_hospital_39jk", "hospital_39jk_ain_depart")
-	//dealWithHospitalInfo("f_hospital_hdf", "hospital_hdf_ain_depart")
-	//dealWithHospitalInfo("f_hospital_yydq", "hospital_yydq_ain_depart")
-	//dealWithHospitalInfo("f_hospital_yyyc", "")
-	//confirmhHospitalData()
-	//repeatHospital()
+	dealWithHospitalBaseInfo("f_hospital_39jk", "hospital_39jk_ain_depart")
+	dealWithHospitalBaseInfo("f_hospital_hdf", "hospital_hdf_ain_depart")
+	dealWithHospitalBaseInfo("f_hospital_yydq", "hospital_yydq_ain_depart")
+	dealWithHospitalBaseInfo("f_hospital_yyyc", "")
+	confirmHospitalData("zzzzzzkkkkkk")
 
 	//生产经营企业~产品信息
 	//dealWithCompanyInfo()
@@ -39,8 +38,9 @@ func main() {
 	//医疗产品表~信息
 	//dealWithProductInfo()
 
-	//分类代码v表修复
-	//modifyylqxclass()
+	//分类代码v表修复~产品表修复
+	//repairYlqxClass()
+	//repairProductClass()
 
 	time.Sleep(999 * time.Hour)
 }

+ 19 - 22
data_medical/src/product.go

@@ -16,10 +16,10 @@ func dealWithProductInfo() {
 	it := sess.DB(save_mgo.DbName).C("zktest_mysql_product_info").Find(&q).Sort("_id").Iter()
 	pool := make(chan bool, 5)
 	wg := &sync.WaitGroup{}
-	total ,isok:= 0,0
+	total, isok := 0, 0
 	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
-		if total %10000 == 0 {
-			log.Debug("cur index ", total,isok)
+		if total%10000 == 0 {
+			log.Debug("cur index ", total, isok)
 		}
 		pool <- true
 		wg.Add(1)
@@ -30,7 +30,7 @@ func dealWithProductInfo() {
 			}()
 
 			data := treatProductInfo(tmp)
-			if data!=nil {
+			if data != nil {
 				datalock.Lock()
 				isok++
 				datalock.Unlock()
@@ -40,13 +40,12 @@ func dealWithProductInfo() {
 	}
 	wg.Wait()
 
-	log.Debug("is over ",total,isok)
-
+	log.Debug("is over ", total, isok)
 
 }
 
 //构建产品信息数据~
-func treatProductInfo(tmp map[string]interface{}) map[string]interface{}{
+func treatProductInfo(tmp map[string]interface{}) map[string]interface{} {
 	data := map[string]interface{}{}
 	data["regno"] = qu.ObjToString(tmp["regno"])
 	data["company_name"] = qu.ObjToString(tmp["company_name"])
@@ -78,32 +77,30 @@ func treatProductInfo(tmp map[string]interface{}) map[string]interface{}{
 	data["source_channel"] = qu.ObjToString(tmp["source_channel"])
 	data["manage_type"] = qu.ObjToString(tmp["manage_type"])
 	data["product_name"] = qu.ObjToString(tmp["product_name"])
-	data["product_class1"] = qu.ObjToString(tmp["product_class1"])
-	data["product_class2"] = qu.ObjToString(tmp["product_class2"])
-	data["product_class3"] = qu.ObjToString(tmp["product_class3"])
-	data["product_class4"] = qu.ObjToString(tmp["product_class4"])
-	data["product_code"] = qu.ObjToString(tmp["product_code"])
-	//data["Isvalid"] = qu.ObjToString(tmp["Isvalid"])
-	//data["comeintime"] = qu.ObjToString(tmp["comeintime"])
-
 
+	data["medical_equipment_class1"] = qu.ObjToString(tmp["product_class1"])
+	data["medical_equipment_class2"] = qu.ObjToString(tmp["product_class2"])
+	data["medical_equipment_class3"] = qu.ObjToString(tmp["product_class3"])
+	data["sdproduct_name"] = qu.ObjToString(tmp["product_class4"])
 
+	//需要清洗
+	data["medical_equipment_code"] = qu.ObjToString(tmp["product_code"])
+	data["Isvalid"] = true
 
 	return data
 }
 
-
 //清洗日期~
-func cleanErrDateTime(datetime string)(bool) {
+func cleanErrDateTime(datetime string) bool {
 	/*
-	1、有效年1900 ~  2200年
+		1、有效年1900 ~  2200年
 	*/
-	arr := strings.Split(datetime,"-")
-	if len(arr)>0 {
+	arr := strings.Split(datetime, "-")
+	if len(arr) > 0 {
 		year := qu.IntAll(arr[0])
-		if year<1900 || year>2200 {
+		if year < 1900 || year > 2200 {
 			return true
 		}
 	}
 	return false
-}
+}

+ 94 - 0
data_medical/src/repairclass.go

@@ -0,0 +1,94 @@
+package main
+
+import (
+	log "github.com/donnie4w/go-logger/logger"
+	qu "qfw/util"
+	"unicode/utf8"
+)
+
+//修复产品分类表
+func repairProductClass() {
+	sess := save_mgo.GetMgoConn()
+	defer save_mgo.DestoryMongoConn(sess)
+	q := map[string]interface{}{}
+	it := sess.DB(save_mgo.DbName).C("zktest_mysql_product_info").Find(&q).Select(map[string]interface{}{
+		"product_code": 1,
+	}).Sort("_id").Iter()
+	total := 0
+	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
+		if total%10000 == 0 {
+			log.Debug("cur index ", total)
+		}
+		product_code := qu.ObjToString(tmp["product_code"])
+		if utf8.RuneCountInString(product_code) == 8 || utf8.RuneCountInString(product_code) == 14 {
+			new_code := updatecode(product_code)
+			if new_code == "" {
+				log.Debug("异常~~~~", tmp["_id"])
+			}
+			save_mgo.UpdateById("zktest_mysql_product_info", BsonTOStringId(tmp["_id"]), map[string]interface{}{
+				"$set": map[string]interface{}{
+					"product_code": new_code,
+				},
+			})
+		}
+
+		tmp = make(map[string]interface{})
+	}
+
+	log.Debug("is over ", total)
+}
+
+//修复医疗器械v表
+func repairYlqxClass() {
+	sess := save_mgo.GetMgoConn()
+	defer save_mgo.DestoryMongoConn(sess)
+	q := map[string]interface{}{}
+	it := sess.DB(save_mgo.DbName).C("zktest_mysql_ylqxclass").Find(&q).Sort("_id").Iter()
+	total := 0
+
+	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
+		if total%1000 == 0 {
+			log.Debug("cur index ", total)
+		}
+		code := qu.ObjToString(tmp["code"])
+		pcode := qu.ObjToString(tmp["pcode"])
+		level := qu.ObjToString(tmp["level"])
+		if level == "3" { //调整code
+			new_code := updatecode(code)
+			save_mgo.UpdateById("zktest_mysql_ylqxclass", BsonTOStringId(tmp["_id"]), map[string]interface{}{
+				"$set": map[string]interface{}{
+					"code": new_code,
+				},
+			})
+		} else if level == "4" { //调整code pcode
+			new_code := updatecode(code)
+			new_pcode := updatecode(pcode)
+			save_mgo.UpdateById("zktest_mysql_ylqxclass", BsonTOStringId(tmp["_id"]), map[string]interface{}{
+				"$set": map[string]interface{}{
+					"code":  new_code,
+					"pcode": new_pcode,
+				},
+			})
+		} else {
+
+		}
+
+		tmp = make(map[string]interface{})
+	}
+
+	log.Debug("is over ", total)
+
+}
+
+func updatecode(code string) string {
+	rc := []rune(code)
+	new_code := code
+	if len(rc) == 8 {
+		new_code = string(rc[:4]) + string(rc[5:8])
+	}
+	if len(code) == 14 {
+		new_code = string(rc[:4]) + string(rc[5:8]) + string(rc[10:14])
+	}
+
+	return new_code
+}

+ 0 - 63
data_medical/src/ylqxclass.go

@@ -1,63 +0,0 @@
-package main
-
-import (
-	log "github.com/donnie4w/go-logger/logger"
-	qu "qfw/util"
-)
-
-func modifyylqxclass()  {
-	sess := save_mgo.GetMgoConn()
-	defer save_mgo.DestoryMongoConn(sess)
-	q := map[string]interface{}{}
-	it := sess.DB(save_mgo.DbName).C("zktest_mysql_ylqxclass").Find(&q).Sort("_id").Iter()
-	total:=0
-
-	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
-		if total %1000 == 0 {
-			log.Debug("cur index ", total)
-		}
-		code := qu.ObjToString(tmp["code"])
-		pcode := qu.ObjToString(tmp["pcode"])
-		level := qu.ObjToString(tmp["level"])
-		if level=="3" { //调整code
-			new_code := updatecode(code)
-			save_mgo.UpdateById("zktest_mysql_ylqxclass",BsonTOStringId(tmp["_id"]),map[string]interface{}{
-				"$set":map[string]interface{}{
-					"code":new_code,
-				},
-			})
-		}else if level=="4" {//调整code pcode
-			new_code := updatecode(code)
-			new_pcode := updatecode(pcode)
-			save_mgo.UpdateById("zktest_mysql_ylqxclass",BsonTOStringId(tmp["_id"]),map[string]interface{}{
-				"$set":map[string]interface{}{
-					"code":new_code,
-					"pcode":new_pcode,
-				},
-			})
-		}else {
-
-		}
-
-
-		tmp = make(map[string]interface{})
-	}
-
-
-	log.Debug("is over ",total)
-
-}
-
-
-func updatecode(code string) string {
-	rc := []rune(code)
-	new_code := code
-	if len(rc)==8 {
-		new_code = string(rc[:4])+ string(rc[5:8])
-	}
-	if len(code)==14 {
-		new_code = string(rc[:4])+ string(rc[5:8])+string(rc[10:14])
-	}
-
-	return new_code
-}