package service import ( "bytes" "encoding/json" "fmt" "gdyb/models" "github.com/astaxie/beego" "io/ioutil" "math/rand" "net/http" "strconv" "time" _ "unsafe" ) func SzybXX001(doctor string, doctor_code string, fixmedins_code string, account string, verify_code string, serial_number string, version_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "XX001" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["aaz500"] = account inputData["bzz269"] = "000000" inputData["bke384"] = inputMessage["serialNumber"] inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string, mz_number string, version_code string, custom_code string, project_name string, price float64, medical_care int64) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "MZ002" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 if medical_care == 11 || medical_care == 1111 || medical_care == 1112 { inputData["aka130"] = "11" } else if medical_care == 13 { inputData["aka130"] = "13" } else { inputData["aka130"] = fmt.Sprintf("%d", medical_care) } //inputData["aka130"] = "13" inputData["akc190"] = mz_number inputData["aaz500"] = account inputData["bzz269"] = "000000" inputData["akf001"] = dept_code inputData["akc264"] = price inputData["bke384"] = inputMessage["serialNumber"] switch custom_code { case "110100002": inputData["bkc368"] = "1" break case "110200002-2": inputData["bkc368"] = "3" break case "110200002-3": inputData["bkc368"] = "2" break case "110200003": break case "110200002-1": inputData["bkc368"] = "5" break } if custom_code == "0" { inputData["bkc368"] = "4" inputData["listsize"] = 0 inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } else { inputData["listsize"] = 1 timestamp := time.Now().Unix() tempTime := time.Unix(timestamp, 0) timeFormat := tempTime.Format("20060102150405") feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["aae072"] = timeFormat feedetailInfo["bkf500"] = timeFormat feedetailInfo["ake001"] = custom_code feedetailInfo["ake005"] = custom_code feedetailInfo["ake006"] = project_name feedetailInfo["aae019"] = price feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } } func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "FY001" // 交易编码 inputMessage["transChannel"] = "10" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number inputData["bke384"] = serial_number inputData["listsize"] = len(datas) feedetail := make([]map[string]interface{}, 0) for _, item := range datas { feedetailInfo := make(map[string]interface{}) feedetailInfo["aae072"] = item.PrescriptionNumber feedetailInfo["bkc369"] = item.OrderType feedetailInfo["bkf500"] = item.ChargeSerialNumber feedetailInfo["ake001"] = item.Code feedetailInfo["ake002"] = item.CodeName feedetailInfo["bkm017"] = item.BwCode feedetailInfo["aka070"] = item.DoseCode feedetailInfo["aka074"] = item.Spec feedetailInfo["aka064"] = 1 feedetailInfo["ake005"] = item.Code feedetailInfo["ake006"] = item.CodeName feedetailInfo["akc225"] = item.Price feedetailInfo["akc226"] = item.Count feedetailInfo["akc264"] = item.Total feedetailInfo["aka067"] = item.Unit feedetailInfo["akc271"] = item.ChargeOrderDate feedetailInfo["bkc320"] = drug_doctor_code feedetail = append(feedetail, feedetailInfo) } inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData fmt.Println(inputMessage) bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string, mz_number string, version_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "FY002" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number inputData["bke384"] = serial_number inputData["listsize"] = len(datas) feedetail := make([]map[string]interface{}, 0) for _, item := range datas { feedetailInfo := make(map[string]interface{}) feedetailInfo["aae072"] = item.PrescriptionNumber feedetailInfo["bkf500"] = item.ChargeSerialNumber feedetail = append(feedetail, feedetailInfo) } inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybFY004(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64, code string, new_number string) string { inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "FY004" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number if medical_care == 11 || medical_care == 1111 || medical_care == 1112 { inputData["aka130"] = "11" } else if medical_care == 13 { inputData["aka130"] = "13" inputData["cka303"] = code } else { inputData["aka130"] = fmt.Sprintf("%d", medical_care) } inputData["bkc320"] = drug_doctor inputData["ckc350"] = drug_doctor_name inputData["bzz269"] = "000000" inputData["aka030"] = "12" inputData["akc264"] = total inputData["ckc601"] = "0" inputData["bke384"] = serial_number inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybFY005(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64, code string, new_number string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "FY005" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 if medical_care == 11 || medical_care == 1111 || medical_care == 1112 { inputData["aka130"] = "11" } else if medical_care == 13 { inputData["aka130"] = "13" inputData["cka303"] = code } else { inputData["aka130"] = fmt.Sprintf("%d", medical_care) } inputData["aaz500"] = account inputData["bzz269"] = "000000" inputData["akc190"] = mz_number inputData["bkc320"] = drug_doctor inputData["ckc350"] = drug_doctor_name inputData["aka030"] = "12" inputData["akc264"] = total inputData["ckc601"] = "0" inputData["bke384"] = serial_number inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybJY001(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, version_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "JY001" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number inputData["bke384"] = setl_number inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, new_setl_number string, version_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_setl_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "JY002" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number inputData["bke384"] = setl_number inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, version_code string) string { // 生成输入报文 inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number) inputData := make(map[string]interface{}) inputMessage["transType"] = "JY003" // 交易编码 inputMessage["transVersion"] = version_code // 交易编码 inputData["akc190"] = mz_number inputData["bke384"] = setl_number inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://192.168.1.99:10000" //url := "http://192.168.1.228:17001/szsi-portal/transData" url := "http://192.168.1.88:6666/szsi-portal/transData" request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } // 生成基础报文 func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string, verify_code string, number string) map[string]interface{} { month := time.Unix(1557042972, 0).Format("1") year := time.Now().Format("2006") month = time.Now().Format("01") day := time.Now().Format("02") hour := time.Now().Format("15") min := time.Now().Format("04") sec := time.Now().Format("05") msec := time.Now().Format("000") // 生成输入报文 inputMessage := make(map[string]interface{}) // inputMessage["cardArea"] = "440300" // 发卡地行政区划代码 inputMessage["extendDeviceId"] = "" inputMessage["extendSerialNumber"] = "" inputMessage["extendUserId"] = "" inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码 inputMessage["operatorCode"] = doctor_code // 操作员编码 inputMessage["operatorName"] = doctor // 操作员名字 inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码 inputMessage["serialNumber"] = number inputMessage["transReturnCode"] = "" // inputMessage["transReturnMessage"] = "" // inputMessage["transTime"] = year + month + day + hour + min + sec + ":" + msec // inputMessage["verifyCode"] = verify_code // inputMessage["transChannel"] = "10" // return inputMessage } func msToTime(ms int64) string { tm := time.Unix(0, ms*int64(time.Millisecond)) return tm.Format("2006-02-01 15:04:05.000") } // //func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string { // //生成输入报文 // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) // // inputData := make(map[string]interface{}) // inputMessage["transType"] = "JY003" // 交易编码 // // inputData["listsize"] = len(datas) // inputMessage["transType"] = "ML008" // 交易编码S // feedetail := make([]map[string]interface{}, 0) // //inputData["akc190"] = mz_number // //inputData["bke384"] = setl_number // // for _, item := range datas { // // feedetailInfo := make(map[string]interface{}) // feedetailInfo["ake001"] = item.MedicalInsuranceNumber // feedetailInfo["bkm017"] = item.Code // feedetailInfo["ake005"] = item.Code // feedetailInfo["ake006"] = item.DrugName // feedetailInfo["aka074"] = item.DrugSpec // feedetailInfo["aka070"] = item.DrugDosageName // //feedetailInfo["aka070"] = "片" // feedetailInfo["aka067"] = item.MinUnit // feedetailInfo["bka053"] = item.ManufacturerName // feedetailInfo["aka064"] = "1" // feedetailInfo["bka505"] = item.LastPrice // feedetailInfo["bka506"] = item.RetailPrice // feedetailInfo["aae030"] = 20210406 // feedetailInfo["aae013"] = item.LimitRemark // feedetail = append(feedetail, feedetailInfo) // } // // inputData["inputlist"] = feedetail // inputMessage["transBody"] = inputData // // bytesData, err := json.Marshal(inputMessage) // fmt.Println(string(bytesData)) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // reader := bytes.NewReader(bytesData) // //url := "http://192.168.1.99:10000" // url := "http://192.168.1.228:17001/szsi-portal/transData" // // request, err := http.NewRequest("POST", url, reader) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // // request.Header.Set("Content-Type", "application/json;charset=UTF-8") // // client := http.Client{} // resp, err := client.Do(request) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // respBytes, err := ioutil.ReadAll(resp.Body) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // fmt.Println(string(respBytes)) // str := string(respBytes) // return str //} func SzybML008(doctor string, doctor_code string, fixmedins_code string, basedrug *models.DrugDetail) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = 1 inputMessage["transType"] = "ML008" // 交易编码S feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["ake001"] = basedrug.MedicalInsuranceNumber feedetailInfo["bkm017"] = basedrug.Code feedetailInfo["ake005"] = basedrug.Code feedetailInfo["ake006"] = basedrug.DrugName feedetailInfo["aka074"] = basedrug.DrugSpec feedetailInfo["aka070"] = basedrug.DrugDosageName feedetailInfo["aka067"] = basedrug.MinUnit feedetailInfo["bka053"] = basedrug.ManufacturerName feedetailInfo["aka064"] = "1" feedetailInfo["bka505"] = basedrug.LastPrice feedetailInfo["bka506"] = basedrug.RetailPrice feedetailInfo["aae030"], _ = strconv.ParseInt(basedrug.RecordDate, 10, 64) feedetailInfo["aae013"] = basedrug.LimitRemark feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } // 生成基础报文 func SetSZDrugMessage(doctor string, doctor_code string, fixmedins_code string) map[string]interface{} { month := time.Unix(1557042972, 0).Format("1") year := time.Now().Format("2006") month = time.Now().Format("01") day := time.Now().Format("02") hour := time.Now().Format("15") min := time.Now().Format("04") sec := time.Now().Format("05") msec := time.Now().Format("000") //生成输入报文 inputMessage := make(map[string]interface{}) // inputMessage["cardArea"] = "440300" // 发卡地行政区划代码 inputMessage["extendDeviceId"] = "" inputMessage["extendSerialNumber"] = "" inputMessage["extendUserId"] = "" inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码 inputMessage["operatorCode"] = doctor_code // 操作员编码 inputMessage["operatorName"] = doctor // 操作员名字 inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码 inputMessage["serialNumber"] = fixmedins_code + year + month + day + fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位) //inputMessage["serialNumber"] = "G554020210406" + fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位) inputMessage["verifyCode"] = "000000|8ec5b7745a5cc45b631f23b4bf1e417e" inputMessage["transReturnCode"] = "" // inputMessage["transReturnMessage"] = "" // inputMessage["transTime"] = year + month + day + hour + min + sec + ":" + msec // inputMessage["transVersion"] = "V0.2" // // inputMessage["transChannel"] = "10" // return inputMessage } func SzybML009(doctor string, doctor_code string, fixmedins_code string, pro *models.MyHisProject) string { //timeLayout := "20060102" //record_date := time.Unix(pro.RecordDate, 0).Format(timeLayout) //recordDate, _ := strconv.ParseInt(record_date, 10, 64) //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) month := time.Unix(1557042972, 0).Format("1") year := time.Now().Format("2006") month = time.Now().Format("01") day := time.Now().Format("02") inputData := make(map[string]interface{}) inputData["listsize"] = 1 inputMessage["transType"] = "ML009" // 交易编码 feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["ake001"] = pro.MedicalCode //社保目录编码 feedetailInfo["ake005"] = pro.MedicalCode //协议机构内部目录编码 feedetailInfo["ake006"] = pro.ProjectName // 协议机构内部目录名称 feedetailInfo["bkf131"] = pro.Category //协议机构项目类别 feedetailInfo["bkm062"] = strconv.FormatInt(pro.SpecailProject, 10) // 门诊特检项目标识 feedetailInfo["bka506"] = pro.Price // 协议机构内部项目收费价格 feedetailInfo["aae030"] = year + month + day // 备案日期 feedetailInfo["aae013"] = pro.Remark // 备注 feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } //func SzybML009(doctor string, doctor_code string, fixmedins_code string, datas []*models.ProjectDetail) string { // //生成输入报文 // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) // // inputData := make(map[string]interface{}) // // inputData["listsize"] = len(datas) // inputMessage["transType"] = "ML009" // 交易编码 // feedetail := make([]map[string]interface{}, 0) // // for _, item := range datas { // feedetailInfo := make(map[string]interface{}) // feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode //社保目录编码 // feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码 // feedetailInfo["ake006"] = item.ProjectName // 协议机构内部目录名称 // feedetailInfo["bkf131"] = item.Category //协议机构项目类别 // feedetailInfo["bkm062"] = "0" // 门诊特检项目标识 // feedetailInfo["bka506"] = item.Price // 协议机构内部项目收费价格 // feedetailInfo["aae030"] = 20210407 // 备案日期 // feedetailInfo["aae013"] = item.Remark // 备注 // feedetail = append(feedetail, feedetailInfo) // } // fmt.Println("feeedDetal2333333333", feedetail) // inputData["inputlist"] = feedetail // inputMessage["transBody"] = inputData // // bytesData, err := json.Marshal(inputMessage) // fmt.Println(string(bytesData)) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // reader := bytes.NewReader(bytesData) // //url := "http://192.168.1.99:10000" // url := "http://192.168.1.228:17001/szsi-portal/transData" // // request, err := http.NewRequest("POST", url, reader) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // // request.Header.Set("Content-Type", "application/json;charset=UTF-8") // // client := http.Client{} // resp, err := client.Do(request) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // respBytes, err := ioutil.ReadAll(resp.Body) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // fmt.Println(string(respBytes)) // str := string(respBytes) // return str // //} func SzybML010(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail, typeId int64) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = len(datas) inputMessage["transType"] = "ML010" // 交易编码 feedetail := make([]map[string]interface{}, 0) for _, item := range datas { feedetailInfo := make(map[string]interface{}) feedetailInfo["ake003"] = strconv.FormatInt(typeId, 10) feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode //社保目录编码 feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码 feedetail = append(feedetail, feedetailInfo) } inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybYS001(doctor string, doctor_code string, fixmedins_code string, doc *models.DocDetail) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = 1 inputMessage["transType"] = "YS001" // 交易编码 feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["aac003"] = doc.UserName //医护人员姓名 feedetailInfo["bka633"] = "1" //医护人员类别 feedetailInfo["aac004"] = doc.Sex //性别 switch doc.CardType { } if doc.CardType == "1" { feedetailInfo["aac058"] = "01" } else if doc.CardType == "2" { feedetailInfo["aac058"] = "02" } else if doc.CardType == "4" { feedetailInfo["aac058"] = "04" } else if doc.CardType == "6" { feedetailInfo["aac058"] = "06" } else if doc.CardType == "8" { feedetailInfo["aac058"] = "08" } else if doc.CardType == "90" { feedetailInfo["aac058"] = "90" } feedetailInfo["aac147"] = doc.IdCard //证件号码 feedetailInfo["aae005"] = doc.Phone //联系电话 feedetailInfo["bkc322"] = doc.WorkMajorName //现从事专业名称 feedetailInfo["aac005"] = doc.Nation //民族 feedetailInfo["aac006"] = doc.BirthDay //出生日期 feedetailInfo["aac007"] = doc.WorkTime //参加工作日期 feedetailInfo["aac011"] = doc.Education //学历 feedetailInfo["aac183"] = doc.StudyMajorName //所学的专业名称 feedetailInfo["bkc323"] = doc.CertificateCode //医(药)师执业证书编码 feedetailInfo["bke955"] = doc.MedicalCode //医(药)师资格证编码 feedetailInfo["akc055"] = doc.MedicalRangeCode // 医师执业范围代码 feedetailInfo["bcc950"] = doc.MedicalLevel //医生执业资格证中的医师级别 feedetailInfo["bcc955"] = doc.TypeJob //医生执业资格证中的执业类别 feedetailInfo["bka503"] = doc.DoctorNumber //医保医师编号 feedetailInfo["bkc324"] = doc.Licensing //多点执业标志 feedetailInfo["bkc326"] = doc.DoctorServiceStatus //医师医保服务资格状态 feedetailInfo["bkc328"] = doc.MonitoringLevel //监控等级 feedetailInfo["bkc329"] = doc.DrugPsychotropicSubstances //毒麻精神药品资格 feedetailInfo["bke801"] = doc.HealthCareCode //母婴保健技术考核合格证书编号 feedetailInfo["bkc330"] = doc.PlanningTechnicalServiceCode //bkc330 计划生育技术服务人员合格证编号 feedetailInfo["bkc332"] = doc.PharmacistType //药师类别 feedetailInfo["bkc333"] = doc.PharmacistPracticeCategory //药师执业类别 feedetailInfo["bkc334"] = doc.PharmacistsLicensing //药师执业范围 feedetailInfo["bkc335"] = doc.PharmacistRegistrationNumber //执业药师注册证编号 feedetailInfo["akf001"] = doc.OfficeCode //所属科室编码 feedetailInfo["acc501"] = doc.JobNumber //工号 feedetailInfo["ahc451"] = doc.PostName //职务名称 feedetailInfo["aaf009"] = doc.TechnicalJobLevelCode //专业技术职务级别编码 feedetailInfo["bkc321"] = doc.IsActive //在职与否 feedetailInfo["ckc302"] = doc.PrescriptionQualificationIdentification //处方资格标识 feedetailInfo["bkc325"] = doc.IdentificationOutpatients //门诊大病医师 标识 feedetailInfo["ckc304"] = doc.OutpatientIllnessCategory //门诊大病类别 feedetailInfo["aae030"] = doc.StartTime //开始日期 feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } //func SzybYS001(doctor string, doctor_code string, fixmedins_code string, datas []*models.DocDetail) string { // //生成输入报文 // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) // // inputData := make(map[string]interface{}) // // inputData["listsize"] = len(datas) // inputMessage["transType"] = "YS001" // 交易编码 // feedetail := make([]map[string]interface{}, 0) // // for _, item := range datas { // fmt.Println("item222222", item.RoleId) // feedetailInfo := make(map[string]interface{}) // feedetailInfo["aac003"] = item.UserName // feedetailInfo["bka633"] = "1" // feedetailInfo["aac004"] = item.Sex // feedetailInfo["aac058"] = item.CardType // feedetailInfo["aac147"] = item.IdCard // feedetailInfo["aae005"] = item.Phone // feedetailInfo["bkc322"] = item.WorkMajorName // feedetailInfo["aac005"] = item.Nation // feedetailInfo["aac006"] = item.BirthDay // feedetailInfo["aac007"] = item.WorkTime // feedetailInfo["aac011"] = item.Education // feedetailInfo["aac183"] = item.StudyMajorName // feedetailInfo["bkc323"] = item.CertificateCode // feedetailInfo["bke955"] = item.MedicalCode // feedetailInfo["akc055"] = item.MedicalRangeCode // feedetailInfo["bcc950"] = item.MedicalLevel // feedetailInfo["bcc955"] = item.TypeJob // feedetailInfo["bka503"] = item.DoctorNumber // feedetailInfo["bkc324"] = item.Licensing // feedetailInfo["bkc326"] = item.DoctorServiceStatus // feedetailInfo["bkc328"] = item.MonitoringLevel // feedetailInfo["bkc329"] = item.DrugPsychotropicSubstances // feedetailInfo["bke801"] = item.HealthCareCode // feedetailInfo["bkc330"] = item.PlanningTechnicalServiceCode // feedetailInfo["bkc332"] = item.PharmacistType // feedetailInfo["bkc333"] = item.PharmacistPracticeCategory // feedetailInfo["bkc334"] = item.PharmacistsLicensing // feedetailInfo["bkc335"] = item.PharmacistRegistrationNumber // feedetailInfo["akf001"] = item.OfficeCode // feedetailInfo["acc501"] = item.JobNumber // feedetailInfo["ahc451"] = item.PostName // feedetailInfo["aaf009"] = item.TechnicalJobLevelCode // feedetailInfo["bkc321"] = item.IsActive // feedetailInfo["ckc302"] = item.PrescriptionQualificationIdentification // feedetailInfo["bkc325"] = item.IdentificationOutpatients // feedetailInfo["ckc304"] = item.OutpatientIllnessCategory // feedetailInfo["aae030"] = item.StartTime // feedetail = append(feedetail, feedetailInfo) // } // // inputData["inputlist"] = feedetail // inputMessage["transBody"] = inputData // // bytesData, err := json.Marshal(inputMessage) // fmt.Println(string(bytesData)) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // reader := bytes.NewReader(bytesData) // //url := "http://192.168.1.99:10000" // url := "http://192.168.1.228:17001/szsi-portal/transData" // // request, err := http.NewRequest("POST", url, reader) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // // request.Header.Set("Content-Type", "application/json;charset=UTF-8") // // client := http.Client{} // resp, err := client.Do(request) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // respBytes, err := ioutil.ReadAll(resp.Body) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // fmt.Println(string(respBytes)) // str := string(respBytes) // return str // //} func SzybYS002(doctor string, doctor_code string, fixmedins_code string, datas *models.DocDetail) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = 1 inputMessage["transType"] = "YS002" // 交易编码 feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["bkc320"] = datas.DoctorNumber feedetailInfo["bke155"] = "4" feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybYS003(doctor string, doctor_code string, fixmedins_code string, datas []*models.DocDetail) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = len(datas) inputMessage["transType"] = "YS003" // 交易编码 feedetail := make([]map[string]interface{}, 0) for _, item := range datas { feedetailInfo := make(map[string]interface{}) feedetailInfo["bkc320"] = item.StaffCode feedetailInfo["aac003"] = item.UserName feedetailInfo["bka633"] = item.RoleId feedetailInfo["aac004"] = item.Sex feedetailInfo["aac058"] = item.CardType feedetailInfo["aac147"] = item.IdCard feedetailInfo["aae005"] = item.Phone feedetailInfo["bkc322"] = item.WorkMajorName feedetailInfo["aac005"] = item.Nation feedetailInfo["aac006"] = item.BirthDay feedetailInfo["aac007"] = item.WorkTime feedetailInfo["aac011"] = item.Education feedetailInfo["aac183"] = item.StudyMajorName feedetailInfo["bkc323"] = item.CertificateCode feedetailInfo["bke955"] = item.MedicalCode feedetailInfo["akc055"] = item.MedicalRangeCode feedetailInfo["bcc950"] = item.MedicalLevel feedetailInfo["bcc955"] = item.TypeJob feedetailInfo["bka503"] = item.DoctorNumber feedetailInfo["bkc324"] = item.Licensing feedetailInfo["bkc326"] = item.DoctorServiceStatus feedetailInfo["bkc328"] = item.MonitoringLevel feedetailInfo["bkc329"] = item.DrugPsychotropicSubstances feedetailInfo["bke801"] = item.HealthCareCode feedetailInfo["bkc330"] = item.PlanningTechnicalServiceCode feedetailInfo["bkc332"] = item.PharmacistType feedetailInfo["bkc333"] = item.PharmacistPracticeCategory feedetailInfo["bkc334"] = item.PharmacistsLicensing feedetailInfo["bkc335"] = item.PharmacistRegistrationNumber feedetailInfo["akf001"] = item.OfficeCode feedetailInfo["acc501"] = item.JobNumber feedetailInfo["ahc451"] = item.PostName feedetailInfo["aaf009"] = item.TechnicalJobLevelCode feedetailInfo["bkc321"] = item.IsActive feedetailInfo["ckc302"] = item.PrescriptionQualificationIdentification feedetailInfo["bkc325"] = item.IdentificationOutpatients feedetailInfo["ckc304"] = item.OutpatientIllnessCategory feedetailInfo["aae030"] = item.StartTime feedetailInfo["aae031"] = item.EndTime feedetail = append(feedetail, feedetailInfo) } inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } func SzybYML007(doctor string, doctor_code string, fixmedins_code string, infor *models.XtGoodInformation) string { //生成输入报文 inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) inputData := make(map[string]interface{}) inputData["listsize"] = 1 inputMessage["transType"] = "ML007" // 交易编码 feedetail := make([]map[string]interface{}, 0) feedetailInfo := make(map[string]interface{}) feedetailInfo["ake001"] = infor.SocialSecurityDirectoryCode // 社保目录编码 feedetailInfo["ake005"] = infor.SocialSecurityDirectoryCode //协议机构内部目录编码 feedetailInfo["ake006"] = infor.GoodName //医药机构内部目录名称 feedetailInfo["bka053"] = infor.ManufacturerName //生产厂家 feedetailInfo["ake004"] = infor.ProductionType //生产地类别 feedetailInfo["ckf261"] = infor.SpecialMedical //特殊医用材料标识 feedetailInfo["aka067"] = "支" //计价单位 feedetailInfo["aka074"] = infor.SpecificationName //规格 feedetailInfo["bka505"] = infor.BuyPrice //进货价 feedetailInfo["bka506"] = infor.SellPrice // 收获价 feedetailInfo["aae013"] = infor.Remark //备注 feedetail = append(feedetail, feedetailInfo) inputData["inputlist"] = feedetail inputMessage["transBody"] = inputData bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) url := beego.AppConfig.String("url") request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } fmt.Println(string(respBytes)) str := string(respBytes) return str } //func SzybYML007(doctor string, doctor_code string, fixmedins_code string, datas []*models.GoodDetail) string { // // //生成输入报文 // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code) // // inputData := make(map[string]interface{}) // // inputData["listsize"] = len(datas) // inputMessage["transType"] = "ML007" // 交易编码 // feedetail := make([]map[string]interface{}, 0) // // for _, item := range datas { // fmt.Println("item222222222", item.BuyPrice) // feedetailInfo := make(map[string]interface{}) // feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode // 社保目录编码 // //feedetailInfo["ake001"] = "3333333333" // 社保目录编码 // feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码 // //feedetailInfo["ake006"] = item.GoodName //医药机构内部目录名称 // feedetailInfo["ake006"] = "222222" //医药机构内部目录名称 // feedetailInfo["bka053"] = item.ManufacturerName //生产厂家 // feedetailInfo["ake004"] = "1" //生产地类别 // feedetailInfo["ckf261"] = "1" //特殊医用材料标识 // feedetailInfo["aka067"] = "支" //计价单位 // feedetailInfo["aka074"] = "ftp" //规格 // feedetailInfo["bka505"] = item.BuyPrice //进货价 // feedetailInfo["bka506"] = item.SellPrice // 收获价 // feedetailInfo["aae013"] = item.Remark //备注 // feedetail = append(feedetail, feedetailInfo) // } // // inputData["inputlist"] = feedetail // inputMessage["transBody"] = inputData // // bytesData, err := json.Marshal(inputMessage) // fmt.Println(string(bytesData)) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // reader := bytes.NewReader(bytesData) // //url := "http://192.168.1.99:10000" // url := "http://192.168.1.228:17001/szsi-portal/transData" // // request, err := http.NewRequest("POST", url, reader) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // // request.Header.Set("Content-Type", "application/json;charset=UTF-8") // // client := http.Client{} // resp, err := client.Do(request) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // respBytes, err := ioutil.ReadAll(resp.Body) // if err != nil { // fmt.Println(err.Error()) // return err.Error() // } // fmt.Println(string(respBytes)) // str := string(respBytes) // return str //} func GetDoseCode(dose_id int64, user_org_id int64) (error, string) { var data models.DictDataconfig err := readDb.Model(&models.DictDataconfig{}).Where(" (org_id = ? Or org_id = 0) AND parent_id = 4 AND module = 'system' AND status = 1 AND value = ?", user_org_id, dose_id).First(&data).Error return err, data.Code } func UpdataOrderStatusSZ(id int64, number string, user_org_id int64) (err error) { err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0}).Error err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error return } func UpdataHisStatusSZ(user_org_id int64, his_mz_number string, his_number string, result string, his_patient_id int64) (err error) { err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND user_org_id = ? AND mz_number = ? AND number = ?", user_org_id, his_mz_number, his_number).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix(), "refund_detail": result}).Error writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"his_patient_id": 0, "mtime": time.Now().Unix()}) writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"his_patient_id": 0, "mtime": time.Now().Unix()}) return } func UpdataOrderlog(id int64, user_org_id int64, refund_log string) (err error) { err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0, "refund_log": refund_log}).Error return } func UpdateBaseDrugById(id int64) (models.XtBaseDrug, error) { drug := models.XtBaseDrug{} err := XTWriteDB().Model(&drug).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 1}).Error return drug, err } func UpdateDrugByIdDetail(id int64) (models.XtBaseDrug, error) { drug := models.XtBaseDrug{} err := XTWriteDB().Model(&drug).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 0}).Error return drug, err } func UpdateGoodInformaitonByDetail(id int64) (models.MyGoodInformation, error) { information := models.MyGoodInformation{} err := XTWriteDB().Model(&information).Where("id=?", id).Updates(map[string]interface{}{"is_mark": 1}).Error return information, err } func UpdateGoodInfoById(id int64) (models.MyGoodInformation, error) { information := models.MyGoodInformation{} err := XTWriteDB().Model(&information).Where("id=?", id).Updates(map[string]interface{}{"is_mark": 0}).Error return information, err } func UpdateProjectById(id int64) (models.MyHisProject, error) { project := models.MyHisProject{} err := XTWriteDB().Model(&project).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 1}).Error return project, err } func UpdateMyProjectById(id int64) (models.MyHisProject, error) { project := models.MyHisProject{} err := XTWriteDB().Model(&project).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 0}).Error return project, err } func UpdateAdminUserRoleById(id int64, orgid int64) (models.MySgjUserAdminRole, error) { role := models.MySgjUserAdminRole{} err = UserWriteDB().Model(&role).Where("admin_user_id = ? and org_id = ?", id, orgid).Updates(map[string]interface{}{"is_mark = ?": 1}).Error return role, err } func UpdataOrderInfoStatus(id int64, number string, user_org_id int64) { err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error err = writeDb.Model(&models.HisOrderInfo{}).Where("status = 1 AND user_org_id = ? AND order_number = ?", user_org_id, number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error return }