|
@@ -1,8 +1,5 @@
|
|
|
package main
|
|
|
|
|
|
-
|
|
|
-//v表处理
|
|
|
-
|
|
|
import (
|
|
|
"fmt"
|
|
|
log "github.com/donnie4w/go-logger/logger"
|
|
@@ -14,8 +11,6 @@ import (
|
|
|
"unicode/utf8"
|
|
|
)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//保存mysql
|
|
|
func saveYlqxclassMysql() {
|
|
|
sess := save_mgo.GetMgoConn()
|
|
@@ -33,132 +28,6 @@ func saveYlqxclassMysql() {
|
|
|
}
|
|
|
log.Debug("is over ",total)
|
|
|
}
|
|
|
-func saveAreaMysql() {
|
|
|
- sess := save_mgo.GetMgoConn()
|
|
|
- defer save_mgo.DestoryMongoConn(sess)
|
|
|
- q,total:=map[string]interface{}{},0
|
|
|
- it := sess.DB(save_mgo.DbName).C(o_area_coll).Sort("_id").Find(&q).Iter()
|
|
|
- for tmp := make(map[string]interface{}); it.Next(&tmp);total++{
|
|
|
- if total%1000==0 {
|
|
|
- log.Debug("curent index ",total)
|
|
|
- }
|
|
|
- tmpid := BsonTOStringId(tmp["_id"])
|
|
|
- delete(tmp,"_id")
|
|
|
- code := qu.IntAll(tmp["code"])
|
|
|
- tmp["code"] = code
|
|
|
- insertMysqlData("v_area_copy",tmp,tmpid)
|
|
|
- tmp = make(map[string]interface{})
|
|
|
- }
|
|
|
- log.Debug("is over ",total)
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-//城市划分-mgo
|
|
|
-func exportAreaCitysMysql() {
|
|
|
- log.Debug("开始处理-区域划分")
|
|
|
-
|
|
|
- xzqh_data := map[string]map[string]string{}
|
|
|
- //准备数据
|
|
|
- ff,_ := xlsx.OpenFile(s_area_xlsx_name)
|
|
|
- for _, sheet := range ff.Sheets {
|
|
|
- for k, row := range sheet.Rows {
|
|
|
- if k==0 {
|
|
|
- continue
|
|
|
- }
|
|
|
- var arr []string
|
|
|
- for k1, cell := range row.Cells {
|
|
|
- if k1==3||k1==4 {
|
|
|
- num ,_:= cell.Float()
|
|
|
- arr = append(arr, fmt.Sprintf("%.6f",num))
|
|
|
- }else {
|
|
|
- arr = append(arr, cell.String())
|
|
|
- }
|
|
|
- }
|
|
|
- code := arr[0]
|
|
|
- xzqh_data[code] = map[string]string{
|
|
|
- "region":arr[1],
|
|
|
- "longitude":arr[3],
|
|
|
- "latitude":arr[4],
|
|
|
- }
|
|
|
- }
|
|
|
- log.Debug(len(xzqh_data))
|
|
|
- }
|
|
|
-
|
|
|
- sess := qy_mgo.GetMgoConn()
|
|
|
- defer qy_mgo.DestoryMongoConn(sess)
|
|
|
- q,total:=map[string]interface{}{
|
|
|
- "town":map[string]interface{}{
|
|
|
- "$exists":0,
|
|
|
- },
|
|
|
- },0
|
|
|
- it := sess.DB(qy_mgo.DbName).C(s_area_coll).Find(&q).Iter()
|
|
|
- for tmp := make(map[string]interface{}); it.Next(&tmp);total++{
|
|
|
- province:=qu.ObjToString(tmp["province"])
|
|
|
- city:=qu.ObjToString(tmp["city"])
|
|
|
- district:=qu.ObjToString(tmp["district"])
|
|
|
- province_code := fmt.Sprintf("%d0000",tmp["province_code"])
|
|
|
- city_code:= fmt.Sprintf("%d00",tmp["city_code"])
|
|
|
- district_code:=fmt.Sprintf("%d",tmp["district_code"])
|
|
|
- info := map[string]string{}
|
|
|
- data := map[string]interface{}{}
|
|
|
- if district =="" {
|
|
|
- if city=="" {
|
|
|
- info = xzqh_data[province_code]
|
|
|
- data = map[string]interface{}{
|
|
|
- "name":province,
|
|
|
- "code":province_code,
|
|
|
- "level":"1",
|
|
|
- "region":qu.ObjToString(info["region"]),
|
|
|
- "longitude":qu.ObjToString(info["longitude"]),
|
|
|
- "latitude":qu.ObjToString(info["latitude"]),
|
|
|
- }
|
|
|
- }else {
|
|
|
- info = xzqh_data[city_code]
|
|
|
- data = map[string]interface{}{
|
|
|
- "name":city,
|
|
|
- "code":city_code,
|
|
|
- "level":"2",
|
|
|
- "p_name":province,
|
|
|
- "p_code":province_code,
|
|
|
- "region":qu.ObjToString(info["region"]),
|
|
|
- "longitude":qu.ObjToString(info["longitude"]),
|
|
|
- "latitude":qu.ObjToString(info["latitude"]),
|
|
|
- "pcode":province_code,
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- info = xzqh_data[district_code]
|
|
|
- data = map[string]interface{}{
|
|
|
- "name":district,
|
|
|
- "code":district_code,
|
|
|
- "level":"3",
|
|
|
- "p_name":province,
|
|
|
- "p_code":province_code,
|
|
|
- "c_name":city,
|
|
|
- "c_code":city_code,
|
|
|
- "region":qu.ObjToString(info["region"]),
|
|
|
- "longitude":qu.ObjToString(info["longitude"]),
|
|
|
- "latitude":qu.ObjToString(info["latitude"]),
|
|
|
- "pcode":city_code,
|
|
|
- }
|
|
|
- }
|
|
|
- save_mgo.Save(o_area_coll,data)
|
|
|
-
|
|
|
- tmp = make(map[string]interface{})
|
|
|
- }
|
|
|
- log.Debug("is area over ",total)
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
//医疗分类-mgo
|
|
@@ -268,7 +137,6 @@ func exportMedicalClassMysql() {
|
|
|
repairYlqxClass1()
|
|
|
repairYlqxClass2()
|
|
|
}
|
|
|
-
|
|
|
//删除重复冗余选项
|
|
|
func repairYlqxClass1() {
|
|
|
data:= map[string]string{}
|
|
@@ -288,7 +156,6 @@ func repairYlqxClass1() {
|
|
|
}
|
|
|
log.Debug("is repair1 over ")
|
|
|
}
|
|
|
-
|
|
|
//补充新的医疗器械
|
|
|
func repairYlqxClass2() {
|
|
|
sess := save_mgo.GetMgoConn()
|
|
@@ -356,7 +223,6 @@ func repairYlqxClass2() {
|
|
|
|
|
|
log.Debug("is repair2 over ")
|
|
|
}
|
|
|
-
|
|
|
//2246位编号
|
|
|
func convertSerialNumber(index int,position int) string {
|
|
|
code :=""
|
|
@@ -372,4 +238,4 @@ func convertSerialNumber(index int,position int) string {
|
|
|
code = fmt.Sprintf("%d",index)
|
|
|
}
|
|
|
return code
|
|
|
-}
|
|
|
+}
|