Browse Source

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

csx 3 years ago
parent
commit
ab3ef21f0b

+ 1 - 1
conf/app.conf View File

@@ -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 View File

@@ -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 View File

@@ -70,6 +70,7 @@ func HisManagerApiRegistRouters() {
70 70
 	beego.Router("/api/test", &HisApiController{}, "get:TestTest")
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
 
@@ -1124,6 +1125,12 @@ func (c *HisApiController) GetRegisterInfo() {
1124 1125
 			his.Mtime = time.Now().Unix()
1125 1126
 			his.Status = 1
1126 1127
 			err := service.CreateHisPatientTwo(&his)
1128
+
1129
+			lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1130
+			if len(lists) == 1 {
1131
+				service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
1132
+			}
1133
+
1127 1134
 			if err == nil {
1128 1135
 				api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
1129 1136
 					"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
@@ -1254,6 +1261,8 @@ func (c *HisApiController) GetRegisterInfo() {
1254 1261
 func (c *HisApiController) GetUploadInfo() {
1255 1262
 	id, _ := c.GetInt64("id")
1256 1263
 	record_time := c.GetString("record_time")
1264
+	his_patient_id, _ := c.GetInt64("his_patient_id")
1265
+
1257 1266
 	pay_way, _ := c.GetInt64("pay_way")
1258 1267
 	pay_price, _ := c.GetFloat("pay_price")
1259 1268
 	pay_card_no := c.GetString("pay_card_no")
@@ -1312,7 +1321,7 @@ func (c *HisApiController) GetUploadInfo() {
1312 1321
 
1313 1322
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1314 1323
 
1315
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
1324
+	his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
1316 1325
 	timestamp := time.Now().Unix()
1317 1326
 	tempTime := time.Unix(timestamp, 0)
1318 1327
 	timeFormat := tempTime.Format("20060102150405")
@@ -2758,6 +2767,8 @@ func (c *HisApiController) RefundNumber() {
2758 2767
 }
2759 2768
 func (c *HisApiController) RefundDetail() {
2760 2769
 	order_id, _ := c.GetInt64("order_id")
2770
+	his_patient_id, _ := c.GetInt64("his_patient_id")
2771
+
2761 2772
 	number := c.GetString("number")
2762 2773
 	record_time := c.GetString("record_time")
2763 2774
 	patient_id, _ := c.GetInt64("patient_id")
@@ -2771,7 +2782,7 @@ func (c *HisApiController) RefundDetail() {
2771 2782
 		return
2772 2783
 	}
2773 2784
 	recordDateTime := theTime.Unix()
2774
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2785
+	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
2775 2786
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2776 2787
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2777 2788
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
@@ -4337,13 +4348,6 @@ func (c *HisApiController) ReversalData() {
4337 4348
 
4338 4349
 	customData = append(customData, custom7)
4339 4350
 
4340
-	custom77 := &CustomData{
4341
-		MsgId: "H44022900158202103301736551640",
4342
-		PsnNo: "44020000001102687718",
4343
-		Info:  "2207",
4344
-	}
4345
-	customData = append(customData, custom77)
4346
-
4347 4351
 	custom8 := &CustomData{
4348 4352
 		MsgId: "H44022900158202103301743097676",
4349 4353
 		PsnNo: "44020000001102127785",
@@ -4426,6 +4430,142 @@ func (c *HisApiController) ReversalData() {
4426 4430
 		fmt.Println(result)
4427 4431
 	}
4428 4432
 }
4433
+func (c *HisApiController) ReversalOtherData() {
4434
+	var customData []*CustomData
4435
+
4436
+	custom := &CustomData{
4437
+		MsgId: "H44022900158202103301714472004",
4438
+		PsnNo: "44020000001101329945",
4439
+		Info:  "2208",
4440
+	}
4441
+	customData = append(customData, custom)
4442
+
4443
+	custom1 := &CustomData{
4444
+		MsgId: "H4402290015820210330172057803",
4445
+		PsnNo: "44020000001101161813",
4446
+		Info:  "2208",
4447
+	}
4448
+	customData = append(customData, custom1)
4449
+	custom2 := &CustomData{
4450
+		MsgId: "H44022900158202103301705198813",
4451
+		PsnNo: "44190000133097375417",
4452
+		Info:  "2208",
4453
+	}
4454
+	customData = append(customData, custom2)
4455
+	custom3 := &CustomData{
4456
+		MsgId: "H44022900158202103301715524756",
4457
+		PsnNo: "44020000001100187221",
4458
+		Info:  "2208",
4459
+	}
4460
+	customData = append(customData, custom3)
4461
+	custom4 := &CustomData{
4462
+		MsgId: "H44022900158202103301730376224",
4463
+		PsnNo: "44020000001101959155",
4464
+		Info:  "2208",
4465
+	}
4466
+	customData = append(customData, custom4)
4467
+	custom5 := &CustomData{
4468
+		MsgId: "H44022900158202103301748008725",
4469
+		PsnNo: "44020000001104246641",
4470
+		Info:  "2208",
4471
+	}
4472
+	customData = append(customData, custom5)
4473
+	custom6 := &CustomData{
4474
+		MsgId: "H44022900158202103301718096755",
4475
+		PsnNo: "44020000001102211860",
4476
+		Info:  "2208",
4477
+	}
4478
+	customData = append(customData, custom6)
4479
+	custom7 := &CustomData{
4480
+		MsgId: "H44022900158202103301736551640",
4481
+		PsnNo: "44020000001102687718",
4482
+		Info:  "2208",
4483
+	}
4484
+
4485
+	customData = append(customData, custom7)
4486
+
4487
+	custom8 := &CustomData{
4488
+		MsgId: "H44022900158202103301743097676",
4489
+		PsnNo: "44020000001102127785",
4490
+		Info:  "2208",
4491
+	}
4492
+	customData = append(customData, custom8)
4493
+	custom9 := &CustomData{
4494
+		MsgId: "H44022900158202103301712304203",
4495
+		PsnNo: "44020000001101518097",
4496
+		Info:  "2208",
4497
+	}
4498
+	customData = append(customData, custom9)
4499
+	custom10 := &CustomData{
4500
+		MsgId: "H44022900158202103301738448785",
4501
+		PsnNo: "44020000001100500813",
4502
+		Info:  "2208",
4503
+	}
4504
+	customData = append(customData, custom10)
4505
+
4506
+	custom11 := &CustomData{
4507
+		MsgId: "H44022900158202103301732455843",
4508
+		PsnNo: "44020000001102690557",
4509
+		Info:  "2208",
4510
+	}
4511
+
4512
+	customData = append(customData, custom11)
4513
+
4514
+	custom12 := &CustomData{
4515
+		MsgId: "H44022900158202103301745421708",
4516
+		PsnNo: "44020000001102211928",
4517
+		Info:  "2208",
4518
+	}
4519
+	customData = append(customData, custom12)
4520
+
4521
+	custom1212 := &CustomData{
4522
+		MsgId: "H440229001582021033017351627",
4523
+		PsnNo: "44020000001102481733",
4524
+		Info:  "2208",
4525
+	}
4526
+	customData = append(customData, custom1212)
4527
+
4528
+	custom13 := &CustomData{
4529
+		MsgId: "H44022900158202103301740327951",
4530
+		PsnNo: "44020000001103174866",
4531
+		Info:  "2208",
4532
+	}
4533
+	customData = append(customData, custom13)
4534
+	custom14 := &CustomData{
4535
+		MsgId: "H4402290015820210330174922668",
4536
+		PsnNo: "44020000001102927272",
4537
+		Info:  "2208",
4538
+	}
4539
+	customData = append(customData, custom14)
4540
+	custom15 := &CustomData{
4541
+		MsgId: "H44022900158202103301752362273",
4542
+		PsnNo: "44020000001102942890",
4543
+		Info:  "2208",
4544
+	}
4545
+	customData = append(customData, custom15)
4546
+
4547
+	custom16 := &CustomData{
4548
+		MsgId: "H44022900158202103301751082917",
4549
+		PsnNo: "44020000001101662162",
4550
+		Info:  "2208",
4551
+	}
4552
+	customData = append(customData, custom16)
4553
+
4554
+	custom17 := &CustomData{
4555
+		MsgId: "H44022900158202103301754147728",
4556
+		PsnNo: "44020000000229014511",
4557
+		Info:  "2208",
4558
+	}
4559
+	customData = append(customData, custom17)
4560
+
4561
+	adminUser := c.GetAdminUserInfo()
4562
+	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
4563
+
4564
+	for _, item := range customData {
4565
+		result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
4566
+		fmt.Println(result)
4567
+	}
4568
+}
4429 4569
 
4430 4570
 func PathExists(path string) (bool, error) {
4431 4571
 	_, err := os.Stat(path)

+ 22 - 1
controllers/sz/sz_his_api_controller.go View File

@@ -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 View File

@@ -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
+}