瀏覽代碼

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 年之前
父節點
當前提交
1120dffe12
共有 6 個文件被更改,包括 246 次插入53 次删除
  1. 1 1
      conf/app.conf
  2. 47 40
      controllers/sg/his_api_controller.go
  3. 11 7
      controllers/sz/sz_his_api_controller.go
  4. 2 0
      models/his_models.go
  5. 174 2
      service/gdyb_service.go
  6. 11 3
      service/hbyb_service.go

+ 1 - 1
conf/app.conf 查看文件

45
 
45
 
46
 
46
 
47
 [prod]
47
 [prod]
48
-org_id = 9504
48
+org_id = 10088
49
 mobile_token_expiration_second = 86400
49
 mobile_token_expiration_second = 86400
50
 httpdomain = https://api.xt.kuyicloud.com
50
 httpdomain = https://api.xt.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com
51
 sso_domain = https://sso.kuyicloud.com

+ 47 - 40
controllers/sg/his_api_controller.go 查看文件

1976
 
1976
 
1977
 			var rf []*ResultFive
1977
 			var rf []*ResultFive
1978
 			json.Unmarshal([]byte(his.Iinfo), &rf)
1978
 			json.Unmarshal([]byte(his.Iinfo), &rf)
1979
-			var insutypes []string
1979
+			var insutypes []*ResultFive
1980
 			var insutype string
1980
 			var insutype string
1981
+			var insuplc_admdvs string
1981
 			var is390 int = 0
1982
 			var is390 int = 0
1982
 			var is310 int = 0
1983
 			var is310 int = 0
1983
 
1984
 
1984
 			for _, item := range rf {
1985
 			for _, item := range rf {
1985
 				if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
1986
 				if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
1986
-					insutypes = append(insutypes, item.Insutype)
1987
+					insutypes = append(insutypes, item)
1987
 				}
1988
 				}
1988
 			}
1989
 			}
1989
 
1990
 
1990
 			if len(insutypes) == 1 {
1991
 			if len(insutypes) == 1 {
1991
-				insutype = insutypes[0]
1992
+				insutype = insutypes[0].Insutype
1993
+				//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
1992
 			} else {
1994
 			} else {
1993
 				for _, i := range insutypes {
1995
 				for _, i := range insutypes {
1994
-					if i == "390" {
1996
+					if i.Insutype == "390" {
1995
 						is390 = 1
1997
 						is390 = 1
1996
 					}
1998
 					}
1997
 
1999
 
1998
-					if i == "310" {
2000
+					if i.Insutype == "310" {
1999
 						is310 = 1
2001
 						is310 = 1
2000
 					}
2002
 					}
2001
 				}
2003
 				}
2015
 			if len(insutypes) == 2 {
2017
 			if len(insutypes) == 2 {
2016
 				insutype = med_type
2018
 				insutype = med_type
2017
 			}
2019
 			}
2018
-
2020
+			for _, item := range rf {
2021
+				if item.Insutype == insutype {
2022
+					insuplc_admdvs = item.InsuplcAdmdvs
2023
+				}
2024
+			}
2019
 			var resThree ResultThree
2025
 			var resThree ResultThree
2020
 			if miConfig.MdtrtareaAdmvs == "421300" {
2026
 			if miConfig.MdtrtareaAdmvs == "421300" {
2021
 				api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
2027
 				api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
2022
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2028
 					"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2023
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id
2029
+					"&insuplc_admdvs=" + insuplc_admdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id
2024
 				resp, requestErr := http.Get(api)
2030
 				resp, requestErr := http.Get(api)
2025
 				if requestErr != nil {
2031
 				if requestErr != nil {
2026
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2032
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2053
 
2059
 
2054
 			} else {
2060
 			} else {
2055
 				fmt.Println(roles.UserName)
2061
 				fmt.Println(roles.UserName)
2056
-				result, requestLog := service.Gdyb2201(res.Output.Baseinfo.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_id, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName)
2062
+				result, requestLog := service.Gdyb2201(res.Output.Baseinfo.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_id, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName)
2057
 				saveLog(result, requestLog, "2201", "挂号")
2063
 				saveLog(result, requestLog, "2201", "挂号")
2058
 				if err := json.Unmarshal([]byte(result), &resThree); err != nil {
2064
 				if err := json.Unmarshal([]byte(result), &resThree); err != nil {
2059
 					utils.ErrorLog("解析失败:%v", err)
2065
 					utils.ErrorLog("解析失败:%v", err)
2090
 			his.UserOrgId = adminInfo.CurrentOrgId
2096
 			his.UserOrgId = adminInfo.CurrentOrgId
2091
 			his.Ctime = time.Now().Unix()
2097
 			his.Ctime = time.Now().Unix()
2092
 			his.Mtime = time.Now().Unix()
2098
 			his.Mtime = time.Now().Unix()
2099
+			his.InsuplcAdmdvs = insuplc_admdvs
2093
 			his.Status = 1
2100
 			his.Status = 1
2094
 			service.UpdateHisPatientStatus(&his)
2101
 			service.UpdateHisPatientStatus(&his)
2095
 			service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
2102
 			service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
2241
 			data["med_type"] = strconv.FormatInt(reg_type, 10)
2248
 			data["med_type"] = strconv.FormatInt(reg_type, 10)
2242
 			data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
2249
 			data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
2243
 			data["fixmedins_code"] = miConfig.Code
2250
 			data["fixmedins_code"] = miConfig.Code
2244
-			data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
2251
+			data["insuplc_admdvs"] = his.InsuplcAdmdvs
2245
 			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
2252
 			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
2246
 			data["secret_key"] = miConfig.SecretKey
2253
 			data["secret_key"] = miConfig.SecretKey
2247
 			data["sick_code"] = sickConfig.CountryCode
2254
 			data["sick_code"] = sickConfig.CountryCode
2278
 
2285
 
2279
 		} else {
2286
 		} else {
2280
 			if miConfig.InsuplcAdmdvs == "440781" { //
2287
 			if miConfig.InsuplcAdmdvs == "440781" { //
2281
-				result, requestLog = service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.AdminUserId, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
2288
+				result, requestLog = service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.AdminUserId, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
2282
 			} else {
2289
 			} else {
2283
-				result, requestLog = service.Gdyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.AdminUserId, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
2290
+				result, requestLog = service.Gdyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.AdminUserId, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
2284
 			}
2291
 			}
2285
 			saveLog(result, requestLog, "2203", "上传就诊信息")
2292
 			saveLog(result, requestLog, "2203", "上传就诊信息")
2286
 			var respJSON2 map[string]interface{}
2293
 			var respJSON2 map[string]interface{}
2321
 		} else {
2328
 		} else {
2322
 			his.Diagnosis = diagnosis_id
2329
 			his.Diagnosis = diagnosis_id
2323
 			his.SickType = sickConfig.ID
2330
 			his.SickType = sickConfig.ID
2324
-			his.PType = fmt.Sprintf("%d", reg_type)
2331
+			var p_type int64
2332
+			if reg_type == 1111 || reg_type == 1112 {
2333
+				p_type = 11
2334
+
2335
+			}
2336
+			his.PType = fmt.Sprintf("%d", p_type)
2325
 			service.UpdateHisPatientThree(&his)
2337
 			service.UpdateHisPatientThree(&his)
2326
 
2338
 
2327
 			data := make(map[string]interface{})
2339
 			data := make(map[string]interface{})
2328
 			if settle_accounts_type == 1 { //日结
2340
 			if settle_accounts_type == 1 { //日结
2329
 
2341
 
2330
-				if reg_type == 11 {
2342
+				if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
2331
 					prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
2343
 					prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
2332
 				} else {
2344
 				} else {
2333
 					prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
2345
 					prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
2359
 
2371
 
2360
 			}
2372
 			}
2361
 
2373
 
2362
-			if reg_type == 1111 || reg_type == 1112 {
2363
-				reg_type = 11
2364
-			}
2365
-
2366
 			timestamp := time.Now().Unix()
2374
 			timestamp := time.Now().Unix()
2367
 			tempTime := time.Unix(timestamp, 0)
2375
 			tempTime := time.Unix(timestamp, 0)
2368
 			timeFormat := tempTime.Format("20060102150405")
2376
 			timeFormat := tempTime.Format("20060102150405")
2385
 				data["dept_code"] = department.Number
2393
 				data["dept_code"] = department.Number
2386
 			}
2394
 			}
2387
 
2395
 
2388
-			data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
2396
+			data["insuplc_admdvs"] = his.InsuplcAdmdvs
2389
 			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
2397
 			data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
2390
 			data["secret_key"] = miConfig.SecretKey
2398
 			data["secret_key"] = miConfig.SecretKey
2391
 			data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
2399
 			data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
2428
 					}
2436
 					}
2429
 
2437
 
2430
 				} else {
2438
 				} else {
2431
-					result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string))
2439
+					result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string))
2432
 					var dat map[string]interface{}
2440
 					var dat map[string]interface{}
2433
 					if err := json.Unmarshal([]byte(result), &dat); err == nil {
2441
 					if err := json.Unmarshal([]byte(result), &dat); err == nil {
2434
 						fmt.Println(dat)
2442
 						fmt.Println(dat)
2636
 							api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
2644
 							api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
2637
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
2645
 								his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
2638
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2646
 								"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2639
-								"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2647
+								"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2640
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
2648
 								"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
2641
 								"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
2649
 								"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
2642
 								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
2650
 								"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
2670
 							}
2678
 							}
2671
 
2679
 
2672
 						} else {
2680
 						} else {
2673
-							result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, acct_used_flag)
2681
+							result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, acct_used_flag)
2674
 							var dat map[string]interface{}
2682
 							var dat map[string]interface{}
2675
 							if err := json.Unmarshal([]byte(result2), &dat); err == nil {
2683
 							if err := json.Unmarshal([]byte(result2), &dat); err == nil {
2676
 								fmt.Println(dat)
2684
 								fmt.Println(dat)
2889
 				api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
2897
 				api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
2890
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
2898
 					his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
2891
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2899
 					"&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
2892
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2900
+					"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2893
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
2901
 					"&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
2894
 					"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
2902
 					"&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
2895
 					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
2903
 					"&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
2925
 
2933
 
2926
 			} else {
2934
 			} else {
2927
 
2935
 
2928
-				result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
2936
+				result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
2929
 				var dat map[string]interface{}
2937
 				var dat map[string]interface{}
2930
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
2938
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
2931
 					fmt.Println(dat)
2939
 					fmt.Println(dat)
3716
 
3724
 
3717
 		data := make(map[string]interface{})
3725
 		data := make(map[string]interface{})
3718
 		if settle_accounts_type == 1 { //日结
3726
 		if settle_accounts_type == 1 { //日结
3719
-			if reg_type == 11 {
3727
+			if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
3720
 				prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
3728
 				prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
3721
 			} else {
3729
 			} else {
3722
 				prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
3730
 				prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
3745
 			data["pre"] = prescriptions
3753
 			data["pre"] = prescriptions
3746
 		}
3754
 		}
3747
 
3755
 
3748
-		if reg_type == 1111 || reg_type == 1112 {
3749
-			reg_type = 11
3750
-		}
3751
-
3752
 		client := &http.Client{}
3756
 		client := &http.Client{}
3753
 		data["psn_no"] = his.PsnNo
3757
 		data["psn_no"] = his.PsnNo
3754
 		data["mdtrt_id"] = his.Number
3758
 		data["mdtrt_id"] = his.Number
4391
 	//	return
4395
 	//	return
4392
 	//}
4396
 	//}
4393
 	//recordDateTime := theTime.Unix()
4397
 	//recordDateTime := theTime.Unix()
4394
-	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
4395
 	var order models.HisOrder
4398
 	var order models.HisOrder
4396
 	order, _ = service.GetHisOrderByID(order_id)
4399
 	order, _ = service.GetHisOrderByID(order_id)
4400
+	his, _ := service.GetHisPatientByNumber(order.MdtrtId)
4401
+
4397
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
4402
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
4398
 	if order.ID == 0 {
4403
 	if order.ID == 0 {
4399
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4404
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4410
 		if miConfig.MdtrtareaAdmvs == "421300" {
4415
 		if miConfig.MdtrtareaAdmvs == "421300" {
4411
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2208?psn_no=" + order.PsnNo +
4416
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2208?psn_no=" + order.PsnNo +
4412
 				"&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4417
 				"&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4413
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4418
+				"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4414
 			resp3, requestErr3 := http.Get(api3)
4419
 			resp3, requestErr3 := http.Get(api3)
4415
 			if requestErr3 != nil {
4420
 			if requestErr3 != nil {
4416
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4421
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4440
 			}
4445
 			}
4441
 
4446
 
4442
 		} else {
4447
 		} else {
4443
-			result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
4448
+			result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
4444
 			var dat map[string]interface{}
4449
 			var dat map[string]interface{}
4445
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
4450
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
4446
 				fmt.Println(dat)
4451
 				fmt.Println(dat)
4463
 
4468
 
4464
 				api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
4469
 				api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
4465
 					"&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4470
 					"&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4466
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4471
+					"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4467
 				resp3, requestErr3 := http.Get(api3)
4472
 				resp3, requestErr3 := http.Get(api3)
4468
 				if requestErr3 != nil {
4473
 				if requestErr3 != nil {
4469
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4474
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4494
 
4499
 
4495
 			} else {
4500
 			} else {
4496
 
4501
 
4497
-				result2, src_request := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
4502
+				result2, src_request := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
4498
 				var dat map[string]interface{}
4503
 				var dat map[string]interface{}
4499
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
4504
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
4500
 					fmt.Println(dat)
4505
 					fmt.Println(dat)
4577
 
4582
 
4578
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
4583
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
4579
 				"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4584
 				"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4580
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4585
+				"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4581
 			resp3, requestErr3 := http.Get(api3)
4586
 			resp3, requestErr3 := http.Get(api3)
4582
 			if requestErr3 != nil {
4587
 			if requestErr3 != nil {
4583
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4588
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4611
 
4616
 
4612
 			api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
4617
 			api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
4613
 				"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4618
 				"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4614
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4619
+				"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4615
 			resp3, requestErr3 := http.Get(api3)
4620
 			resp3, requestErr3 := http.Get(api3)
4616
 			if requestErr3 != nil {
4621
 			if requestErr3 != nil {
4617
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4622
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4676
 }
4681
 }
4677
 func (c *HisApiController) RefundDetail() {
4682
 func (c *HisApiController) RefundDetail() {
4678
 	order_id, _ := c.GetInt64("order_id")
4683
 	order_id, _ := c.GetInt64("order_id")
4679
-	his_patient_id, _ := c.GetInt64("his_patient_id")
4684
+	//his_patient_id, _ := c.GetInt64("his_patient_id")
4680
 
4685
 
4681
 	number := c.GetString("number")
4686
 	number := c.GetString("number")
4682
 	record_time := c.GetString("record_time")
4687
 	record_time := c.GetString("record_time")
4691
 		return
4696
 		return
4692
 	}
4697
 	}
4693
 	recordDateTime := theTime.Unix()
4698
 	recordDateTime := theTime.Unix()
4694
-	his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
4699
+	//his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
4700
+
4695
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
4701
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
4696
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
4702
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
4697
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
4703
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
4703
 		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
4709
 		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
4704
 
4710
 
4705
 	}
4711
 	}
4712
+	his, _ := service.GetHisPatientByNumber(order.MdtrtId)
4706
 
4713
 
4707
 	if config.IsOpen == 1 { //对接了医保,走医保流程
4714
 	if config.IsOpen == 1 { //对接了医保,走医保流程
4708
 		api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
4715
 		api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
4709
 			"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4716
 			"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
4710
-			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4717
+			"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
4711
 		resp2, requestErr2 := http.Get(api2)
4718
 		resp2, requestErr2 := http.Get(api2)
4712
 		if requestErr2 != nil {
4719
 		if requestErr2 != nil {
4713
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4720
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5339
 	baseParams := models.BaseParams{
5346
 	baseParams := models.BaseParams{
5340
 		SecretKey:      miConfig.SecretKey,
5347
 		SecretKey:      miConfig.SecretKey,
5341
 		FixmedinsCode:  miConfig.Code,
5348
 		FixmedinsCode:  miConfig.Code,
5342
-		InsuplcAdmdvs:  miConfig.InsuplcAdmdvs,
5349
+		InsuplcAdmdvs:  his.InsuplcAdmdvs,
5343
 		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
5350
 		MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
5344
 		OrgName:        miConfig.OrgName,
5351
 		OrgName:        miConfig.OrgName,
5345
 		Doctor:         user_name,
5352
 		Doctor:         user_name,
5356
 
5363
 
5357
 			api := "http://192.168.124.4:9532/" + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
5364
 			api := "http://192.168.124.4:9532/" + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
5358
 				"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
5365
 				"&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
5359
-				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
5366
+				"&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
5360
 			resp, requestErr := http.Get(api)
5367
 			resp, requestErr := http.Get(api)
5361
 			if requestErr != nil {
5368
 			if requestErr != nil {
5362
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5369
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 11 - 7
controllers/sz/sz_his_api_controller.go 查看文件

2285
 							ChargeSerialNumber: newFl,
2285
 							ChargeSerialNumber: newFl,
2286
 							Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
2286
 							Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
2287
 							CodeName:           subItem.BaseDrugLib.DrugName,
2287
 							CodeName:           subItem.BaseDrugLib.DrugName,
2288
-							BwCode:				subItem.BaseDrugLib.Code,
2288
+							BwCode:             subItem.BaseDrugLib.Code,
2289
 							Flag:               "1",
2289
 							Flag:               "1",
2290
 							Price:              price,
2290
 							Price:              price,
2291
 							Count:              subItem.PrescribingNumber,
2291
 							Count:              subItem.PrescribingNumber,
2319
 								OrderType:          "1",
2319
 								OrderType:          "1",
2320
 								ChargeSerialNumber: newFl,
2320
 								ChargeSerialNumber: newFl,
2321
 								Code:               subItem.HisProject.MedicalCode,
2321
 								Code:               subItem.HisProject.MedicalCode,
2322
-								BwCode:				subItem.HisProject.MedicalCode,
2322
+								BwCode:             subItem.HisProject.MedicalCode,
2323
 								CodeName:           subItem.HisProject.ProjectName,
2323
 								CodeName:           subItem.HisProject.ProjectName,
2324
 								Flag:               "1",
2324
 								Flag:               "1",
2325
 								Price:              subItem.Price,
2325
 								Price:              subItem.Price,
2350
 								ChargeSerialNumber: newFl,
2350
 								ChargeSerialNumber: newFl,
2351
 								Code:               subItem.GoodInfo.MedicalInsuranceNumber,
2351
 								Code:               subItem.GoodInfo.MedicalInsuranceNumber,
2352
 								CodeName:           subItem.GoodInfo.GoodName,
2352
 								CodeName:           subItem.GoodInfo.GoodName,
2353
-								BwCode:				subItem.GoodInfo.MedicalInsuranceNumber,
2353
+								BwCode:             subItem.GoodInfo.MedicalInsuranceNumber,
2354
 								Flag:               "1",
2354
 								Flag:               "1",
2355
 								Price:              subItem.Price,
2355
 								Price:              subItem.Price,
2356
 								Count:              count,
2356
 								Count:              count,
3031
 	var start_time int64
3031
 	var start_time int64
3032
 	var end_time int64
3032
 	var end_time int64
3033
 
3033
 
3034
+	if reg_type == 1111 || reg_type == 1112 {
3035
+		reg_type = 11
3036
+	}
3034
 	if settle_accounts_type == 1 { //日结
3037
 	if settle_accounts_type == 1 { //日结
3035
-		if reg_type == 11 {
3038
+
3039
+		if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
3036
 
3040
 
3037
 			prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
3041
 			prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
3038
 		} else {
3042
 		} else {
3117
 						OrderType:          "1",
3121
 						OrderType:          "1",
3118
 						ChargeSerialNumber: newFl,
3122
 						ChargeSerialNumber: newFl,
3119
 						Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
3123
 						Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
3120
-						BwCode:				subItem.BaseDrugLib.Code,
3124
+						BwCode:             subItem.BaseDrugLib.Code,
3121
 						CodeName:           subItem.BaseDrugLib.DrugName,
3125
 						CodeName:           subItem.BaseDrugLib.DrugName,
3122
 						Flag:               "1",
3126
 						Flag:               "1",
3123
 						Price:              price,
3127
 						Price:              price,
3153
 							ChargeSerialNumber: newFl,
3157
 							ChargeSerialNumber: newFl,
3154
 							Code:               subItem.HisProject.MedicalCode,
3158
 							Code:               subItem.HisProject.MedicalCode,
3155
 							CodeName:           subItem.HisProject.ProjectName,
3159
 							CodeName:           subItem.HisProject.ProjectName,
3156
-							BwCode:				subItem.HisProject.MedicalCode,
3160
+							BwCode:             subItem.HisProject.MedicalCode,
3157
 							Flag:               "1",
3161
 							Flag:               "1",
3158
 							Price:              subItem.Price,
3162
 							Price:              subItem.Price,
3159
 							Count:              count,
3163
 							Count:              count,
3183
 							OrderType:          "1",
3187
 							OrderType:          "1",
3184
 							ChargeSerialNumber: newFl,
3188
 							ChargeSerialNumber: newFl,
3185
 							Code:               subItem.GoodInfo.MedicalInsuranceNumber,
3189
 							Code:               subItem.GoodInfo.MedicalInsuranceNumber,
3186
-							BwCode:               subItem.GoodInfo.MedicalInsuranceNumber,
3190
+							BwCode:             subItem.GoodInfo.MedicalInsuranceNumber,
3187
 							CodeName:           subItem.GoodInfo.GoodName,
3191
 							CodeName:           subItem.GoodInfo.GoodName,
3188
 							Flag:               "1",
3192
 							Flag:               "1",
3189
 							Price:              subItem.Price,
3193
 							Price:              subItem.Price,

+ 2 - 0
models/his_models.go 查看文件

124
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
124
 	YiliaoNumber           string  `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
125
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
125
 	MzNumber               string  `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
126
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
126
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
127
+	InsuplcAdmdvs          string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
127
 }
128
 }
128
 
129
 
129
 func (HisPatient) TableName() string {
130
 func (HisPatient) TableName() string {
801
 	Diagnosis              string  `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
802
 	Diagnosis              string  `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
802
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
803
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
803
 	PType                  int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
804
 	PType                  int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
805
+	InsuplcAdmdvs          string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
804
 }
806
 }
805
 
807
 
806
 func (VMHisPatient) TableName() string {
808
 func (VMHisPatient) TableName() string {

+ 174 - 2
service/gdyb_service.go 查看文件

531
 	inputData := make(map[string]interface{})
531
 	inputData := make(map[string]interface{})
532
 	diseinfo := make([]map[string]interface{}, 0)
532
 	diseinfo := make([]map[string]interface{}, 0)
533
 
533
 
534
+	if med_type == "1111" || med_type == "1112" {
535
+		med_type = "11"
536
+	}
537
+
534
 	inputMessage["infno"] = "2203"        // 交易编码
538
 	inputMessage["infno"] = "2203"        // 交易编码
535
 	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
539
 	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
536
 	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
540
 	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
636
 	inputData := make(map[string]interface{})
640
 	inputData := make(map[string]interface{})
637
 	diseinfo := make([]map[string]interface{}, 0)
641
 	diseinfo := make([]map[string]interface{}, 0)
638
 
642
 
643
+	if med_type == "1111" || med_type == "1112" {
644
+		med_type = "11"
645
+	}
646
+
639
 	inputMessage["infno"] = "2203A"       // 交易编码
647
 	inputMessage["infno"] = "2203A"       // 交易编码
640
 	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
648
 	inputData["mdtrt_id"] = mdtrtId       // 就诊 ID(来自2201接口返回)
641
 	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
649
 	inputData["psn_no"] = psnNo           // 人员编号 (来自1101接口返回)
1112
 		}
1120
 		}
1113
 	}
1121
 	}
1114
 	if insuplc_admdvs == "421300" {
1122
 	if insuplc_admdvs == "421300" {
1115
-		if med_type == "11" {
1123
+		if med_type == "11" || med_type == "1112" || med_type == "1111" {
1116
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1124
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1117
 		} else if med_type == "14" {
1125
 		} else if med_type == "14" {
1118
 			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
1126
 			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
1222
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1230
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1223
 		}
1231
 		}
1224
 	}
1232
 	}
1225
-
1233
+	if med_type == "1111" || med_type == "1112" {
1234
+		med_type = "11"
1235
+	}
1226
 	if insuplc_admdvs == "421300" {
1236
 	if insuplc_admdvs == "421300" {
1227
 		if med_type == "11" {
1237
 		if med_type == "11" {
1228
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1238
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1822
 }
1832
 }
1823
 
1833
 
1824
 func Gdyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
1834
 func Gdyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
1835
+	if med_type == "1111" || med_type == "1112" {
1836
+		med_type = "11"
1837
+	}
1825
 	// 生成签名
1838
 	// 生成签名
1826
 	nonce := GetRandomString(32)
1839
 	nonce := GetRandomString(32)
1827
 	timestamp := time.Now().Unix()
1840
 	timestamp := time.Now().Unix()
2681
 	return str
2694
 	return str
2682
 }
2695
 }
2683
 
2696
 
2697
+//func Gdyb7101(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
2698
+//	// 生成签名
2699
+//	nonce := GetRandomString(32)
2700
+//	timestamp := time.Now().Unix()
2701
+//	signature := setSignature(timestamp, nonce, secret_key)
2702
+//	tempTime := time.Unix(timestamp, 0)
2703
+//	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2704
+//
2705
+//	timeFormatTwo := tempTime.Format("2006-01-02")
2706
+//
2707
+//	t := time.Now()
2708
+//	last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
2709
+//	tm := time.Unix(last.Unix(), 0)
2710
+//
2711
+//	// 生成输入报文
2712
+//	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2713
+//	input := make(map[string]interface{})
2714
+//	inputData := make(map[string]interface{})
2715
+//
2716
+//	inputData2 := make(map[string]interface{})
2717
+//
2718
+//	inputMessage["infno"] = "7101"                 // 交易编码
2719
+//	inputData["hosp_rxno"] = psnNo                    // 人员编号 (来自1101接口返回)
2720
+//	inputData["init_rxno"] = insutype               // 险种类型(来自1101接口返回)
2721
+//	inputData["rx_type_code"] = sick_code        // 险种类型(来自1101接口返回)
2722
+//	inputData["prsc_time"] = sick_name        // 险种类型(来自1101接口返回)
2723
+//	inputData["rx_drug_nums"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
2724
+//	inputData["rx_way_codg"] = fixmedins_code // 险种类型(来自1101接口返回)
2725
+//	inputData["rx_way_name"] = org_name     // 险种类型(来自1101接口返回)
2726
+//	inputData["rx_freq_codg"] = timeFormatTwo     // 险种类型(来自1101接口返回)
2727
+//	inputData["rx_freq_name"] = doctor_id          // 开始时间
2728
+//	inputData["rx_dosunt"] = doctor             // 开始时间
2729
+//	inputData["rx_doscnt"] = timeFormatTwo          // 医师编码
2730
+//	inputData["rx_drord_dscr"] = ""                          // 医师编码
2731
+//	inputData["valid_days"] = ""                         // 医师编码
2732
+//	inputData["valid_end_time"] = tm.Format("2006-01-02") // 医师编码
2733
+//	inputData["rept_flag"] = tm.Format("2006-01-02") // 医师编码
2734
+//	inputData["max_rept_cnt"] = tm.Format("2006-01-02") // 医师编码
2735
+//	inputData["reptd_cnt"] = tm.Format("2006-01-02") // 医师编码
2736
+//	inputData["min_inrv_days"] = tm.Format("2006-01-02") // 医师编码
2737
+//	inputData["dr_sign_info"] = tm.Format("2006-01-02") // 医师编码
2738
+//	inputData["phar_sign_info"] = tm.Format("2006-01-02") // 医师编码
2739
+//	inputData["fixmedins_sign_info"] = tm.Format("2006-01-02") // 医师编码
2740
+//	inputData["rx_cotn_flag"] = tm.Format("2006-01-02") // 医师编码
2741
+//	inputData["rx_file"] = tm.Format("2006-01-02") // 医师编码
2742
+//	input["data"] = inputData
2743
+//
2744
+//
2745
+//	inputData2["med_list_codg"] = psnNo                    // 人员编号 (来自1101接口返回)
2746
+//	inputData2["fixmedins_hilist_id"] = insutype               // 险种类型(来自1101接口返回)
2747
+//	inputData["hosp_prep_flag"] = sick_code        // 险种类型(来自1101接口返回)
2748
+//	inputData["rx_item_type_code"] = sick_name        // 险种类型(来自1101接口返回)
2749
+//	inputData["rx_item_type_name"] = insuplc_admdvs      // 险种类型(来自1101接口返回)
2750
+//	inputData["tcmdrug_type_name"] = fixmedins_code // 险种类型(来自1101接口返回)
2751
+//	inputData["tcmdrug_type_code"] = org_name     // 险种类型(来自1101接口返回)
2752
+//	inputData["tcmherb_foote"] = timeFormatTwo     // 险种类型(来自1101接口返回)
2753
+//	inputData["medn_type_code"] = doctor_id          // 开始时间
2754
+//	inputData["medn_type_name"] = doctor             // 开始时间
2755
+//	inputData["main_medc_flag"] = timeFormatTwo          // 医师编码
2756
+//	inputData["urgt_flag"] = ""                          // 医师编码
2757
+//	inputData["bas_medn_flag"] = ""                         // 医师编码
2758
+//	inputData["imp_drug_flag"] = tm.Format("2006-01-02") // 医师编码
2759
+//	inputData["prod_barc"] = tm.Format("2006-01-02") // 医师编码
2760
+//	inputData["drug_prodname"] = tm.Format("2006-01-02") // 医师编码
2761
+//
2762
+//	inputData["genname_codg"] = tm.Format("2006-01-02") // 医师编码
2763
+//	inputData["drug_genname"] = tm.Format("2006-01-02") // 医师编码
2764
+//	inputData["chemname"] = tm.Format("2006-01-02") // 医师编码
2765
+//
2766
+//	inputData["drugstdcode"] = tm.Format("2006-01-02") // 医师编码
2767
+//	inputData["drug_dosform"] = tm.Format("2006-01-02") // 医师编码
2768
+//
2769
+//
2770
+//	inputData["drug_spec"] = tm.Format("2006-01-02") // 医师编码
2771
+//	inputData["prdr_name"] = tm.Format("2006-01-02") // 医师编码
2772
+//
2773
+//
2774
+//	inputData["drug_pric"] = tm.Format("2006-01-02") // 医师编码
2775
+//	inputData["drug_cnt"] = tm.Format("2006-01-02") // 医师编码
2776
+//	inputData["drug_cnt_unit"] = tm.Format("2006-01-02") // 医师编码
2777
+//	inputData["drug_sumamt"] = tm.Format("2006-01-02") // 医师编码
2778
+//	inputData["medc_way_codg"] = tm.Format("2006-01-02") // 医师编码
2779
+//	inputData["medc_way_dscr"] = tm.Format("2006-01-02") // 医师编码
2780
+//	inputData["medc_starttime"] = tm.Format("2006-01-02") // 医师编码
2781
+//
2782
+//	inputData["medc_endtime"] = tm.Format("2006-01-02") // 医师编码
2783
+//
2784
+//
2785
+//	inputData["medc_days"] = tm.Format("2006-01-02") // 医师编码
2786
+//	inputData["drug_dosunt"] = tm.Format("2006-01-02") // 医师编码
2787
+//	inputData["sin_doscnt"] = tm.Format("2006-01-02") // 医师编码
2788
+//	inputData["sin_dosunt"] = tm.Format("2006-01-02") // 医师编码
2789
+//	inputData["used_frqu_codg"] = tm.Format("2006-01-02") // 医师编码
2790
+//
2791
+//
2792
+//	inputData["used_frqu_name"] = tm.Format("2006-01-02") // 医师编码
2793
+//	inputData["drug_totlnt"] = tm.Format("2006-01-02") // 医师编码
2794
+//
2795
+//	inputData["drug_totlnt_emp"] = tm.Format("2006-01-02") // 医师编码
2796
+//	inputData["dise_codg"] = tm.Format("2006-01-02") // 医师编码
2797
+//	inputData["drug_res"] = tm.Format("2006-01-02") // 医师编码
2798
+//	inputData["drug_limit"] = tm.Format("2006-01-02") // 医师编码
2799
+//
2800
+//
2801
+//
2802
+//
2803
+//
2804
+//
2805
+//
2806
+//
2807
+//
2808
+//	input["rxdrugdetail"] = inputData2
2809
+//
2810
+//
2811
+//
2812
+//
2813
+//	inputMessage["input"] = input //交易输入
2814
+//	bytesData, err := json.Marshal(inputMessage)
2815
+//	fmt.Println(string(bytesData))
2816
+//	if err != nil {
2817
+//		fmt.Println(err.Error())
2818
+//		return err.Error()
2819
+//	}
2820
+//	reader := bytes.NewReader(bytesData)
2821
+//	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
2822
+//	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
2823
+//	gdyb_url := beego.AppConfig.String("gdyb_url")
2824
+//	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
2825
+//	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
2826
+//	url := gdyb_url + "2503"
2827
+//
2828
+//	request, err := http.NewRequest("POST", url, reader)
2829
+//	if err != nil {
2830
+//		fmt.Println(err.Error())
2831
+//		return err.Error()
2832
+//	}
2833
+//
2834
+//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
2835
+//	request.Header.Set("x-tif-paasid", gdyb_paasid)
2836
+//	request.Header.Set("x-tif-signature", signature)
2837
+//	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
2838
+//	request.Header.Set("x-tif-nonce", nonce)
2839
+//
2840
+//	client := http.Client{}
2841
+//	resp, err := client.Do(request)
2842
+//	if err != nil {
2843
+//		fmt.Println(err.Error())
2844
+//		return err.Error()
2845
+//	}
2846
+//	respBytes, err := ioutil.ReadAll(resp.Body)
2847
+//	if err != nil {
2848
+//		fmt.Println(err.Error())
2849
+//		return err.Error()
2850
+//	}
2851
+//	str := string(respBytes)
2852
+//	fmt.Println(str)
2853
+//	return str
2854
+//}
2855
+
2684
 // 生成签名
2856
 // 生成签名
2685
 func setSignature(timestamp int64, nonce string, secret_key string) string {
2857
 func setSignature(timestamp int64, nonce string, secret_key string) string {
2686
 	str := strconv.FormatInt(timestamp, 10) + secret_key + nonce + strconv.FormatInt(timestamp, 10)
2858
 	str := strconv.FormatInt(timestamp, 10) + secret_key + nonce + strconv.FormatInt(timestamp, 10)

+ 11 - 3
service/hbyb_service.go 查看文件

213
 	inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
213
 	inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
214
 
214
 
215
 	if insuplc_admdvs == "421300" {
215
 	if insuplc_admdvs == "421300" {
216
-		if med_type == "11" {
216
+		if med_type == "11" || med_type == "1111" || med_type == "1112" {
217
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
217
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
218
 		} else if med_type == "14" {
218
 		} else if med_type == "14" {
219
 			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
219
 			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
495
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
495
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
496
 		}
496
 		}
497
 	}
497
 	}
498
+	if med_type == "1111" || med_type == "1112" {
499
+
500
+		med_type = "11"
501
+	}
502
+
498
 	if insuplc_admdvs == "421300" {
503
 	if insuplc_admdvs == "421300" {
499
-		if med_type == "11" {
504
+		if med_type == "11" || med_type == "1111" || med_type == "1112" {
500
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
505
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
501
 		} else if med_type == "14" {
506
 		} else if med_type == "14" {
502
 			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
507
 			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
562
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
567
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
563
 		}
568
 		}
564
 	}
569
 	}
570
+	if med_type == "1111" || med_type == "1112" {
571
+		med_type = "11"
572
+	}
565
 
573
 
566
 	if insuplc_admdvs == "421300" {
574
 	if insuplc_admdvs == "421300" {
567
-		if med_type == "11" {
575
+		if med_type == "11" || med_type == "1111" || med_type == "1112" {
568
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
576
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
569
 		} else if med_type == "14" {
577
 		} else if med_type == "14" {
570
 			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
578
 			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号