Ver código fonte

历史排班

28169 1 ano atrás
pai
commit
2a694f1a9d

+ 4 - 4
controllers/base_api_controller.go Ver arquivo

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10138 //机构id 10344
84
+		subscibe.OrgId = 10344 //机构id 10344
85 85
 		subscibe.PeriodStart = 1547447814
86 86
 		subscibe.PeriodEnd = 1550039814
87 87
 		subscibe.State = 1
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
94
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
95 95
 		adminUserInfo.CurrentAppId = 3244  //4
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10138 //机构id小英10344或4
329
+		subscibe.OrgId = 10344 //机构id小英10344或4
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,7 +336,7 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
339
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
340 340
 		adminUserInfo.CurrentAppId = 3244  //4
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes

+ 31 - 6
controllers/sign_api_controller.go Ver arquivo

@@ -1148,13 +1148,38 @@ func (this *SignApiController) ToCheckInformation() {
1148 1148
 
1149 1149
 func (this *SignApiController) ToAutoDrug() {
1150 1150
 
1151
-	advice, _ := service.GetAutoDrugList(9919)
1151
+	//advice, _ := service.GetAutoDrugList(9919)
1152
+	//
1153
+	//for _, item := range advice {
1154
+	//	//查找该患者是否出库过
1155
+	//	outList, _ := service.GetDrugAutoWarehouseOutList(item.PatientId, item.UserOrgId, item.DrugId, item.AdviceDate)
1156
+	//	if outList.ID == 0 {
1157
+	//		service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1158
+	//	}
1159
+	//}
1152 1160
 
1153
-	for _, item := range advice {
1154
-		//查找该患者是否出库过
1155
-		outList, _ := service.GetDrugAutoWarehouseOutList(item.PatientId, item.UserOrgId, item.DrugId, item.AdviceDate)
1156
-		if outList.ID == 0 {
1157
-			service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1161
+	prescriptionList, _ := service.GetAllPrescriptionList(10579)
1162
+
1163
+	for _, item := range prescriptionList {
1164
+		var DialysisMachineName string
1165
+		if len(item.DialysisDialyszers) > 0 {
1166
+			DialysisMachineName = item.DialysisDialyszers
1167
+		}
1168
+		if len(item.DialyzerPerfusionApparatus) > 0 {
1169
+			DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
1158 1170
 		}
1171
+
1172
+		if len(item.DialysisIrrigation) > 0 {
1173
+			DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
1174
+		}
1175
+
1176
+		if len(item.DialysisStrainer) > 0 {
1177
+			DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
1178
+		}
1179
+		DialysisMachineName = DialysisMachineName
1180
+		service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
1159 1181
 	}
1182
+	this.ServeSuccessJSON(map[string]interface{}{
1183
+		"msg": "ok",
1184
+	})
1160 1185
 }

+ 30 - 9
service/patient_service.go Ver arquivo

@@ -2,6 +2,7 @@ package service
2 2
 
3 3
 import (
4 4
 	"XT_New/models"
5
+	"XT_New/utils"
5 6
 	"encoding/json"
6 7
 	"fmt"
7 8
 	"strconv"
@@ -2931,17 +2932,30 @@ func UpdateDialysisBefor(dislysis models.XtAssessmentBeforeDislysis, id int64) e
2931 2932
 
2932 2933
 func GetAllSchedulesByPatientInfo(org_id int64, patient_id int64, mode_id int64) ([]Schedule, error) {
2933 2934
 	var record []Schedule
2934
-	loc, _ := time.LoadLocation("Local")
2935
-	date, _ := time.ParseInLocation("2006-01-02 15:04:05", time.Now().Format("2006-01-02")+" 00:00:00", loc)
2936
-
2937
-	err := readDb.Model(&Schedule{}).Where("status = 1 AND schedule_date >= ? AND patient_id = ? AND user_org_id = ? AND mode_id= ?", date, patient_id, org_id, mode_id).Find(&record).Error
2938
-	if err != nil {
2939
-		if err == gorm.ErrRecordNotFound {
2940
-			return nil, nil
2941
-		} else {
2942
-			return nil, err
2935
+	if org_id == 10597 {
2936
+		timeNowStr := time.Now().Format("2006-01-02")
2937
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2938
+		err := readDb.Model(&Schedule{}).Where("status = 1 AND schedule_date >? AND patient_id = ? AND user_org_id = ? AND mode_id= ?", timeNewDate.Unix(), patient_id, org_id, mode_id).Find(&record).Error
2939
+		if err != nil {
2940
+			if err == gorm.ErrRecordNotFound {
2941
+				return nil, nil
2942
+			} else {
2943
+				return nil, err
2944
+			}
2945
+		}
2946
+	} else {
2947
+		timeNowStr := time.Now().Format("2006-01-02")
2948
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2949
+		err := readDb.Model(&Schedule{}).Where("status = 1 AND schedule_date >= ? AND patient_id = ? AND user_org_id = ? AND mode_id= ?", timeNewDate.Unix(), patient_id, org_id, mode_id).Find(&record).Error
2950
+		if err != nil {
2951
+			if err == gorm.ErrRecordNotFound {
2952
+				return nil, nil
2953
+			} else {
2954
+				return nil, err
2955
+			}
2943 2956
 		}
2944 2957
 	}
2958
+
2945 2959
 	return record, nil
2946 2960
 }
2947 2961
 
@@ -3291,3 +3305,10 @@ func GetPatientDetailInformedConsent(patient_id int64, org_id int64) (models.XtP
3291 3305
 	err := XTReadDB().Where("id = ? and status=1 and user_org_id =?", patient_id, org_id).Find(&patients).Error
3292 3306
 	return patients, err
3293 3307
 }
3308
+
3309
+func GetAllPrescriptionList(org_id int64) (prescription []*models.DialysisPrescription, err error) {
3310
+
3311
+	err = XTReadDB().Where("user_org_id = ? and status =1", org_id).Find(&prescription).Error
3312
+
3313
+	return prescription, err
3314
+}

+ 6 - 0
service/sign_service.go Ver arquivo

@@ -2090,3 +2090,9 @@ func GetDrugAutoWarehouseOutList(patient_id int64, user_org_id int64, drug_id in
2090 2090
 
2091 2091
 	return info, err2
2092 2092
 }
2093
+
2094
+func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64, DialysisMachineName string) error {
2095
+
2096
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id =? and schedule_date =? and user_org_id =?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"dialysis_machine_name": DialysisMachineName}).Error
2097
+	return err
2098
+}