浏览代码

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

张保健 3 年前
父节点
当前提交
c671362ce7

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

@@ -54,7 +54,7 @@ front_end_domain = "https://xt.kuyicloud.com/#"
54 54
 url = "http://192.168.1.88:6666/szsi-portal/transData"
55 55
 gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56 56
 gdyb_paasid = "sg03_prd"
57
-#    gdyb_paasid = "jm_sc_yjyy"
57
+#gdyb_paasid = "jm_sc_yjyy"
58 58
 
59 59
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
60 60
 readmysqlport = 3306

+ 2 - 4
controllers/sg/gdyb_controller.go 查看文件

@@ -71,19 +71,17 @@ func (c *GdybController) PostOne() {
71 71
 	org_name := c.GetString("org_name")
72 72
 	doctor := c.GetString("doctor")
73 73
 	fixmedins_code := c.GetString("fixmedins_code")
74
-
75 74
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
76 75
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
77
-
78 76
 	secret_key := c.GetString("secret_key")
79 77
 	id_card_type, _ := c.GetInt64("id_card_type")
80 78
 	card_sn := c.GetString("card_sn")
81
-
82 79
 	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn)
83
-
84 80
 	var dat map[string]interface{}
85 81
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
82
+
86 83
 	} else {
84
+
87 85
 	}
88 86
 
89 87
 	c.ServeSuccessJSON(map[string]interface{}{

+ 149 - 9
controllers/sg/his_api_controller.go 查看文件

@@ -70,6 +70,7 @@ func HisManagerApiRegistRouters() {
70 70
 	beego.Router("/api/test", &HisApiController{}, "get:TestGetBasBaseInfo")
71 71
 
72 72
 	beego.Router("/api/reversal", &HisApiController{}, "get:ReversalData")
73
+	beego.Router("/api/reversal/other", &HisApiController{}, "get:ReversalOtherData")
73 74
 
74 75
 }
75 76
 
@@ -1186,6 +1187,12 @@ func (c *HisApiController) GetRegisterInfo() {
1186 1187
 			his.Mtime = time.Now().Unix()
1187 1188
 			his.Status = 1
1188 1189
 			err := service.CreateHisPatientTwo(&his)
1190
+
1191
+			lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1192
+			if len(lists) == 1 {
1193
+				service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
1194
+			}
1195
+
1189 1196
 			if err == nil {
1190 1197
 				api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
1191 1198
 					"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
@@ -1316,6 +1323,8 @@ func (c *HisApiController) GetRegisterInfo() {
1316 1323
 func (c *HisApiController) GetUploadInfo() {
1317 1324
 	id, _ := c.GetInt64("id")
1318 1325
 	record_time := c.GetString("record_time")
1326
+	his_patient_id, _ := c.GetInt64("his_patient_id")
1327
+
1319 1328
 	pay_way, _ := c.GetInt64("pay_way")
1320 1329
 	pay_price, _ := c.GetFloat("pay_price")
1321 1330
 	pay_card_no := c.GetString("pay_card_no")
@@ -1374,7 +1383,7 @@ func (c *HisApiController) GetUploadInfo() {
1374 1383
 
1375 1384
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1376 1385
 
1377
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
1386
+	his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
1378 1387
 	timestamp := time.Now().Unix()
1379 1388
 	tempTime := time.Unix(timestamp, 0)
1380 1389
 	timeFormat := tempTime.Format("20060102150405")
@@ -2820,6 +2829,8 @@ func (c *HisApiController) RefundNumber() {
2820 2829
 }
2821 2830
 func (c *HisApiController) RefundDetail() {
2822 2831
 	order_id, _ := c.GetInt64("order_id")
2832
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2833
+
2823 2834
 	number := c.GetString("number")
2824 2835
 	record_time := c.GetString("record_time")
2825 2836
 	patient_id, _ := c.GetInt64("patient_id")
@@ -2833,7 +2844,7 @@ func (c *HisApiController) RefundDetail() {
2833 2844
 		return
2834 2845
 	}
2835 2846
 	recordDateTime := theTime.Unix()
2836
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2847
+	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2837 2848
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2838 2849
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2839 2850
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
@@ -4399,13 +4410,6 @@ func (c *HisApiController) ReversalData() {
4399 4410
 
4400 4411
 	customData = append(customData, custom7)
4401 4412
 
4402
-	custom77 := &CustomData{
4403
-		MsgId: "H44022900158202103301736551640",
4404
-		PsnNo: "44020000001102687718",
4405
-		Info:  "2207",
4406
-	}
4407
-	customData = append(customData, custom77)
4408
-
4409 4413
 	custom8 := &CustomData{
4410 4414
 		MsgId: "H44022900158202103301743097676",
4411 4415
 		PsnNo: "44020000001102127785",
@@ -4488,6 +4492,142 @@ func (c *HisApiController) ReversalData() {
4488 4492
 		fmt.Println(result)
4489 4493
 	}
4490 4494
 }
4495
+func (c *HisApiController) ReversalOtherData() {
4496
+	var customData []*CustomData
4497
+
4498
+	custom := &CustomData{
4499
+		MsgId: "H44022900158202103301714472004",
4500
+		PsnNo: "44020000001101329945",
4501
+		Info:  "2208",
4502
+	}
4503
+	customData = append(customData, custom)
4504
+
4505
+	custom1 := &CustomData{
4506
+		MsgId: "H4402290015820210330172057803",
4507
+		PsnNo: "44020000001101161813",
4508
+		Info:  "2208",
4509
+	}
4510
+	customData = append(customData, custom1)
4511
+	custom2 := &CustomData{
4512
+		MsgId: "H44022900158202103301705198813",
4513
+		PsnNo: "44190000133097375417",
4514
+		Info:  "2208",
4515
+	}
4516
+	customData = append(customData, custom2)
4517
+	custom3 := &CustomData{
4518
+		MsgId: "H44022900158202103301715524756",
4519
+		PsnNo: "44020000001100187221",
4520
+		Info:  "2208",
4521
+	}
4522
+	customData = append(customData, custom3)
4523
+	custom4 := &CustomData{
4524
+		MsgId: "H44022900158202103301730376224",
4525
+		PsnNo: "44020000001101959155",
4526
+		Info:  "2208",
4527
+	}
4528
+	customData = append(customData, custom4)
4529
+	custom5 := &CustomData{
4530
+		MsgId: "H44022900158202103301748008725",
4531
+		PsnNo: "44020000001104246641",
4532
+		Info:  "2208",
4533
+	}
4534
+	customData = append(customData, custom5)
4535
+	custom6 := &CustomData{
4536
+		MsgId: "H44022900158202103301718096755",
4537
+		PsnNo: "44020000001102211860",
4538
+		Info:  "2208",
4539
+	}
4540
+	customData = append(customData, custom6)
4541
+	custom7 := &CustomData{
4542
+		MsgId: "H44022900158202103301736551640",
4543
+		PsnNo: "44020000001102687718",
4544
+		Info:  "2208",
4545
+	}
4546
+
4547
+	customData = append(customData, custom7)
4548
+
4549
+	custom8 := &CustomData{
4550
+		MsgId: "H44022900158202103301743097676",
4551
+		PsnNo: "44020000001102127785",
4552
+		Info:  "2208",
4553
+	}
4554
+	customData = append(customData, custom8)
4555
+	custom9 := &CustomData{
4556
+		MsgId: "H44022900158202103301712304203",
4557
+		PsnNo: "44020000001101518097",
4558
+		Info:  "2208",
4559
+	}
4560
+	customData = append(customData, custom9)
4561
+	custom10 := &CustomData{
4562
+		MsgId: "H44022900158202103301738448785",
4563
+		PsnNo: "44020000001100500813",
4564
+		Info:  "2208",
4565
+	}
4566
+	customData = append(customData, custom10)
4567
+
4568
+	custom11 := &CustomData{
4569
+		MsgId: "H44022900158202103301732455843",
4570
+		PsnNo: "44020000001102690557",
4571
+		Info:  "2208",
4572
+	}
4573
+
4574
+	customData = append(customData, custom11)
4575
+
4576
+	custom12 := &CustomData{
4577
+		MsgId: "H44022900158202103301745421708",
4578
+		PsnNo: "44020000001102211928",
4579
+		Info:  "2208",
4580
+	}
4581
+	customData = append(customData, custom12)
4582
+
4583
+	custom1212 := &CustomData{
4584
+		MsgId: "H440229001582021033017351627",
4585
+		PsnNo: "44020000001102481733",
4586
+		Info:  "2208",
4587
+	}
4588
+	customData = append(customData, custom1212)
4589
+
4590
+	custom13 := &CustomData{
4591
+		MsgId: "H44022900158202103301740327951",
4592
+		PsnNo: "44020000001103174866",
4593
+		Info:  "2208",
4594
+	}
4595
+	customData = append(customData, custom13)
4596
+	custom14 := &CustomData{
4597
+		MsgId: "H4402290015820210330174922668",
4598
+		PsnNo: "44020000001102927272",
4599
+		Info:  "2208",
4600
+	}
4601
+	customData = append(customData, custom14)
4602
+	custom15 := &CustomData{
4603
+		MsgId: "H44022900158202103301752362273",
4604
+		PsnNo: "44020000001102942890",
4605
+		Info:  "2208",
4606
+	}
4607
+	customData = append(customData, custom15)
4608
+
4609
+	custom16 := &CustomData{
4610
+		MsgId: "H44022900158202103301751082917",
4611
+		PsnNo: "44020000001101662162",
4612
+		Info:  "2208",
4613
+	}
4614
+	customData = append(customData, custom16)
4615
+
4616
+	custom17 := &CustomData{
4617
+		MsgId: "H44022900158202103301754147728",
4618
+		PsnNo: "44020000000229014511",
4619
+		Info:  "2208",
4620
+	}
4621
+	customData = append(customData, custom17)
4622
+
4623
+	adminUser := c.GetAdminUserInfo()
4624
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
4625
+
4626
+	for _, item := range customData {
4627
+		result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
4628
+		fmt.Println(result)
4629
+	}
4630
+}
4491 4631
 
4492 4632
 func PathExists(path string) (bool, error) {
4493 4633
 	_, err := os.Stat(path)

+ 22 - 1
controllers/sz/sz_his_api_controller.go 查看文件

@@ -1004,6 +1004,10 @@ func (c *SZHisApiController) GetRegisterInfo() {
1004 1004
 							PatientInfo:            result001,
1005 1005
 						}
1006 1006
 						service.CreateHisPatientTwo(&his)
1007
+						lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, theTime.Unix())
1008
+						if len(lists) == 1 {
1009
+							service.UpdateHisPrescriptionHisID(his.ID, patient.ID, theTime.Unix(), adminInfo.CurrentOrgId)
1010
+						}
1007 1011
 						c.ServeSuccessJSON(map[string]interface{}{
1008 1012
 							"msg": "挂号成功",
1009 1013
 						})
@@ -1072,6 +1076,10 @@ func (c *SZHisApiController) GetRegisterInfo() {
1072 1076
 							PatientInfo:            result001,
1073 1077
 						}
1074 1078
 						service.CreateHisPatientTwo(&his)
1079
+						lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, theTime.Unix())
1080
+						if len(lists) == 1 {
1081
+							service.UpdateHisPrescriptionHisID(his.ID, patient.ID, theTime.Unix(), adminInfo.CurrentOrgId)
1082
+						}
1075 1083
 						c.ServeSuccessJSON(map[string]interface{}{
1076 1084
 							"msg": "挂号成功",
1077 1085
 						})
@@ -1139,6 +1147,10 @@ func (c *SZHisApiController) GetRegisterInfo() {
1139 1147
 							PatientInfo:            result001,
1140 1148
 						}
1141 1149
 						service.CreateHisPatientTwo(&his)
1150
+						lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, theTime.Unix())
1151
+						if len(lists) == 1 {
1152
+							service.UpdateHisPrescriptionHisID(his.ID, patient.ID, theTime.Unix(), adminInfo.CurrentOrgId)
1153
+						}
1142 1154
 						c.ServeSuccessJSON(map[string]interface{}{
1143 1155
 							"msg": "挂号成功",
1144 1156
 						})
@@ -1202,6 +1214,10 @@ func (c *SZHisApiController) GetRegisterInfo() {
1202 1214
 							PatientInfo:            result001,
1203 1215
 						}
1204 1216
 						service.CreateHisPatientTwo(&his)
1217
+						lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, theTime.Unix())
1218
+						if len(lists) == 1 {
1219
+							service.UpdateHisPrescriptionHisID(his.ID, patient.ID, theTime.Unix(), adminInfo.CurrentOrgId)
1220
+						}
1205 1221
 						c.ServeSuccessJSON(map[string]interface{}{
1206 1222
 							"msg": "挂号成功",
1207 1223
 						})
@@ -2108,6 +2124,7 @@ func (c *SZHisApiController) RefundNumber() {
2108 2124
 
2109 2125
 //上传明细----结算----确认订单
2110 2126
 func (c *SZHisApiController) GetSettleInfo() {
2127
+
2111 2128
 	pay_way, _ := c.GetInt64("pay_way")
2112 2129
 	pay_price, _ := c.GetFloat("pay_price")
2113 2130
 	pay_card_no := c.GetString("pay_card_no")
@@ -2121,6 +2138,9 @@ func (c *SZHisApiController) GetSettleInfo() {
2121 2138
 	patient_id, _ := c.GetInt64("id")
2122 2139
 	record_time := c.GetString("record_time")
2123 2140
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2141
+
2142
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2143
+
2124 2144
 	timestamp := time.Now().Unix()
2125 2145
 	tempTime := time.Unix(timestamp, 0)
2126 2146
 	timeFormat := tempTime.Format("20060102150405")
@@ -2192,7 +2212,7 @@ func (c *SZHisApiController) GetSettleInfo() {
2192 2212
 	adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
2193 2213
 
2194 2214
 	adminRole, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
2195
-	his, err := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2215
+	his, err := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2196 2216
 	mz_number := his.Number
2197 2217
 	number := miConfig.Code + year + month + day +
2198 2218
 		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
@@ -2388,6 +2408,7 @@ func (c *SZHisApiController) GetSettleInfo() {
2388 2408
 			Creator:             admin_user_id,
2389 2409
 			Modify:              admin_user_id,
2390 2410
 			OrgSetlNumber:       number,
2411
+			MdtrtId:             mz_number,
2391 2412
 		}
2392 2413
 		data, _ := json.Marshal(ress)
2393 2414
 		order.DetailLog = string(data)

+ 20 - 0
service/his_service.go 查看文件

@@ -190,6 +190,11 @@ func GetHisPatientInfo(org_id int64, patient_id int64, record_date int64) (info
190 190
 	return
191 191
 }
192 192
 
193
+func GetNewHisPatientInfo(org_id int64, id int64, record_date int64) (info models.HisPatient, err error) {
194
+	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND id = ?", org_id, record_date, id).First(&info).Error
195
+	return
196
+}
197
+
193 198
 func GetXTPatientInfo(org_id int64, patient_id int64) (info models.Patients, err error) {
194 199
 	err = readDb.Model(&models.Patients{}).Where("user_org_id = ? AND status = 1  AND id = ?", org_id, patient_id).First(&info).Error
195 200
 	return
@@ -456,6 +461,11 @@ func GetVMHisPatientInfo(org_id int64, patient_id int64, record_date int64) (inf
456 461
 	return
457 462
 }
458 463
 
464
+func GetNewVMHisPatientInfo(org_id int64, patient_id int64, record_date int64) (info models.VMHisPatient, err error) {
465
+	err = readDb.Model(&models.VMHisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND id = ?", org_id, record_date, patient_id).First(&info).Error
466
+	return
467
+}
468
+
459 469
 func GetHisPatientRecord(org_id int64, id int64) (info models.VMHisPatient, err error) {
460 470
 	err = readDb.Model(&models.VMHisPatient{}).Where("user_org_id = ? AND status = 1 AND id = ?", org_id, id).First(&info).Error
461 471
 	return
@@ -1114,3 +1124,13 @@ func GetAllPatient(org_id int64) (patients []*models.Patients, err error) {
1114 1124
 	err = readDb.Model(&models.Patients{}).Where("user_org_id = ? AND status = 1 AND lapseto = 1", org_id).Find(&patients).Error
1115 1125
 	return
1116 1126
 }
1127
+
1128
+func UpdateHisPrescriptionHisID(his_patient_id int64, patient_id int64, record_time int64, org_id int64) {
1129
+	XTWriteDB().Model(&models.HisPrescription{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ?", record_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1130
+	return
1131
+}
1132
+
1133
+func GetHisPatientInfoList(org_id int64, patient_id int64, record_date int64) (info []*models.HisPatient, err error) {
1134
+	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ?", org_id, record_date, patient_id).Find(&info).Error
1135
+	return
1136
+}