csx 4 years ago
parent
commit
d50e1fb227
2 changed files with 21 additions and 2 deletions
  1. 16 2
      controllers/his_api_controller.go
  2. 5 0
      service/his_service.go

+ 16 - 2
controllers/his_api_controller.go View File

@@ -1343,7 +1343,14 @@ func (c *HisApiController) Refund() {
1343 1343
 	recordDateTime := theTime.Unix()
1344 1344
 	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1345 1345
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1346
-	order, _ := service.GetHisOrderByID(order_id)
1346
+	var order models.HisOrder
1347
+	order, _ = service.GetHisOrderByID(order_id)
1348
+
1349
+	if order.ID == 0 {
1350
+		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
1351
+
1352
+	}
1353
+
1347 1354
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1348 1355
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1349 1356
 
@@ -1524,10 +1531,17 @@ func (c *HisApiController) RefundDetail() {
1524 1531
 	recordDateTime := theTime.Unix()
1525 1532
 	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1526 1533
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1527
-	order, _ := service.GetHisOrderByID(order_id)
1528 1534
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1529 1535
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1530 1536
 
1537
+	var order models.HisOrder
1538
+	order, _ = service.GetHisOrderByID(order_id)
1539
+
1540
+	if order.ID == 0 {
1541
+		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
1542
+
1543
+	}
1544
+
1531 1545
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1532 1546
 		api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
1533 1547
 			"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +

+ 5 - 0
service/his_service.go View File

@@ -935,3 +935,8 @@ func GetPatientByIDCard(id_card_no string, user_org_id int64) (patient Patients,
935 935
 	err = readDb.Model(&Patients{}).Where("id_card_no = ? AND user_org_id = ?", id_card_no, user_org_id).First(&patient).Error
936 936
 	return
937 937
 }
938
+
939
+func GetHisOrderThree(record_time int64, patient_id int64, user_org_id int64) (order models.HisOrder, err error) {
940
+	err = readDb.Model(&models.HisOrder{}).Where("patient_id = ? AND user_org_id = ? AND settle_accounts_date = ? AND status = 1", patient_id, user_org_id, record_time).First(&order).Error
941
+	return
942
+}