Browse Source

医保对接

csx 3 years ago
parent
commit
4e042a23fe
2 changed files with 12 additions and 0 deletions
  1. 6 0
      controllers/his_api_controller.go
  2. 6 0
      service/his_service.go

+ 6 - 0
controllers/his_api_controller.go View File

3219
 	his_patient_id, _ := c.GetInt64("id")
3219
 	his_patient_id, _ := c.GetInt64("id")
3220
 	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3220
 	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3221
 	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
+
3222
 	err := service.SaveHisPatient(info)
3228
 	err := service.SaveHisPatient(info)
3223
 	if err == nil {
3229
 	if err == nil {
3224
 		c.ServeSuccessJSON(map[string]interface{}{
3230
 		c.ServeSuccessJSON(map[string]interface{}{

+ 6 - 0
service/his_service.go View File

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