Browse Source

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

csx 3 years ago
parent
commit
ba46dac088
2 changed files with 37 additions and 8 deletions
  1. 32 8
      controllers/sg/his_api_controller.go
  2. 5 0
      service/his_service.go

+ 32 - 8
controllers/sg/his_api_controller.go View File

@@ -2679,6 +2679,8 @@ func (c *HisApiController) RefundNumber() {
2679 2679
 	patient_id, _ := c.GetInt64("patient_id")
2680 2680
 	admin_user_id, _ := c.GetInt64("admin_user_id")
2681 2681
 
2682
+	his_patient_id, _ := c.GetInt64("id")
2683
+
2682 2684
 	timeLayout := "2006-01-02"
2683 2685
 	loc, _ := time.LoadLocation("Local")
2684 2686
 	adminUser := c.GetAdminUserInfo()
@@ -2689,7 +2691,9 @@ func (c *HisApiController) RefundNumber() {
2689 2691
 		return
2690 2692
 	}
2691 2693
 	recordDateTime := theTime.Unix()
2692
-	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2694
+	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2695
+
2696
+	his, _ := service.GetHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
2693 2697
 	//patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
2694 2698
 	//order, _ := service.GetHisOrderByID(order_id)
2695 2699
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -2720,17 +2724,37 @@ func (c *HisApiController) RefundNumber() {
2720 2724
 			return
2721 2725
 		}
2722 2726
 
2723
-		//err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
2724
-		service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
2727
+		respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
2728
+		userJSONBytes3, _ := json.Marshal(respJSON3)
2725 2729
 
2726
-		if err == nil {
2727
-			c.ServeSuccessJSON(map[string]interface{}{
2728
-				"msg": "退号成功",
2729
-			})
2730
-		} else {
2730
+		var res2 ResultSix
2731
+		if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
2732
+			utils.ErrorLog("解析失败:%v", err)
2731 2733
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2732 2734
 			return
2733 2735
 		}
2736
+
2737
+		if res2.Infcode == 0 {
2738
+			//err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
2739
+			service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
2740
+
2741
+			if err == nil {
2742
+				c.ServeSuccessJSON(map[string]interface{}{
2743
+					"msg": "退号成功",
2744
+				})
2745
+			} else {
2746
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2747
+				return
2748
+			}
2749
+
2750
+		} else {
2751
+			c.ServeSuccessJSON(map[string]interface{}{
2752
+				"code": -10,
2753
+				"msg":  res2.ErrMsg,
2754
+			})
2755
+
2756
+		}
2757
+
2734 2758
 	} else {
2735 2759
 		//err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
2736 2760
 		//if err == nil {

+ 5 - 0
service/his_service.go View File

@@ -456,6 +456,11 @@ func GetVMHisPatientInfo(org_id int64, patient_id int64, record_date int64) (inf
456 456
 	return
457 457
 }
458 458
 
459
+func GetHisPatientRecord(org_id int64, id int64) (info models.VMHisPatient, err error) {
460
+	err = readDb.Model(&models.VMHisPatient{}).Where("user_org_id = ? AND status = 1 AND id = ?", org_id, id).First(&info).Error
461
+	return
462
+}
463
+
459 464
 func CreateOrder(order *models.HisOrder) (err error) {
460 465
 	err = writeDb.Create(&order).Error
461 466
 	return