test_user 1 week ago
parent
commit
6d6c07bcef

+ 65 - 59
controllers/sg/his_api_controller.go View File

5380
 	struct3505.Bchno = "---"
5380
 	struct3505.Bchno = "---"
5381
 	struct3505.FixmedinsCode = miConfig.Code
5381
 	struct3505.FixmedinsCode = miConfig.Code
5382
 	struct3505.Code = miConfig.Code
5382
 	struct3505.Code = miConfig.Code
5383
-	struct3505.FinlTrnsPric = drug.HisDoctorAdviceInfo.Price
5383
+	struct3505.FinlTrnsPric =  strconv.FormatFloat(drug.HisDoctorAdviceInfo.Price, 'f', -1, 64)
5384
 
5384
 
5385
 	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
5385
 	roles, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
5386
 	struct3505.PrscDrName = roles.UserName
5386
 	struct3505.PrscDrName = roles.UserName
5485
 	} else {
5485
 	} else {
5486
 		struct3505.TrdnFlag = "1"
5486
 		struct3505.TrdnFlag = "1"
5487
 	}
5487
 	}
5488
-
5489
 	if drug.HisDoctorAdviceInfo.ZeroFlag == 1 {
5488
 	if drug.HisDoctorAdviceInfo.ZeroFlag == 1 {
5490
 		struct3505.TrdnFlag = "1"
5489
 		struct3505.TrdnFlag = "1"
5491
 	}
5490
 	}
5495
 
5494
 
5496
 	}
5495
 	}
5497
 
5496
 
5497
+
5498
+	if org_id == 10610 || org_id == 10278 || org_id == 10138 || org_id == 10537{
5499
+
5500
+		if drug.HisDoctorAdviceInfo.BaseDrugLib.IsZeroFlag == 1 {
5501
+			struct3505.TrdnFlag = "1"
5502
+		}
5503
+
5504
+		if drug.HisDoctorAdviceInfo.BaseDrugLib.IsZeroFlag == 2 {
5505
+			struct3505.TrdnFlag = "0"
5506
+
5507
+		}
5508
+
5509
+	}
5510
+
5511
+
5512
+
5498
 	struct3505.RtalDocno = order.Number
5513
 	struct3505.RtalDocno = order.Number
5499
 	struct3505.PsnCertType = "01"
5514
 	struct3505.PsnCertType = "01"
5500
 
5515
 
12025
 				order.RxID = strconv.FormatInt(item.ID, 10)
12040
 				order.RxID = strconv.FormatInt(item.ID, 10)
12026
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12041
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12027
 				order.LongDrordFlag = "0"
12042
 				order.LongDrordFlag = "0"
12028
-				order.HilistType = "1"
12043
+				order.HilistType = "101"
12029
 				order.ChrgType = "1"
12044
 				order.ChrgType = "1"
12030
 				order.DrordBhvr = "-"
12045
 				order.DrordBhvr = "-"
12031
 				order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12046
 				order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12058
 				order.RxID = strconv.FormatInt(item.ID, 10)
12073
 				order.RxID = strconv.FormatInt(item.ID, 10)
12059
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12074
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12060
 				order.LongDrordFlag = "0"
12075
 				order.LongDrordFlag = "0"
12061
-				order.HilistType = "1"
12076
+				order.HilistType = "201"
12062
 				order.ChrgType = "1"
12077
 				order.ChrgType = "1"
12063
 				order.DrordBhvr = "-"
12078
 				order.DrordBhvr = "-"
12064
 				order.HilistCode = subItem.HisProject.MedicalCode
12079
 				order.HilistCode = subItem.HisProject.MedicalCode
12092
 				order.RxID = strconv.FormatInt(item.ID, 10)
12107
 				order.RxID = strconv.FormatInt(item.ID, 10)
12093
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12108
 				order.Rxno = strconv.FormatInt(item.ID, 10)
12094
 				order.LongDrordFlag = "0"
12109
 				order.LongDrordFlag = "0"
12095
-				order.HilistType = "1"
12110
+				order.HilistType = "301"
12096
 				order.ChrgType = "1"
12111
 				order.ChrgType = "1"
12097
 				order.DrordBhvr = "0"
12112
 				order.DrordBhvr = "0"
12098
 				order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
12113
 				order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
12321
 					order.RxID = strconv.FormatInt(item.ID, 10)
12336
 					order.RxID = strconv.FormatInt(item.ID, 10)
12322
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12337
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12323
 					order.LongDrordFlag = "0"
12338
 					order.LongDrordFlag = "0"
12324
-					order.HilistType = "1"
12339
+					order.HilistType = "101"
12325
 					order.ChrgType = "1"
12340
 					order.ChrgType = "1"
12326
 					order.DrordBhvr = "0"
12341
 					order.DrordBhvr = "0"
12327
 					order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12342
 					order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12355
 					order.RxID = strconv.FormatInt(item.ID, 10)
12370
 					order.RxID = strconv.FormatInt(item.ID, 10)
12356
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12371
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12357
 					order.LongDrordFlag = "0"
12372
 					order.LongDrordFlag = "0"
12358
-					order.HilistType = "1"
12373
+					order.HilistType = "201"
12359
 					order.ChrgType = "1"
12374
 					order.ChrgType = "1"
12360
 					order.DrordBhvr = "0"
12375
 					order.DrordBhvr = "0"
12361
 					order.HilistCode = subItem.HisProject.MedicalCode
12376
 					order.HilistCode = subItem.HisProject.MedicalCode
12389
 					order.RxID = strconv.FormatInt(item.ID, 10)
12404
 					order.RxID = strconv.FormatInt(item.ID, 10)
12390
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12405
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12391
 					order.LongDrordFlag = "0"
12406
 					order.LongDrordFlag = "0"
12392
-					order.HilistType = "1"
12407
+					order.HilistType = "301"
12393
 					order.ChrgType = "1"
12408
 					order.ChrgType = "1"
12394
 					order.DrordBhvr = "0"
12409
 					order.DrordBhvr = "0"
12395
 					order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
12410
 					order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
12624
 					order.RxID = strconv.FormatInt(item.ID, 10)
12639
 					order.RxID = strconv.FormatInt(item.ID, 10)
12625
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12640
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12626
 					order.LongDrordFlag = "0"
12641
 					order.LongDrordFlag = "0"
12627
-					order.HilistType = "1"
12642
+					order.HilistType = "101"
12628
 					order.ChrgType = "1"
12643
 					order.ChrgType = "1"
12629
 					order.DrordBhvr = "0"
12644
 					order.DrordBhvr = "0"
12630
 					order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12645
 					order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
12657
 					order.RxID = strconv.FormatInt(item.ID, 10)
12672
 					order.RxID = strconv.FormatInt(item.ID, 10)
12658
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12673
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12659
 					order.LongDrordFlag = "0"
12674
 					order.LongDrordFlag = "0"
12660
-					order.HilistType = "1"
12675
+					order.HilistType = "201"
12661
 					order.ChrgType = "1"
12676
 					order.ChrgType = "1"
12662
 					order.DrordBhvr = "0"
12677
 					order.DrordBhvr = "0"
12663
 					order.HilistCode = subItem.HisProject.MedicalCode
12678
 					order.HilistCode = subItem.HisProject.MedicalCode
12691
 					order.RxID = strconv.FormatInt(item.ID, 10)
12706
 					order.RxID = strconv.FormatInt(item.ID, 10)
12692
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12707
 					order.Rxno = strconv.FormatInt(item.ID, 10)
12693
 					order.LongDrordFlag = "0"
12708
 					order.LongDrordFlag = "0"
12694
-					order.HilistType = "1"
12709
+					order.HilistType = "301"
12695
 					order.ChrgType = "1"
12710
 					order.ChrgType = "1"
12696
 					order.DrordBhvr = "0"
12711
 					order.DrordBhvr = "0"
12697
 					order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
12712
 					order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
13019
 				order.RxID = strconv.FormatInt(item.ID, 10)
13034
 				order.RxID = strconv.FormatInt(item.ID, 10)
13020
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13035
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13021
 				order.LongDrordFlag = "0"
13036
 				order.LongDrordFlag = "0"
13022
-				order.HilistType = "1"
13023
-				order.ChrgType = "1"
13037
+				order.HilistType = "101"
13038
+				order.ChrgType = "01"
13024
 				order.DrordBhvr = "0"
13039
 				order.DrordBhvr = "0"
13025
 				order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
13040
 				order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
13026
 				order.HosplistName = subItem.BaseDrugLib.DrugName
13041
 				order.HosplistName = subItem.BaseDrugLib.DrugName
13053
 				order.RxID = strconv.FormatInt(item.ID, 10)
13068
 				order.RxID = strconv.FormatInt(item.ID, 10)
13054
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13069
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13055
 				order.LongDrordFlag = "0"
13070
 				order.LongDrordFlag = "0"
13056
-				order.HilistType = "1"
13057
-				order.ChrgType = "1"
13071
+				order.HilistType = "201"
13072
+				order.ChrgType = "05"
13058
 				order.DrordBhvr = "0"
13073
 				order.DrordBhvr = "0"
13059
 				order.HilistCode = subItem.HisProject.MedicalCode
13074
 				order.HilistCode = subItem.HisProject.MedicalCode
13060
 				order.HosplistName = subItem.HisProject.ProjectName
13075
 				order.HosplistName = subItem.HisProject.ProjectName
13087
 				order.RxID = strconv.FormatInt(item.ID, 10)
13102
 				order.RxID = strconv.FormatInt(item.ID, 10)
13088
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13103
 				order.Rxno = strconv.FormatInt(item.ID, 10)
13089
 				order.LongDrordFlag = "0"
13104
 				order.LongDrordFlag = "0"
13090
-				order.HilistType = "1"
13091
-				order.ChrgType = "1"
13105
+				order.HilistType = "301"
13106
+				order.ChrgType = "08"
13092
 				order.DrordBhvr = "0"
13107
 				order.DrordBhvr = "0"
13093
 				order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
13108
 				order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
13094
 				order.HosplistName = subItem.GoodInfo.GoodName
13109
 				order.HosplistName = subItem.GoodInfo.GoodName
14826
 			bas := strings.Split(basStr, "|")
14841
 			bas := strings.Split(basStr, "|")
14827
 			basNumber := bas[1]
14842
 			basNumber := bas[1]
14828
 			fmt.Println(basNumber)
14843
 			fmt.Println(basNumber)
14844
+			card := bas[2]
14845
+
14829
 			card_sn := bas[3]
14846
 			card_sn := bas[3]
14830
 			fmt.Println(card_sn)
14847
 			fmt.Println(card_sn)
14831
 			patient, _ := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
14848
 			patient, _ := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
14832
 
14849
 
14833
-			result, _ := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, patient.Name)
14850
+			result, _ := service.Jxyb11012(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, patient.Name,card)
14834
 
14851
 
14835
 			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
14852
 			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
14836
 			var dat map[string]interface{}
14853
 			var dat map[string]interface{}
15089
 			}
15106
 			}
15090
 
15107
 
15091
 		} else if miConfig.MdtrtareaAdmvs == "360100" {
15108
 		} else if miConfig.MdtrtareaAdmvs == "360100" {
15109
+			fmt.Println(initFlag)
15110
+			fmt.Println("initFlag")
15092
 
15111
 
15093
-			basStr := c.GetBasBaseInfo22222()
15094
-			fmt.Println(basStr)
15095
-
15112
+			if initFlag == 0 {
15113
+				c.TestGetJiangXiBasBaseInittwo()
15114
+			}
15115
+			basStr := c.GetBasBaseInfo()
15096
 			if len(basStr) == 0 {
15116
 			if len(basStr) == 0 {
15097
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
15117
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
15098
 				return
15118
 				return
15099
 			}
15119
 			}
15100
 			fmt.Println(basStr)
15120
 			fmt.Println(basStr)
15101
 			bas := strings.Split(basStr, "|")
15121
 			bas := strings.Split(basStr, "|")
15102
-			basNumber := bas[2] //卡号
15103
-			card_sn := bas[3]   //
15104
-
15105
-			id_card_No := bas[1] //卡号
15106
-
15122
+			basNumber := bas[1]
15107
 			fmt.Println(basNumber)
15123
 			fmt.Println(basNumber)
15124
+			card_sn := bas[3]
15108
 			fmt.Println(card_sn)
15125
 			fmt.Println(card_sn)
15109
-			fmt.Println(id_card_No)
15110
-
15111
-			var patient service.Patients
15112
-			if len(id_card_No) == 0 {
15113
-
15114
-				patient, _ = service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15115
-
15116
-			} else {
15117
-				patient, _ = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15118
-
15119
-			}
15126
+			patient, _ := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15120
 
15127
 
15121
-			result, _ := service.Jxyb1101bycard(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, patient.Name, patient.IdCardNo)
15128
+			result, _ := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, patient.Name)
15122
 
15129
 
15123
 			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
15130
 			//result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
15124
 			var dat map[string]interface{}
15131
 			var dat map[string]interface{}
15137
 			}
15144
 			}
15138
 
15145
 
15139
 			if res.Infcode == 0 {
15146
 			if res.Infcode == 0 {
15140
-				var pateint2 service.Patients
15141
-				var err error
15142
-				if len(id_card_No) == 0 {
15143
-					pateint2, err = service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15144
-
15145
-				} else {
15146
-					pateint2, err = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15147
-
15148
-					//patient, _ = service.GetPatientByNumber(id_card_No, c.GetAdminUserInfo().CurrentOrgId)
15149
-
15150
-				}
15147
+				patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
15151
 				if err == gorm.ErrRecordNotFound {
15148
 				if err == gorm.ErrRecordNotFound {
15152
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
15149
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
15153
 					return
15150
 					return
15210
 					psn := &models.HisPsn{
15207
 					psn := &models.HisPsn{
15211
 						PsnNo: res.Output.Baseinfo.PsnNo,
15208
 						PsnNo: res.Output.Baseinfo.PsnNo,
15212
 
15209
 
15213
-						PatientId: pateint2.ID,
15210
+						PatientId: patient.ID,
15214
 						Certno:    res.Output.Baseinfo.Certno,
15211
 						Certno:    res.Output.Baseinfo.Certno,
15215
 
15212
 
15216
 						Gend:          res.Output.Baseinfo.Gend,
15213
 						Gend:          res.Output.Baseinfo.Gend,
15237
 				return
15234
 				return
15238
 			}
15235
 			}
15239
 
15236
 
15237
+
15238
+
15240
 		} else if miConfig.MdtrtareaAdmvs == "430800" {
15239
 		} else if miConfig.MdtrtareaAdmvs == "430800" {
15241
 			fmt.Println(initFlag)
15240
 			fmt.Println(initFlag)
15242
 			fmt.Println("initFlag")
15241
 			fmt.Println("initFlag")
25796
 	social_type, _ := c.GetInt64("social_type")
25795
 	social_type, _ := c.GetInt64("social_type")
25797
 	admin_user_id, _ := c.GetInt64("admin_user_id")
25796
 	admin_user_id, _ := c.GetInt64("admin_user_id")
25798
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
25797
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
25798
+	insuplc_admdvs_tt := c.GetString("insuplc_admdvs")
25799
+
25799
 	mdtrt_type := c.GetString("mdtrt_type")
25800
 	mdtrt_type := c.GetString("mdtrt_type")
25800
 	if id_card_type == 5 {
25801
 	if id_card_type == 5 {
25801
 		id_card_type = 4
25802
 		id_card_type = 4
27527
 					}
27528
 					}
27528
 					var result string
27529
 					var result string
27529
 					var requestLog string
27530
 					var requestLog string
27530
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" {
27531
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" ||  miConfig.Code == "H44082500483" {
27531
 						var hisPrescription []*models.HisPrescription
27532
 						var hisPrescription []*models.HisPrescription
27532
 						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
27533
 						res3101 := Checkgd3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription, department)
27533
 						if res3101.Infcode == 0 {
27534
 						if res3101.Infcode == 0 {
27656
 
27657
 
27657
 						for _, item := range rf {
27658
 						for _, item := range rf {
27658
 
27659
 
27659
-							utils.ErrorLog("解析失败:%v", item.Insutype)
27660
-							utils.ErrorLog("解析失败:%v", insutype)
27660
+
27661
 
27661
 
27662
 							if item.Insutype == insutype {
27662
 							if item.Insutype == insutype {
27663
 								insuplc_admdvs_temp = item.InsuplcAdmdvs
27663
 								insuplc_admdvs_temp = item.InsuplcAdmdvs
27664
-								utils.ErrorLog("解析失败:%v", insuplc_admdvs_temp)
27665
 
27664
 
27666
 							}
27665
 							}
27667
 
27666
 
27668
 						}
27667
 						}
27669
 
27668
 
27669
+						if len(insuplc_admdvs_tt) > 0{
27670
+							insuplc_admdvs_temp = insuplc_admdvs_tt
27671
+
27672
+
27673
+						}
27674
+
27670
 						result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27675
 						result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27671
 						saveLog(result, requestLog, "2201A", "挂号")
27676
 						saveLog(result, requestLog, "2201A", "挂号")
27672
 					}
27677
 					}
31125
 					}
31130
 					}
31126
 					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, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, "", admin_user_id)
31131
 					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, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag, "", admin_user_id)
31127
 				} else {
31132
 				} else {
31128
-					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" {
31133
+					if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" ||  miConfig.Code == "H44082500483" {
31129
 						result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "7", tempOrder.ID)
31134
 						result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "7", tempOrder.ID)
31130
 						if result3101.Infcode == 0 {
31135
 						if result3101.Infcode == 0 {
31131
 							if len(result3101.Output.Result) > 0 {
31136
 							if len(result3101.Output.Result) > 0 {
33116
 						res.Infcode = infocode
33121
 						res.Infcode = infocode
33117
 
33122
 
33118
 					} else {
33123
 					} else {
33119
-						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255" {
33124
+						if miConfig.Code == "H44030903432" || miConfig.Code == "H44030501364" || miConfig.Code == "H44030500255"  ||  miConfig.Code == "H44082500483"{
33120
 							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
33125
 							result3101 := Checkgd3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
33121
 							if result3101.Infcode == 0 {
33126
 							if result3101.Infcode == 0 {
33122
 								if len(result3101.Output.Result) > 0 {
33127
 								if len(result3101.Output.Result) > 0 {
34586
 
34591
 
34587
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
34592
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
34588
 							allTotal = fmt.Sprintf("%.2f", total_two)
34593
 							allTotal = fmt.Sprintf("%.2f", total_two)
34589
-							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" {
34594
+							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" || miConfig.Code == "H44030500255" ||  miConfig.Code == "H44082500483" {
34590
 
34595
 
34591
 								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
34596
 								result3101 := Checkgd3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
34592
 								if result3101.Infcode == 0 {
34597
 								if result3101.Infcode == 0 {
36746
 					"msg": "退号成功",
36751
 					"msg": "退号成功",
36747
 				})
36752
 				})
36748
 				service.UpdataRegStatusTwo(his_patient_id, recordDateTime, adminUser.CurrentOrgId)
36753
 				service.UpdataRegStatusTwo(his_patient_id, recordDateTime, adminUser.CurrentOrgId)
36754
+				//service.UpdataOrderStatusTen(his., recordDateTime, adminUser.CurrentOrgId)
36749
 
36755
 
36750
 			} else {
36756
 			} else {
36751
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
36757
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
37918
 			baseParams.RequestUrl = miConfig.Url
37924
 			baseParams.RequestUrl = miConfig.Url
37919
 
37925
 
37920
 			if clr_type == "9903" {
37926
 			if clr_type == "9903" {
37921
-				clr_type = "9994"
37927
+				clr_type = "9901"
37922
 			}
37928
 			}
37923
 
37929
 
37924
 			businessParams := models.BusinessParams{
37930
 			businessParams := models.BusinessParams{
40020
 		res.Output.Setlinfo.PsnCashPay = order.PsnCashPay
40026
 		res.Output.Setlinfo.PsnCashPay = order.PsnCashPay
40021
 
40027
 
40022
 		if res.Infcode == 0 {
40028
 		if res.Infcode == 0 {
40023
-			if adminUser.CurrentOrgId == 10215 || adminUser.CurrentOrgId == 10387 || adminUser.CurrentOrgId == 9919 || adminUser.CurrentOrgId == 10088 || adminUser.CurrentOrgId == 10150 || adminUser.CurrentOrgId == 10454 || adminUser.CurrentOrgId == 10644 || adminUser.CurrentOrgId == 10653 || adminUser.CurrentOrgId == 10210 {
40029
+			if adminUser.CurrentOrgId == 10215 || adminUser.CurrentOrgId == 10387 || adminUser.CurrentOrgId == 9919 || adminUser.CurrentOrgId == 10088 || adminUser.CurrentOrgId == 10150 || adminUser.CurrentOrgId == 10454 || adminUser.CurrentOrgId == 10644 || adminUser.CurrentOrgId == 10653{
40024
 				c.ServeSuccessJSON(map[string]interface{}{
40030
 				c.ServeSuccessJSON(map[string]interface{}{
40025
 					"diagnosis":            name,
40031
 					"diagnosis":            name,
40026
 					"order_infos":          orderInfos,
40032
 					"order_infos":          orderInfos,

+ 1 - 1
controllers/zh/zh_his_api_controller.go View File

1494
 			result = string(result_byte)
1494
 			result = string(result_byte)
1495
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1495
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1496
 
1496
 
1497
-		} else if miConfig.MdtrtareaAdmvs == "360399" ||  miConfig.MdtrtareaAdmvs == "361025" {
1497
+		} else if miConfig.MdtrtareaAdmvs == "360399" ||  miConfig.MdtrtareaAdmvs == "361025" || miConfig.MdtrtareaAdmvs == "360100" {
1498
 			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code,  miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, patient.Name, patient.IdCardNo, patient.Name)
1498
 			result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code,  miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 0, miConfig.Url, miConfig.AccessKey, patient.Name, patient.IdCardNo, patient.Name)
1499
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1499
 			saveLog(result_log, request_log, "1101", "人员基本信息获取")
1500
 		}else if miConfig.MdtrtareaAdmvs == "341203"{
1500
 		}else if miConfig.MdtrtareaAdmvs == "341203"{

+ 219 - 219
main.go View File

705
 //}GetAllHisOrder10138
705
 //}GetAllHisOrder10138
706
 //
706
 //
707
 //
707
 //
708
-//func GetblBatchSettleList() {
709
-//	org_id, _ := beego.AppConfig.Int64("org_id")
710
-//	var orders []*models.HisOrder
711
-//	//var orders []*models.HisOrderError
712
-//	orders, _ = service.GetAllHisOrder10138()
713
-//	for _, item := range orders {
714
-//		order_id := item.ID
715
-//		order, _ := service.GetHisOrderByIDTwo(order_id)
716
-//		if order.MedType == "14" {
717
-//			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
718
-//			var patientPrescription models.HisPrescriptionInfo
719
-//			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
720
-//			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
721
-//			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
722
-//			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
723
-//			var configTwo []*models.HisXtDiagnoseConfig
724
-//			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
725
-//			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5320)
726
-//			for _, item := range diagnosis_idstwo {
727
-//				id, _ := strconv.ParseInt(item, 10, 64)
728
-//				diagnosisConfig, _ := service.FindDiagnoseById(id)
729
-//				configTwo = append(configTwo, &diagnosisConfig)
730
-//			}
731
-//			patient, _ := service.GetPatientByIDTwo(10028, order.PatientId)
732
-//
733
-//			sickConfig, _ := service.FindSickById(his.SickType)
734
-//			//if order.MedType == "1111" || order.MedType == "1112" {
735
-//			//	order.MedType = "11"
736
-//			//}
737
-//			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
738
-//
739
-//			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
740
-//			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
741
-//			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
742
-//			if order.ID == 0 {
743
-//				return
744
-//			}
745
-//			if his.BalanceAccountsType == 2 {
746
-//				continue
747
-//			}
748
-//			struct4101 := service.Struct4101{
749
-//				PsnNo:          order.PsnNo,
750
-//				MdtrtId:        order.MdtrtId,
751
-//				SetlId:         order.SetlId,
752
-//				PsnName:        order.PsnName,
753
-//				Gend:           order.Gend,
754
-//				Brdy:           his.Brdy,
755
-//				Age:            his.Age,
756
-//				Naty:           order.Naty,
757
-//				PatnCertType:   order.PsnCertType,
758
-//				Certno:         order.Certno,
759
-//				Prfs:           "90",
760
-//				ConerName:      "",
761
-//				PatnRlts:       "",
762
-//				ConerAddr:      "",
763
-//				ConerTel:       "",
764
-//				HiType:         order.Insutype,
765
-//				Insuplc:        his.InsuplcAdmdvs,
766
-//				MaindiagFlag:   "1",
767
-//				BillCode:       order.SetlId,
768
-//				BillNo:         order.SetlId,
769
-//				BizSn:          order.Number,
770
-//				PsnSelfPay:     order.PsnPartAmt,
771
-//				PsnOwnPay:      order.PsnPartAmt,
772
-//				AcctPay:        order.AcctPay,
773
-//				PsnCashpay:     order.PsnCashPay,
774
-//				HiPaymtd:       "1",
775
-//				Hsorg:          his.InsuplcAdmdvs,
776
-//				HsorgOpter:     his.InsuplcAdmdvs,
777
-//				MedinsFillPsn:  curRoles.UserName,
778
-//				MedinsFillDept: depart.Name,
779
-//				IptMedType:     "2",
780
-//				CurAddr:        patient.HomeAddress,
781
-//			}
782
-//
783
-//			struct4101.SetlBegnDate = order.SetlTime
784
-//			struct4101.SetlEndDate = order.SetlTime
785
-//
786
-//			var rf []CustomFundPay
787
-//			json.Unmarshal([]byte(order.SetlDetail), &rf)
788
-//
789
-//			//var tempFunPays []service.CustomStruct
790
-//			//var tempFunPay610100 service.CustomStruct
791
-//
792
-//			//for _, item := range rf {
793
-//			//	if item.FundPayType == "610100" {
794
-//			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
795
-//			//		tempFunPay610100.FundPayType = item.FundPayType
796
-//			//	} else {
797
-//			//		var tempFunPay service.CustomStruct
798
-//			//		tempFunPay.FundPayamt = item.FundPayamt
799
-//			//		tempFunPay.FundPayType = item.FundPayType
800
-//			//		tempFunPays = append(tempFunPays, tempFunPay)
801
-//			//	}
802
-//			//}
803
-//			//tempFunPays = append(tempFunPays, tempFunPay610100)
804
-//			//struct4101.CustomStruct = tempFunPays
805
-//
806
-//			var tempDiaginfos []service.DiaginfoStructTwo
807
-//			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
808
-//			var tempOpspdiseinfos []service.OpspdiseinfoStruct
809
-//
810
-//			diagnosis_ids := strings.Split(his.Diagnosis, ",")
811
-//			var config []*models.HisXtDiagnoseConfig
812
-//			for _, item := range diagnosis_ids {
813
-//				id, _ := strconv.ParseInt(item, 10, 64)
814
-//				if id == 24 {
815
-//
816
-//					diagnosisConfig, _ := service.FindDiagnoseById(id)
817
-//					config = append(config, &diagnosisConfig)
818
-//				}
819
-//
820
-//			}
821
-//
822
-//			for _, item := range diagnosis_ids {
823
-//
824
-//				id, _ := strconv.ParseInt(item, 10, 64)
825
-//				if id != 24 {
826
-//					diagnosisConfig, _ := service.FindDiagnoseById(id)
827
-//					config = append(config, &diagnosisConfig)
828
-//				}
829
-//
830
-//			}
831
-//
832
-//			for index, item := range config {
833
-//				if index == 0 {
834
-//					var tempDiaginfo service.DiaginfoStructTwo
835
-//					tempDiaginfo.DiagCode = item.CountryCode
836
-//					tempDiaginfo.DiagName = item.CountryContentName
837
-//					tempDiaginfo.DiagType = "1"
838
-//					tempDiaginfo.MaindiagFlag = "1"
839
-//					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
840
-//				} else {
841
-//
842
-//					var tempDiaginfo service.DiaginfoStructTwo
843
-//					tempDiaginfo.DiagCode = item.CountryCode
844
-//					tempDiaginfo.DiagName = item.CountryContentName
845
-//					tempDiaginfo.DiagType = "1"
846
-//					tempDiaginfo.MaindiagFlag = "0"
847
-//					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
848
-//				}
849
-//			}
850
-//			struct4101.Diseinfo = tempDiaginfos
851
-//			sickConfigTwo, _ := service.FindSickById(his.SickType)
852
-//			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
853
-//			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
854
-//			tempOpspdiseinfo2.OprnOprtCode = ""
855
-//			tempOpspdiseinfo2.OprnOprtName = ""
856
-//			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
857
-//			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
858
-//			time_arr := strings.Split(order.SetlTime, " ")
859
-//			struct4101.AdmTime = time_arr[0]
860
-//			struct4101.AdmEndTime = time_arr[0]
861
-//			struct4101.DoctorName = doctor.UserName
862
-//			struct4101.DoctorCode = doctor.DoctorNumber
863
-//
864
-//			struct4101.Ntly = "CHN"
865
-//			struct4101.AdmCaty = "A03.06"
866
-//			var res ResultSeventeen
867
-//
868
-//			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
869
-//			fmt.Println(result)
870
-//			saveLog(result, request, "4101A", "清单上传")
871
-//			var dat map[string]interface{}
872
-//			if err := json.Unmarshal([]byte(result), &dat); err == nil {
873
-//				fmt.Println(dat)
874
-//			} else {
875
-//				fmt.Println(err)
876
-//			}
877
-//			userJSONBytes, _ := json.Marshal(dat)
878
-//			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
879
-//				//utils.ErrorLog("解析失败:%v", err)
880
-//				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
881
-//				//adminUser := c.GetAdminUserInfo()
882
-//				errlog := &models.HisOrderError{
883
-//					UserOrgId: org_id,
884
-//					Ctime:     time.Now().Unix(),
885
-//					Mtime:     time.Now().Unix(),
886
-//					ErrMsg:    res.ErrMsg + "解析失败",
887
-//					Status:    1,
888
-//					PatientId: order_id,
889
-//					Stage:     10138600,
890
-//				}
891
-//				service.CreateErrMsgLog(errlog)
892
-//				continue
893
-//			}
894
-//
895
-//			if res.Infcode != 0 {
896
-//				//adminUser := c.GetAdminUserInfo()
897
-//				errlog := &models.HisOrderError{
898
-//					UserOrgId: org_id,
899
-//					Ctime:     time.Now().Unix(),
900
-//					Mtime:     time.Now().Unix(),
901
-//					ErrMsg:    res.ErrMsg,
902
-//					Status:    1,
903
-//					PatientId: order_id,
904
-//					Stage:     10138600,
905
-//				}
906
-//				service.CreateErrMsgLog(errlog)
907
-//				continue
908
-//			} else {
909
-//				hisFundSettleListResult := &models.HisFundSettleListResult{
910
-//					Number:    res.Output.SetlListId,
911
-//					Status:    1,
912
-//					Ctime:     time.Now().Unix(),
913
-//					Mtime:     time.Now().Unix(),
914
-//					UserOrgId: org_id,
915
-//					IsUpload:  1,
916
-//					OrderId:   order_id,
917
-//				}
918
-//				service.CreateUploadRecord(hisFundSettleListResult)
919
-//				continue
920
-//			}
921
-//		}
922
-//	}
923
-//}
708
+func GetblBatchSettleList() {
709
+	org_id, _ := beego.AppConfig.Int64("org_id")
710
+	var orders []*models.HisOrder
711
+	//var orders []*models.HisOrderError
712
+	orders, _ = service.GetAllHisOrder10138()
713
+	for _, item := range orders {
714
+		order_id := item.ID
715
+		order, _ := service.GetHisOrderByIDTwo(order_id)
716
+		if order.MedType == "14" {
717
+			his, _ := service.GetHisPatientByNumber(order.MdtrtId)
718
+			var patientPrescription models.HisPrescriptionInfo
719
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
720
+			doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
721
+			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
722
+			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
723
+			var configTwo []*models.HisXtDiagnoseConfig
724
+			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
725
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 5318)
726
+			for _, item := range diagnosis_idstwo {
727
+				id, _ := strconv.ParseInt(item, 10, 64)
728
+				diagnosisConfig, _ := service.FindDiagnoseById(id)
729
+				configTwo = append(configTwo, &diagnosisConfig)
730
+			}
731
+			patient, _ := service.GetPatientByIDTwo(10138, order.PatientId)
732
+
733
+			sickConfig, _ := service.FindSickById(his.SickType)
734
+			//if order.MedType == "1111" || order.MedType == "1112" {
735
+			//	order.MedType = "11"
736
+			//}
737
+			service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
738
+
739
+			depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
740
+			pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
741
+			doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
742
+			if order.ID == 0 {
743
+				return
744
+			}
745
+			if his.BalanceAccountsType == 2 {
746
+				continue
747
+			}
748
+			struct4101 := service.Struct4101{
749
+				PsnNo:          order.PsnNo,
750
+				MdtrtId:        order.MdtrtId,
751
+				SetlId:         order.SetlId,
752
+				PsnName:        order.PsnName,
753
+				Gend:           order.Gend,
754
+				Brdy:           his.Brdy,
755
+				Age:            his.Age,
756
+				Naty:           order.Naty,
757
+				PatnCertType:   order.PsnCertType,
758
+				Certno:         order.Certno,
759
+				Prfs:           "90",
760
+				ConerName:      "",
761
+				PatnRlts:       "",
762
+				ConerAddr:      "",
763
+				ConerTel:       "",
764
+				HiType:         order.Insutype,
765
+				Insuplc:        his.InsuplcAdmdvs,
766
+				MaindiagFlag:   "1",
767
+				BillCode:       order.SetlId,
768
+				BillNo:         order.SetlId,
769
+				BizSn:          order.Number,
770
+				PsnSelfPay:     order.PsnPartAmt,
771
+				PsnOwnPay:      order.PsnPartAmt,
772
+				AcctPay:        order.AcctPay,
773
+				PsnCashpay:     order.PsnCashPay,
774
+				HiPaymtd:       "1",
775
+				Hsorg:          his.InsuplcAdmdvs,
776
+				HsorgOpter:     his.InsuplcAdmdvs,
777
+				MedinsFillPsn:  curRoles.UserName,
778
+				MedinsFillDept: depart.Name,
779
+				IptMedType:     "2",
780
+				CurAddr:        patient.HomeAddress,
781
+			}
782
+
783
+			struct4101.SetlBegnDate = order.SetlTime
784
+			struct4101.SetlEndDate = order.SetlTime
785
+
786
+			var rf []CustomFundPay
787
+			json.Unmarshal([]byte(order.SetlDetail), &rf)
788
+
789
+			//var tempFunPays []service.CustomStruct
790
+			//var tempFunPay610100 service.CustomStruct
791
+
792
+			//for _, item := range rf {
793
+			//	if item.FundPayType == "610100" {
794
+			//		tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
795
+			//		tempFunPay610100.FundPayType = item.FundPayType
796
+			//	} else {
797
+			//		var tempFunPay service.CustomStruct
798
+			//		tempFunPay.FundPayamt = item.FundPayamt
799
+			//		tempFunPay.FundPayType = item.FundPayType
800
+			//		tempFunPays = append(tempFunPays, tempFunPay)
801
+			//	}
802
+			//}
803
+			//tempFunPays = append(tempFunPays, tempFunPay610100)
804
+			//struct4101.CustomStruct = tempFunPays
805
+
806
+			var tempDiaginfos []service.DiaginfoStructTwo
807
+			var tempOpspdiseinfo2 service.OpspdiseinfoStruct
808
+			var tempOpspdiseinfos []service.OpspdiseinfoStruct
809
+
810
+			diagnosis_ids := strings.Split(his.Diagnosis, ",")
811
+			var config []*models.HisXtDiagnoseConfig
812
+			for _, item := range diagnosis_ids {
813
+				id, _ := strconv.ParseInt(item, 10, 64)
814
+				if id == 24 {
815
+
816
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
817
+					config = append(config, &diagnosisConfig)
818
+				}
819
+
820
+			}
821
+
822
+			for _, item := range diagnosis_ids {
823
+
824
+				id, _ := strconv.ParseInt(item, 10, 64)
825
+				if id != 24 {
826
+					diagnosisConfig, _ := service.FindDiagnoseById(id)
827
+					config = append(config, &diagnosisConfig)
828
+				}
829
+
830
+			}
831
+
832
+			for index, item := range config {
833
+				if index == 0 {
834
+					var tempDiaginfo service.DiaginfoStructTwo
835
+					tempDiaginfo.DiagCode = item.CountryCode
836
+					tempDiaginfo.DiagName = item.CountryContentName
837
+					tempDiaginfo.DiagType = "1"
838
+					tempDiaginfo.MaindiagFlag = "1"
839
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
840
+				} else {
841
+
842
+					var tempDiaginfo service.DiaginfoStructTwo
843
+					tempDiaginfo.DiagCode = item.CountryCode
844
+					tempDiaginfo.DiagName = item.CountryContentName
845
+					tempDiaginfo.DiagType = "1"
846
+					tempDiaginfo.MaindiagFlag = "0"
847
+					tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
848
+				}
849
+			}
850
+			struct4101.Diseinfo = tempDiaginfos
851
+			sickConfigTwo, _ := service.FindSickById(his.SickType)
852
+			tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
853
+			tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
854
+			tempOpspdiseinfo2.OprnOprtCode = ""
855
+			tempOpspdiseinfo2.OprnOprtName = ""
856
+			tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
857
+			struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
858
+			time_arr := strings.Split(order.SetlTime, " ")
859
+			struct4101.AdmTime = time_arr[0]
860
+			struct4101.AdmEndTime = time_arr[0]
861
+			struct4101.DoctorName = doctor.UserName
862
+			struct4101.DoctorCode = doctor.DoctorNumber
863
+
864
+			struct4101.Ntly = "CHN"
865
+			struct4101.AdmCaty = "A03.06"
866
+			var res ResultSeventeen
867
+
868
+			result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
869
+			fmt.Println(result)
870
+			saveLog(result, request, "4101A", "清单上传")
871
+			var dat map[string]interface{}
872
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
873
+				fmt.Println(dat)
874
+			} else {
875
+				fmt.Println(err)
876
+			}
877
+			userJSONBytes, _ := json.Marshal(dat)
878
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
879
+				//utils.ErrorLog("解析失败:%v", err)
880
+				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
881
+				//adminUser := c.GetAdminUserInfo()
882
+				errlog := &models.HisOrderError{
883
+					UserOrgId: org_id,
884
+					Ctime:     time.Now().Unix(),
885
+					Mtime:     time.Now().Unix(),
886
+					ErrMsg:    res.ErrMsg + "解析失败",
887
+					Status:    1,
888
+					PatientId: order_id,
889
+					Stage:     10138600,
890
+				}
891
+				service.CreateErrMsgLog(errlog)
892
+				continue
893
+			}
894
+
895
+			if res.Infcode != 0 {
896
+				//adminUser := c.GetAdminUserInfo()
897
+				errlog := &models.HisOrderError{
898
+					UserOrgId: org_id,
899
+					Ctime:     time.Now().Unix(),
900
+					Mtime:     time.Now().Unix(),
901
+					ErrMsg:    res.ErrMsg,
902
+					Status:    1,
903
+					PatientId: order_id,
904
+					Stage:     10138600,
905
+				}
906
+				service.CreateErrMsgLog(errlog)
907
+				continue
908
+			} else {
909
+				hisFundSettleListResult := &models.HisFundSettleListResult{
910
+					Number:    res.Output.SetlListId,
911
+					Status:    1,
912
+					Ctime:     time.Now().Unix(),
913
+					Mtime:     time.Now().Unix(),
914
+					UserOrgId: org_id,
915
+					IsUpload:  1,
916
+					OrderId:   order_id,
917
+				}
918
+				service.CreateUploadRecord(hisFundSettleListResult)
919
+				continue
920
+			}
921
+		}
922
+	}
923
+}
924
 
924
 
925
 func GetblbrBatchSettleList() {
925
 func GetblbrBatchSettleList() {
926
 	org_id, _ := beego.AppConfig.Int64("org_id")
926
 	org_id, _ := beego.AppConfig.Int64("org_id")
927
-	org_id = 10537
927
+	org_id = 10278
928
 	var orders []*models.HisOrder
928
 	var orders []*models.HisOrder
929
 	//var orders []*models.HisOrderError
929
 	//var orders []*models.HisOrderError
930
 	orders, _ = service.GetAllHisOrder10278()
930
 	orders, _ = service.GetAllHisOrder10278()
940
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
940
 			miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
941
 			var configTwo []*models.HisXtDiagnoseConfig
941
 			var configTwo []*models.HisXtDiagnoseConfig
942
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
942
 			diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
943
-			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2234)
943
+			curRoles, _ := service.GetAdminUserInfoByID(org_id, 2791)
944
 			for _, item := range diagnosis_idstwo {
944
 			for _, item := range diagnosis_idstwo {
945
 				id, _ := strconv.ParseInt(item, 10, 64)
945
 				id, _ := strconv.ParseInt(item, 10, 64)
946
 				diagnosisConfig, _ := service.FindDiagnoseById(id)
946
 				diagnosisConfig, _ := service.FindDiagnoseById(id)
947
 				configTwo = append(configTwo, &diagnosisConfig)
947
 				configTwo = append(configTwo, &diagnosisConfig)
948
 			}
948
 			}
949
-			patient, _ := service.GetPatientByIDTwo(10537, order.PatientId)
949
+			patient, _ := service.GetPatientByIDTwo(10278, order.PatientId)
950
 
950
 
951
 			//sickConfig, _ := service.FindSickById(his.SickType)
951
 			//sickConfig, _ := service.FindSickById(his.SickType)
952
 			//if order.MedType == "1111" || order.MedType == "1112" {
952
 			//if order.MedType == "1111" || order.MedType == "1112" {

+ 1 - 0
models/drug.go View File

73
 	Bck01b             string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
73
 	Bck01b             string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
74
 	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
74
 	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
75
 
75
 
76
+	IsZeroFlag           int64   `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
76
 
77
 
77
 
78
 
78
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
79
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`

+ 1 - 1
models/models_3501.go View File

173
 	ExpyEnd             string
173
 	ExpyEnd             string
174
 	RxFlag              string
174
 	RxFlag              string
175
 	TrdnFlag            string
175
 	TrdnFlag            string
176
-	FinlTrnsPric        float64
176
+	FinlTrnsPric        string
177
 	Rxno                string
177
 	Rxno                string
178
 	RxCircFlag          string
178
 	RxCircFlag          string
179
 	RtalDocno           string
179
 	RtalDocno           string

+ 4 - 2
service/his_service.go View File

420
 	HospApprFlag         int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
420
 	HospApprFlag         int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
421
 	LmtUsedFlag          int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
421
 	LmtUsedFlag          int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
422
 	IsUser               int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
422
 	IsUser               int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
423
+	IsZeroFlag           int64   `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
423
 
424
 
424
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
425
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
425
 	OtherDrugWarehouseInfo []*OtherDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"stock_in"`
426
 	OtherDrugWarehouseInfo []*OtherDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"stock_in"`
1569
 	return
1570
 	return
1570
 }
1571
 }
1571
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1572
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1572
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-01-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1573
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> '' AND setl_time >= '2024-11-01 00:00:00'  and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1573
 	fmt.Println(err)
1574
 	fmt.Println(err)
1574
 	return
1575
 	return
1575
 }
1576
 }
1579
 }
1580
 }
1580
 
1581
 
1581
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1582
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1582
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10537  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-09-01 00:00:00' AND setl_time <= '2024-10-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1583
+
1584
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-11-01 00:00:00' AND setl_time <= '2024-11-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1583
 	fmt.Println(err)
1585
 	fmt.Println(err)
1584
 	return
1586
 	return
1585
 }
1587
 }

+ 1 - 1
service/hn_service.go View File

411
 	//timestamp := time.Now().Unix()
411
 	//timestamp := time.Now().Unix()
412
 	//timestamp := time.Now().Unix()
412
 	//timestamp := time.Now().Unix()
413
 
413
 
414
-	//timestamp2 := time.Now().Unix()
414
+	timestamp2 := time.Now().Unix()
415
 
415
 
416
 
416
 
417
 	var customs []*Custom
417
 	var customs []*Custom

+ 56 - 0
service/jx_service.go View File

70
 }
70
 }
71
 
71
 
72
 
72
 
73
+func Jxyb11012(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, name string,id_card_no string) (string, string) {
74
+	timestamp := time.Now().Unix()
75
+	//生成输入报文
76
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
77
+
78
+	input := make(map[string]interface{})
79
+	inputData := make(map[string]interface{})
80
+	inputMessage["infno"] = "1101" // 交易编码
81
+
82
+	if certificates == "3" {
83
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
84
+		inputData["certno"] = certNo        // 证件号码
85
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
86
+
87
+	} else {
88
+		if id_card_type == 1 {
89
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
90
+			inputData["card_sn"] = card_sn      // 卡识别码
91
+			inputData["certno"] = certNo        // 证件号码
92
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
93
+			inputData["mdtrt_cert_no"] = id_card_no // 就诊凭证编号
94
+
95
+
96
+		} else if id_card_type == 4 {
97
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
98
+			inputData["card_sn"] = ""      // 卡识别码
99
+			inputData["certno"] = certNo        // 证件号码
100
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
101
+			inputData["mdtrt_cert_no"] = card_sn // 就诊凭证编号
102
+
103
+		}else {
104
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
105
+			inputData["card_sn"] = ""           // 卡识别码
106
+			inputData["certno"] = certNo        // 证件号码
107
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
108
+		}
109
+	}
110
+
111
+	inputData["begntime"] = ""          // 开始时间
112
+	inputData["psn_name"] = name          // 人员姓名
113
+	input["data"] = inputData
114
+	inputMessage["input"] = input //交易输入
115
+
116
+	var inputLog string
117
+	bytesData, _ := json.Marshal(inputMessage)
118
+	inputLog = string(bytesData)
119
+	fmt.Println(string(bytesData))
120
+	if err != nil {
121
+		fmt.Println(err.Error())
122
+		return err.Error(), ""
123
+	}
124
+	request_url = request_url + "1101"
125
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
126
+}
127
+
128
+
73
 func Jxyb1101bycard(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, name string,id_card_no string) (string, string) {
129
 func Jxyb1101bycard(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, name string,id_card_no string) (string, string) {
74
 	timestamp := time.Now().Unix()
130
 	timestamp := time.Now().Unix()
75
 	//生成输入报文
131
 	//生成输入报文