Selaa lähdekoodia

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

XMLWAN 3 vuotta sitten
vanhempi
commit
477c4fe91a

+ 9 - 4
controllers/his_api_controller.go Näytä tiedosto

543
 
543
 
544
 								if prescribingNumberUnit == drug.MinUnit {
544
 								if prescribingNumberUnit == drug.MinUnit {
545
 									if prescribing_number > drug.Total {
545
 									if prescribing_number > drug.Total {
546
-										//c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
546
+										c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
547
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
547
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
548
 										return
548
 										return
549
 									}
549
 									}
551
 									if prescribingNumberUnit == drug.MaxUnit {
551
 									if prescribingNumberUnit == drug.MaxUnit {
552
 										num := prescribing_number * float64(drug.MinNumber)
552
 										num := prescribing_number * float64(drug.MinNumber)
553
 										if num > drug.Total {
553
 										if num > drug.Total {
554
-											//c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
554
+											c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
555
 											//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
555
 											//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
556
 											return
556
 											return
557
 										}
557
 										}
596
 										return
596
 										return
597
 									}
597
 									}
598
 									if totals > good.Total {
598
 									if totals > good.Total {
599
-										//c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
600
-
599
+										c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
601
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
600
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
602
 										return
601
 										return
603
 									}
602
 									}
3220
 	his_patient_id, _ := c.GetInt64("id")
3219
 	his_patient_id, _ := c.GetInt64("id")
3221
 	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3220
 	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3222
 	info.Status = 0
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
+
3223
 	err := service.SaveHisPatient(info)
3228
 	err := service.SaveHisPatient(info)
3224
 	if err == nil {
3229
 	if err == nil {
3225
 		c.ServeSuccessJSON(map[string]interface{}{
3230
 		c.ServeSuccessJSON(map[string]interface{}{

+ 5 - 5
controllers/new_mobile_api_controllers/mobile_his_api_controller.go Näytä tiedosto

324
 
324
 
325
 								if prescribingNumberUnit == drug.MinUnit {
325
 								if prescribingNumberUnit == drug.MinUnit {
326
 									if prescribing_number > drug.Total {
326
 									if prescribing_number > drug.Total {
327
-										//c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
327
+										c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
328
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
328
 										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
329
 										return
329
 										return
330
 									}
330
 									}
332
 									if prescribingNumberUnit == drug.MaxUnit {
332
 									if prescribingNumberUnit == drug.MaxUnit {
333
 										num := prescribing_number * float64(drug.MinNumber)
333
 										num := prescribing_number * float64(drug.MinNumber)
334
 										if num > drug.Total {
334
 										if num > drug.Total {
335
-											//c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
335
+											c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
336
 
336
 
337
 											//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
337
 											//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
338
 											return
338
 											return
377
 										return
377
 										return
378
 									}
378
 									}
379
 									if totals > good.Total {
379
 									if totals > good.Total {
380
-										//c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
381
-
382
-										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
380
+										c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
381
+										//
382
+										//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
383
 										return
383
 										return
384
 									}
384
 									}
385
 
385
 

+ 6 - 0
service/his_service.go Näytä tiedosto

2100
 
2100
 
2101
 	return
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
+}