package main

import (
	log "github.com/donnie4w/go-logger/logger"
	"sync"
	"time"
)

var (
	save_mgo, qy_mgo, spi_mgo   *MongodbSim
	datalock                    sync.Mutex
	timeLayout                  = "2006-01-02 15:04:05"
	timeTmeplate                = "2006-01-02"
	isLocal                     bool
	MysqlTool                   *Mysql
	medical_type, medical_level map[string]string
)

func init() {
	isLocal = true //本地
	initMgo()
	initMysql()
	initClassCode() //加载相关代码表
}
func main() {
	log.Debug("领域化产品准备......")

	//医院信息处理
	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()

	//医疗产品表~信息
	//dealWithProductInfo()

	//分类代码v表修复~产品表修复
	//repairYlqxClass()
	//repairProductClass()

	time.Sleep(999 * time.Hour)
}

//插入数据
func insertMysqlData(name string, data map[string]interface{}, mark string) {
	inb := MysqlTool.Insert(name, data)
	if inb == -1 {
		log.Debug("插入数据异常...", name, "~", mark)
	}
}

func testPort() {
	//dealWithDataFieldAccuracy("a_marked_bidding_old")
	//increaseTemplateData("zktest_upload_data","zktest_upload_data")

	//var port, path string
	//flag.StringVar(&port, "port", "8088", "端口")
	//flag.StringVar(&path, "path", "/", "路径")
	//flag.Parse()
	//http.Handle("/", http.FileServer(http.Dir(path)))
	//log.Debug("port:", port)
	//http.ListenAndServe(":"+port, nil)
}
