Browse Source

历史排班

28169 9 months ago
parent
commit
05040d8dc4

+ 1 - 1
controllers/his_api_controller.go View File

@@ -3112,7 +3112,7 @@ func (c *HisApiController) CreateHisPrescription() {
3112 3112
 	var adviceList []models.HisDoctorAdviceInfo
3113 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 3116
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3117 3117
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3118 3118
 

+ 10 - 0
controllers/pharmacy_controller.go View File

@@ -326,6 +326,11 @@ func (this *PharmacyController) GetPharmacyContent() {
326 326
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
327 327
 
328 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 334
 	if err != nil {
330 335
 		utils.ErrorLog(err.Error())
331 336
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -334,6 +339,11 @@ func (this *PharmacyController) GetPharmacyContent() {
334 339
 	return_value := make(map[string]interface{})
335 340
 	return_value["list"] = list
336 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 347
 	//if is_medicine == 1{发药时间先不展示
338 348
 	//	return_value["time"] = time
339 349
 	//}

+ 5 - 29
service/dialysis_service.go View File

@@ -961,14 +961,8 @@ func FindFirstMonitorRecordToday(patient_id int64, org_id int64, monitoring_date
961 961
 }
962 962
 
963 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 966
 	return err
973 967
 }
974 968
 
@@ -1125,36 +1119,18 @@ func FindAdminRoleTypeById(orgId int64, adminUserId int64, appId int64) (models.
1125 1119
 
1126 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 1126
 	return err
1141 1127
 }
1142 1128
 
1143 1129
 func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int64, date int64) (err error) {
1144 1130
 
1145
-	ut := writeDb.Begin()
1146 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 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 1134
 	return err
1159 1135
 }
1160 1136
 

+ 12 - 2
service/gobal_config_service.go View File

@@ -1,10 +1,11 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7 5
 	"time"
6
+
7
+	"XT_New/models"
8
+	"github.com/jinzhu/gorm"
8 9
 )
9 10
 
10 11
 func CreateAutomaticReduceRecord(config *models.GobalConfig) (err error) {
@@ -1358,3 +1359,12 @@ func GetGatherSetting(user_org_id int64) (models.XtDialysisGatherSetting, error)
1358 1359
 
1359 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
+}