csx 3 lat temu
rodzic
commit
4e042a23fe
2 zmienionych plików z 12 dodań i 0 usunięć
  1. 6 0
      controllers/his_api_controller.go
  2. 6 0
      service/his_service.go

+ 6 - 0
controllers/his_api_controller.go Wyświetl plik

@@ -3219,6 +3219,12 @@ func (c *HisApiController) RefundNumber() {
3219 3219
 	his_patient_id, _ := c.GetInt64("id")
3220 3220
 	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3221 3221
 	info.Status = 0
3222
+	count, _ := service.GetOrderCountByNumber(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.RecordDate, info.Number)
3223
+	if count > 0 {
3224
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
3225
+		return
3226
+	}
3227
+
3222 3228
 	err := service.SaveHisPatient(info)
3223 3229
 	if err == nil {
3224 3230
 		c.ServeSuccessJSON(map[string]interface{}{

+ 6 - 0
service/his_service.go Wyświetl plik

@@ -2100,3 +2100,9 @@ func GetNewAllUnChargeHisPatientListTwo(org_id int64, keywords string, record_da
2100 2100
 
2101 2101
 	return
2102 2102
 }
2103
+
2104
+func GetOrderCountByNumber(org_id int64, patient_id int64, record_time int64, number string) (count int64, err error) {
2105
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND settle_accounts_date = ? AND order_status = 3 AND mdtrt_id = ?", org_id, patient_id, record_time, number).Count(&count).Error
2106
+
2107
+	return
2108
+}