28169 1 年間 前
コミット
4e3d9a7286

+ 29 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go ファイルの表示

@@ -90,7 +90,7 @@ func (this *DialysisAPIController) Scheduals() {
90 90
 	scheduals_json_str, _ := redis.Get(key).Result()
91 91
 
92 92
 	patients, _ := service.GetAllPatientListSix(orgID)
93
-	fmt.Println("scheduals_json_strwoowowow", len(scheduals_json_str))
93
+
94 94
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
95 95
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
96 96
 
@@ -101,7 +101,7 @@ func (this *DialysisAPIController) Scheduals() {
101 101
 			solution, _ := service.GetMonitDialysisSolution(item.UserOrgId, item.PatientId, item.ModeId)
102 102
 			item.DialysisSolution = solution
103 103
 		}
104
-		fmt.Println("len2223o32o23o23owo", len(scheduals))
104
+
105 105
 		if err != nil {
106 106
 			this.ErrorLog("获取排班信息失败:%v", err)
107 107
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -2827,6 +2827,7 @@ func (c *DialysisAPIController) Finish() {
2827 2827
 					}
2828 2828
 				}
2829 2829
 			}
2830
+
2830 2831
 		}
2831 2832
 
2832 2833
 		dialysisOrder.Stage = 2
@@ -2835,17 +2836,41 @@ func (c *DialysisAPIController) Finish() {
2835 2836
 		dialysisOrder.FinishModifier = adminUserInfo.AdminUser.Id
2836 2837
 		dialysisOrder.EndTime = endDate.Unix()
2837 2838
 
2839
+		fmt.Println("ADMINWOOWOWOWOWO", adminUserInfo.Org.Id)
2840
+
2838 2841
 		// 长沙南雅需求
2839
-		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 {
2842
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9675 {
2840 2843
 
2841 2844
 			//获取最后1条监测的数据
2842 2845
 			fristrecordone, _ := service.FindFirstMonitorRecordToday(dialysisOrder.PatientId, dialysisOrder.UserOrgId, dialysisOrder.DialysisDate)
2843 2846
 			lastrecord, _ := service.FindLastMonitorRecordToday(dialysisOrder.PatientId, dialysisOrder.UserOrgId, dialysisOrder.DialysisDate)
2844 2847
 			var accumulatedBloodVolume float64
2845 2848
 			accumulatedBloodVolume = (lastrecord.BloodFlowVolume - 25) * (math.Floor(float64(lastrecord.OperateTime-fristrecordone.OperateTime)/3600) * 60) / 1000
2846
-			fmt.Println("累计血容量", accumulatedBloodVolume)
2849
+
2847 2850
 			err := service.UpdateLastMonitorRecordToday(accumulatedBloodVolume, lastrecord.ID)
2848 2851
 			fmt.Println(err)
2852
+
2853
+			// 查询未执行的医嘱
2854
+			doctorAdvice, _ := service.GetDoctorAdviceListNoExecution(dialysisOrder.PatientId, dialysisOrder.DialysisDate, dialysisOrder.UserOrgId)
2855
+			fmt.Println("doctorAdviceWOWOOWOWOWOWOWOW", doctorAdvice)
2856
+			for _, item := range doctorAdvice {
2857
+				service.UpdateDoctorAdviceNoExecution(item.ID, dialysisOrder.FinishNurse, dialysisOrder.EndTime)
2858
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
2859
+				redis := service.RedisClient()
2860
+				//清空key 值
2861
+				redis.Set(key, "", time.Second)
2862
+				keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
2863
+				redis.Set(keyTwo, "", time.Second)
2864
+				keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":his_doctor_advice"
2865
+				redis.Set(keyThree, "", time.Second)
2866
+				toTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", recordDateStr)
2867
+				theTime := toTime.Format("2006-01-02")
2868
+				keyFour := "scheduals_" + theTime + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
2869
+				redis.Set(keyFour, "", time.Second)
2870
+				keyFive := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":his_advices_list_all"
2871
+				redis.Set(keyFive, "", time.Second)
2872
+				defer redis.Close()
2873
+			}
2849 2874
 		}
2850 2875
 
2851 2876
 		go func() {

+ 17 - 9
controllers/schedule_api_controller.go ファイルの表示

@@ -3777,12 +3777,14 @@ func (this *ScheduleApiController) GetAllZones() {
3777 3777
 	adminUserInfo := this.GetAdminUserInfo()
3778 3778
 	orgId := adminUserInfo.CurrentOrgId
3779 3779
 	zones, err := service.GetAllZoneOne(orgId)
3780
+	devicenumber, err := service.GetAllBedNumberList(orgId)
3780 3781
 	if err != nil {
3781 3782
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3782 3783
 		return
3783 3784
 	}
3784 3785
 	this.ServeSuccessJSON(map[string]interface{}{
3785
-		"zones": zones,
3786
+		"zones":        zones,
3787
+		"devicenumber": devicenumber,
3786 3788
 	})
3787 3789
 }
3788 3790
 
@@ -4934,8 +4936,9 @@ func (c *ScheduleApiController) ChangeScheduleTen() {
4934 4936
 		sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
4935 4937
 		fmt.Println("schwowowoowowowowowo", sch.ID)
4936 4938
 		if sch.ID == 0 {
4937
-			//删除排班
4938
-			service.UpdateScheduleByScheduleId(id)
4939
+			////删除排班
4940
+			//service.UpdateScheduleByScheduleId(id)
4941
+
4939 4942
 			xtSchedule := models.XtSchedule{
4940 4943
 				UserOrgId:           adminINfo.CurrentOrgId,
4941 4944
 				PartitionId:         number.ZoneID,
@@ -4951,7 +4954,8 @@ func (c *ScheduleApiController) ChangeScheduleTen() {
4951 4954
 				IsExport:            999999,
4952 4955
 				DialysisMachineName: "",
4953 4956
 			}
4954
-			service.CreateNewSchedule(xtSchedule)
4957
+			//service.CreateNewSchedule(xtSchedule)
4958
+			service.UpdateScheduleSixTy(id, xtSchedule)
4955 4959
 		}
4956 4960
 
4957 4961
 		//存在排班
@@ -4960,6 +4964,8 @@ func (c *ScheduleApiController) ChangeScheduleTen() {
4960 4964
 			//service.UpdateScheduleByScheduleId(id)
4961 4965
 			//查询该患者的透析模式对应的透析器灌流器
4962 4966
 			//service.GetDialysisSolutionByMode(schedule.PatientId)
4967
+
4968
+			fmt.Println("bed_id2oo2o2o22o", bed_id)
4963 4969
 			xtSchedule := models.XtSchedule{
4964 4970
 				UserOrgId:           adminINfo.CurrentOrgId,
4965 4971
 				PartitionId:         number.ZoneID,
@@ -4975,13 +4981,14 @@ func (c *ScheduleApiController) ChangeScheduleTen() {
4975 4981
 				IsExport:            8888,
4976 4982
 				DialysisMachineName: "",
4977 4983
 			}
4978
-
4984
+			// 旧的id
4979 4985
 			service.UpdateScheduleSixTy(sch.ID, xtSchedule)
4980 4986
 
4987
+			fmt.Println("床位id", sch.BedId)
4981 4988
 			msch := models.XtSchedule{
4982 4989
 				UserOrgId:    adminINfo.CurrentOrgId,
4983
-				PartitionId:  number.ZoneID,
4984
-				BedId:        bed_id,
4990
+				PartitionId:  sch.PartitionId,
4991
+				BedId:        sch.BedId,
4985 4992
 				PatientId:    sch.PatientId,
4986 4993
 				ScheduleDate: sch.ScheduleDate,
4987 4994
 				ScheduleType: sch.ScheduleType,
@@ -4996,9 +5003,10 @@ func (c *ScheduleApiController) ChangeScheduleTen() {
4996 5003
 
4997 5004
 		}
4998 5005
 	}
4999
-
5006
+	scheduletwo, _ := service.GetSchedule(adminINfo.CurrentOrgId, id)
5000 5007
 	c.ServeSuccessJSON(map[string]interface{}{
5001
-		"msg": "ok",
5008
+		"msg":      "ok",
5009
+		"schedule": scheduletwo,
5002 5010
 	})
5003 5011
 
5004 5012
 }

+ 1 - 0
models/patient_models.go ファイルの表示

@@ -50,6 +50,7 @@ type MDialysisOrderForList struct {
50 50
 	DialysisIrrigation string                `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
51 51
 	DialysisDialyszers string                `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
52 52
 	ScheduleRemark     string                `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
53
+	Url                string                `gorm:"column:url" json:"url" form:"url"`
53 54
 }
54 55
 
55 56
 func (MDialysisOrderForList) TableName() string {

+ 14 - 0
service/dialysis_service.go ファイルの表示

@@ -2348,3 +2348,17 @@ func GetMonitoringRecordList(patient_id int64, record_date int64) (record []*mod
2348 2348
 
2349 2349
 	return record, err
2350 2350
 }
2351
+
2352
+func GetDoctorAdviceListNoExecution(patient_id int64, dialysis_date int64, user_org_id int64) (doctor []*models.XtDoctorAdvice, err error) {
2353
+
2354
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id = ? and execution_state = 2 and status =1", patient_id, dialysis_date, user_org_id).Find(&doctor).Error
2355
+
2356
+	return doctor, err
2357
+}
2358
+
2359
+func UpdateDoctorAdviceNoExecution(id int64, creator int64, end_time int64) error {
2360
+
2361
+	err := XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"execution_state": 1, "execution_staff": creator, "execution_time": end_time}).Error
2362
+
2363
+	return err
2364
+}

+ 1 - 1
service/mobile_dialysis_service.go ファイルの表示

@@ -47,7 +47,7 @@ func MobileGetDialysisScheduals(orgID int64, scheduleDate int64, scheduleType in
47 47
 func GetMonitDialysisOrder(user_org_id int64, patient_id int64, scheduleDate int64) (*models.MDialysisOrderForList, error) {
48 48
 
49 49
 	order := models.MDialysisOrderForList{}
50
-	err := XTReadDB().Where("user_org_id = ? and status =1 and patient_id = ?", user_org_id, patient_id).Order("id asc").Last(&order).Error
50
+	err := XTReadDB().Where("user_org_id = ? and status =1 and patient_id = ?", user_org_id, patient_id).Order("id desc").Last(&order).Error
51 51
 	return &order, err
52 52
 }
53 53
 

+ 6 - 0
service/patientmanage_service.go ファイルの表示

@@ -1179,6 +1179,12 @@ func GetAllZoneOne(orgid int64) (zone []*models.DeviceZone, err error) {
1179 1179
 	return zone, err
1180 1180
 }
1181 1181
 
1182
+func GetAllBedNumberList(orgid int64) (number []*models.DeviceNumber, err error) {
1183
+
1184
+	err = XTReadDB().Where("org_id =? and status =1", orgid).Find(&number).Error
1185
+	return number, err
1186
+}
1187
+
1182 1188
 func GetAllGroupOne(orgid int64) (group []*models.DeviceGroup, err error) {
1183 1189
 
1184 1190
 	err = XTReadDB().Model(&group).Where("org_id =?", orgid).Find(&group).Error