浏览代码

历史排班

28169 1年前
父节点
当前提交
05040d8dc4
共有 4 个文件被更改,包括 28 次插入32 次删除
  1. 1 1
      controllers/his_api_controller.go
  2. 10 0
      controllers/pharmacy_controller.go
  3. 5 29
      service/dialysis_service.go
  4. 12 2
      service/gobal_config_service.go

+ 1 - 1
controllers/his_api_controller.go 查看文件

3112
 	var adviceList []models.HisDoctorAdviceInfo
3112
 	var adviceList []models.HisDoctorAdviceInfo
3113
 	var projectList []models.HisPrescriptionProject
3113
 	var projectList []models.HisPrescriptionProject
3114
 
3114
 
3115
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 {
3115
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 {
3116
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3116
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3117
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3117
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3118
 
3118
 

+ 10 - 0
controllers/pharmacy_controller.go 查看文件

326
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
326
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
327
 
327
 
328
 	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
328
 	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
329
+
330
+	patients, _ := service.GetPatientByIDOne(orgid, patient_id)
331
+	order, _ := service.GetMobiledialysiOrder(orgid, patient_id, stime)
332
+	numberList, _ := service.GetAllBedNumberList(orgid)
333
+	zoneList, _ := service.GetAllZoneByList(orgid)
329
 	if err != nil {
334
 	if err != nil {
330
 		utils.ErrorLog(err.Error())
335
 		utils.ErrorLog(err.Error())
331
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
336
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
334
 	return_value := make(map[string]interface{})
339
 	return_value := make(map[string]interface{})
335
 	return_value["list"] = list
340
 	return_value["list"] = list
336
 	return_value["baseList"] = baseList
341
 	return_value["baseList"] = baseList
342
+	return_value["patients"] = patients
343
+	return_value["order"] = order
344
+	return_value["numberList"] = numberList
345
+	return_value["zoneList"] = zoneList
346
+
337
 	//if is_medicine == 1{发药时间先不展示
347
 	//if is_medicine == 1{发药时间先不展示
338
 	//	return_value["time"] = time
348
 	//	return_value["time"] = time
339
 	//}
349
 	//}

+ 5 - 29
service/dialysis_service.go 查看文件

961
 }
961
 }
962
 
962
 
963
 func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
963
 func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
964
-	ut := writeDb.Begin()
965
-	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 1 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
966
-	if err != nil {
967
-		ut.Rollback()
968
-		return
969
-	}
970
-	ut.Commit()
971
 
964
 
965
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 1 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
972
 	return err
966
 	return err
973
 }
967
 }
974
 
968
 
1125
 
1119
 
1126
 func BatchExceOldDoctorAdvice(m *models.DoctorAdvice, ids []string) (err error) {
1120
 func BatchExceOldDoctorAdvice(m *models.DoctorAdvice, ids []string) (err error) {
1127
 
1121
 
1128
-	ut := writeDb.Begin()
1129
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?) AND execution_state = 2", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
1130
-	if err != nil {
1131
-		ut.Rollback()
1132
-		return
1133
-	}
1134
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?) AND execution_state = 2 ", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
1135
-	if err != nil {
1136
-		ut.Rollback()
1137
-		return
1138
-	}
1139
-	ut.Commit()
1122
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?) AND execution_state = 2", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
1123
+
1124
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?) AND execution_state = 2 ", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
1125
+
1140
 	return err
1126
 	return err
1141
 }
1127
 }
1142
 
1128
 
1143
 func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int64, date int64) (err error) {
1129
 func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int64, date int64) (err error) {
1144
 
1130
 
1145
-	ut := writeDb.Begin()
1146
 	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
1131
 	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
1147
-	if err != nil {
1148
-		ut.Rollback()
1149
-		return
1150
-	}
1151
 
1132
 
1152
 	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
1133
 	err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
1153
-	if err != nil {
1154
-		ut.Rollback()
1155
-		return
1156
-	}
1157
-	ut.Commit()
1158
 	return err
1134
 	return err
1159
 }
1135
 }
1160
 
1136
 

+ 12 - 2
service/gobal_config_service.go 查看文件

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"fmt"
4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7
 	"time"
5
 	"time"
6
+
7
+	"XT_New/models"
8
+	"github.com/jinzhu/gorm"
8
 )
9
 )
9
 
10
 
10
 func CreateAutomaticReduceRecord(config *models.GobalConfig) (err error) {
11
 func CreateAutomaticReduceRecord(config *models.GobalConfig) (err error) {
1358
 
1359
 
1359
 	return gatherSetting, err
1360
 	return gatherSetting, err
1360
 }
1361
 }
1362
+
1363
+func GetMobiledialysiOrder(user_org_id int64, patient_id int64, record_date int64) (models.Schedule, error) {
1364
+
1365
+	dialysisOrder := models.Schedule{}
1366
+
1367
+	err := XTReadDB().Where("user_org_id =? and patient_id =? and schedule_date =? and status=1", user_org_id, patient_id, record_date).Find(&dialysisOrder).Error
1368
+
1369
+	return dialysisOrder, err
1370
+}