28169 7 mēnešus atpakaļ
vecāks
revīzija
1d6f6d685b

Binārs
XT_New.exe Parādīt failu


+ 4 - 4
controllers/base_api_controller.go Parādīt failu

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10633 //机构id
86
+		subscibe.OrgId = 10602 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10602 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 7421  //4
97
 		adminUserInfo.CurrentAppId = 7421  //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10633 //机构id小英9675或4
332
+		subscibe.OrgId = 10602 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10602 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 7421  //4
343
 		adminUserInfo.CurrentAppId = 7421  //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 3 - 1
controllers/dialysis_api_controller.go Parādīt failu

5614
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5614
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5615
 
5615
 
5616
 		//康桥
5616
 		//康桥
5617
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
5617
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
5618
 			timeNowStr := time.Now().Format("2006-01-02")
5618
 			timeNowStr := time.Now().Format("2006-01-02")
5619
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5619
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5620
 
5620
 
6177
 	gansuna_set, _ := this.GetInt64("gansuna_set")
6177
 	gansuna_set, _ := this.GetInt64("gansuna_set")
6178
 	zhetangtie_set, _ := this.GetInt64("zhetangtie_set")
6178
 	zhetangtie_set, _ := this.GetInt64("zhetangtie_set")
6179
 	niaojimei_set, _ := this.GetInt64("niaojimei_set")
6179
 	niaojimei_set, _ := this.GetInt64("niaojimei_set")
6180
+	dialysis_strainer_set, _ := this.GetInt64("dialysis_strainer_set")
6180
 	dialysisSetting := models.XtDialysisSetting{
6181
 	dialysisSetting := models.XtDialysisSetting{
6181
 		Sodium:                     sodium_set,
6182
 		Sodium:                     sodium_set,
6182
 		Calcium:                    calcium_set,
6183
 		Calcium:                    calcium_set,
6215
 		GansunaSet:                 gansuna_set,
6216
 		GansunaSet:                 gansuna_set,
6216
 		ZhetangtieSet:              zhetangtie_set,
6217
 		ZhetangtieSet:              zhetangtie_set,
6217
 		NiaojimeiSet:               niaojimei_set,
6218
 		NiaojimeiSet:               niaojimei_set,
6219
+		DialysisStrainerSet:        dialysis_strainer_set,
6218
 	}
6220
 	}
6219
 	err := service.SaveDialysisSetting(dialysisSetting)
6221
 	err := service.SaveDialysisSetting(dialysisSetting)
6220
 	if err == nil {
6222
 	if err == nil {

+ 1 - 1
controllers/doctors_api_controller.go Parādīt failu

353
 	}
353
 	}
354
 
354
 
355
 	//康桥
355
 	//康桥
356
-	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
356
+	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
357
 		timeNowStr := time.Now().Format("2006-01-02")
357
 		timeNowStr := time.Now().Format("2006-01-02")
358
 		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
358
 		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
359
 
359
 

+ 1 - 1
controllers/his_api_controller.go Parādīt failu

3197
 	var adviceList []models.HisDoctorAdviceInfo
3197
 	var adviceList []models.HisDoctorAdviceInfo
3198
 	var projectList []models.HisPrescriptionProject
3198
 	var projectList []models.HisPrescriptionProject
3199
 
3199
 
3200
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 {
3200
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 {
3201
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3201
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3202
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3202
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3203
 
3203
 

+ 20 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go Parādīt failu

118
 				dobulecheck, _ := service.GetAllDobuleCheckList(orgID, date.Unix())
118
 				dobulecheck, _ := service.GetAllDobuleCheckList(orgID, date.Unix())
119
 
119
 
120
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
120
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
121
+
121
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
122
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
122
 
123
 
123
 				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
124
 				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
561
 
562
 
562
 	projects, _ = service.GetHisPrescriptionProjects(adminInfo.Org.Id, patientID, date.Unix())
563
 	projects, _ = service.GetHisPrescriptionProjects(adminInfo.Org.Id, patientID, date.Unix())
563
 
564
 
564
-	fmt.Print("projectOne------------------------", projectsOne)
565
-
566
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
565
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
567
 
566
 
568
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
567
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
2803
 			tempassessmentAfterDislysis.ActualUltrafiltration = UltrafiltrationVolumeOne
2802
 			tempassessmentAfterDislysis.ActualUltrafiltration = UltrafiltrationVolumeOne
2804
 		}
2803
 		}
2805
 
2804
 
2805
+		if adminUserInfo.Org.Id == 10721 {
2806
+			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
2807
+			tempassessmentAfterDislysis.SystolicBloodPressure = 0
2808
+		}
2809
+
2806
 		if adminUserInfo.Org.Id == 10697 {
2810
 		if adminUserInfo.Org.Id == 10697 {
2807
 			lastWeightAfter, _ := service.GetLastWeightAfter(tempassessmentAfterDislysis.PatientId, tempassessmentAfterDislysis.AssessmentDate, adminUserInfo.Org.Id)
2811
 			lastWeightAfter, _ := service.GetLastWeightAfter(tempassessmentAfterDislysis.PatientId, tempassessmentAfterDislysis.AssessmentDate, adminUserInfo.Org.Id)
2808
 			floatAfeter := strconv.FormatFloat(lastWeightAfter.WeightAfter, 'f', -1, 64)
2812
 			floatAfeter := strconv.FormatFloat(lastWeightAfter.WeightAfter, 'f', -1, 64)
3080
 		lastWeightAfter.LastAfterWeight = floatAfeter
3084
 		lastWeightAfter.LastAfterWeight = floatAfeter
3081
 	}
3085
 	}
3082
 
3086
 
3087
+	if adminUserInfo.Org.Id == 10721 {
3088
+		tempassessmentAfterDislysis.DiastolicBloodPressure = 0
3089
+		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3090
+	}
3091
+
3083
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3092
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3084
 
3093
 
3085
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
3094
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
3630
 
3639
 
3631
 	var ultrafiltration_rate float64
3640
 	var ultrafiltration_rate float64
3632
 	var ultrafiltration_rate_one string
3641
 	var ultrafiltration_rate_one string
3642
+	var replacement_rate float64
3633
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3643
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3634
 	//后期预增脱水量
3644
 	//后期预增脱水量
3635
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3645
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3751
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3761
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3752
 			}
3762
 			}
3753
 
3763
 
3764
+			if adminUserInfo.Org.Id == 10721 {
3765
+				replacement_rate = math.Floor(prescription.ReplacementTotal * 1000 / float64(totalMin) * 60 * 1000)
3766
+				replacement_rate = replacement_rate / 1000
3767
+			}
3768
+
3754
 		}
3769
 		}
3755
 	}
3770
 	}
3756
 
3771
 
3769
 		CreatedTime:            time.Now().Unix(),
3784
 		CreatedTime:            time.Now().Unix(),
3770
 		UpdatedTime:            time.Now().Unix(),
3785
 		UpdatedTime:            time.Now().Unix(),
3771
 		UltrafiltrationRateOne: ultrafiltration_rate_one,
3786
 		UltrafiltrationRateOne: ultrafiltration_rate_one,
3787
+		ReplacementRate:        replacement_rate,
3772
 	}
3788
 	}
3773
 
3789
 
3774
 	//只针对广慈医院
3790
 	//只针对广慈医院
4834
 			}
4850
 			}
4835
 
4851
 
4836
 			if adminInfo.Org.Id == 10721 {
4852
 			if adminInfo.Org.Id == 10721 {
4853
+				fmt.Println("prescription.PrescriptionWater-------------------", prescription.PrescriptionWater)
4837
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4854
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4838
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4855
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4839
 			}
4856
 			}
6164
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6181
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6165
 
6182
 
6166
 		//康桥
6183
 		//康桥
6167
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 {
6184
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10721 {
6168
 			timeNowStr := time.Now().Format("2006-01-02")
6185
 			timeNowStr := time.Now().Format("2006-01-02")
6169
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6186
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6170
 
6187
 

+ 10 - 1
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go Parādīt failu

46
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
46
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
47
 		var vlist []interface{}
47
 		var vlist []interface{}
48
 		var elist []interface{}
48
 		var elist []interface{}
49
+
49
 		for _, item := range patient {
50
 		for _, item := range patient {
50
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
51
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
52
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
53
+			item.DialysisSolution = solution
51
 			vlist = append(vlist, prescription)
54
 			vlist = append(vlist, prescription)
55
+
52
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
56
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
53
 
57
 
54
 			elist = append(elist, dialysis)
58
 			elist = append(elist, dialysis)
68
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
72
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
69
 		//查询今日排班的病人
73
 		//查询今日排班的病人
70
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
74
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
75
+
71
 		var vlist []interface{}
76
 		var vlist []interface{}
72
 		var elist []interface{}
77
 		var elist []interface{}
78
+
73
 		for _, item := range patient {
79
 		for _, item := range patient {
74
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
80
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
75
 			vlist = append(vlist, prescription)
81
 			vlist = append(vlist, prescription)
76
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
82
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
77
-			fmt.Println("dialysis-------------------------------------------", dialysis)
78
 			elist = append(elist, dialysis)
83
 			elist = append(elist, dialysis)
84
+
85
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
86
+			item.DialysisSolution = solution
87
+
79
 		}
88
 		}
80
 		if err == nil {
89
 		if err == nil {
81
 			this.ServeSuccessJSON(map[string]interface{}{
90
 			this.ServeSuccessJSON(map[string]interface{}{

+ 7 - 4
controllers/patient_api_controller.go Parādīt failu

231
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
231
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
232
 	isprescription, _ := c.GetInt64("isprescription", 0)
232
 	isprescription, _ := c.GetInt64("isprescription", 0)
233
 	patientSoureType, _ := c.GetInt64("patientSoureType")
233
 	patientSoureType, _ := c.GetInt64("patientSoureType")
234
+	patient_type, _ := c.GetInt64("patient_type")
234
 	nurse, _ := c.GetInt64("nurse")
235
 	nurse, _ := c.GetInt64("nurse")
235
 	if page <= 0 {
236
 	if page <= 0 {
236
 		page = 1
237
 		page = 1
270
 
271
 
271
 	var patients []*models.Patients
272
 	var patients []*models.Patients
272
 	var total int64
273
 	var total int64
273
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse)
274
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type)
274
 
275
 
275
 	c.ServeSuccessJSON(map[string]interface{}{
276
 	c.ServeSuccessJSON(map[string]interface{}{
276
 		"patients": patients,
277
 		"patients": patients,
4689
 
4690
 
4690
 	adminInfo := c.GetAdminUserInfo()
4691
 	adminInfo := c.GetAdminUserInfo()
4691
 	records, total, _ := service.GetPatientDialysisRecord(adminInfo.CurrentOrgId, patientID, page, limit, theStartTIme, theEndtTIme, mode_id)
4692
 	records, total, _ := service.GetPatientDialysisRecord(adminInfo.CurrentOrgId, patientID, page, limit, theStartTIme, theEndtTIme, mode_id)
4692
-
4693
+	fmt.Println("长度", len(records))
4693
 	if len(records) == 0 {
4694
 	if len(records) == 0 {
4694
-		list, _ := service.GetAllDialysisOrder(patientID)
4695
+		list, _ := service.GetAllDialysisOrder(patientID, theStartTIme, theEndtTIme)
4695
 		for _, item := range list {
4696
 		for _, item := range list {
4696
 			schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType)
4697
 			schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType)
4697
-			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
4698
+			prescribeOne, _ := service.GetDialysisPrescribeOne(adminInfo.CurrentOrgId, item.PatientId, item.DialysisDate)
4699
+
4700
+			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID, prescribeOne.ModeId)
4698
 		}
4701
 		}
4699
 	}
4702
 	}
4700
 	c.ServeSuccessJSON(map[string]interface{}{
4703
 	c.ServeSuccessJSON(map[string]interface{}{

+ 13 - 7
controllers/sign_api_controller.go Parādīt failu

1227
 
1227
 
1228
 func (this *SignApiController) ToAutoDiagnose() {
1228
 func (this *SignApiController) ToAutoDiagnose() {
1229
 
1229
 
1230
-	orgId := this.GetAdminUserInfo().CurrentOrgId
1230
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
1231
 
1231
 
1232
 	//order, _ := service.GetDialysisOrderTotalCount()
1232
 	//order, _ := service.GetDialysisOrderTotalCount()
1233
 	//
1233
 	//
1242
 	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1242
 	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1243
 	//}
1243
 	//}
1244
 
1244
 
1245
-	list, _ := service.GetAllDialysisOrderTwo(10892)
1246
-	fmt.Println("list=============", list)
1247
-	for _, item := range list {
1248
-		schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
-		service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
-	}
1245
+	//list, _ := service.GetAllDialysisOrderTwo(10340)
1246
+	//
1247
+	//for _, item := range list {
1248
+	//	schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
+	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
+	//}
1251
 
1251
 
1252
 	//drugList, _ := service.GetAllBaseDrugList(10318)
1252
 	//drugList, _ := service.GetAllBaseDrugList(10318)
1253
 	//for _, item := range drugList {
1253
 	//for _, item := range drugList {
1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1262
 	//}
1262
 	//}
1263
 
1263
 
1264
+	list, _ := service.GetAllDialysisPrescription(29190)
1265
+
1266
+	for _, item := range list {
1267
+		service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
1268
+	}
1269
+
1264
 	this.ServeSuccessJSON(map[string]interface{}{
1270
 	this.ServeSuccessJSON(map[string]interface{}{
1265
 		"msg": "ok",
1271
 		"msg": "ok",
1266
 	})
1272
 	})

+ 5 - 4
models/dialysis_parameter_models.go Parādīt failu

104
 }
104
 }
105
 
105
 
106
 type XtScheduleTwo struct {
106
 type XtScheduleTwo struct {
107
-	ID        int64  `gorm:"column:id" json:"id" form:"id"`
108
-	ModeId    int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
-	PatientId int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
-	Name      string `gorm:"column:name" json:"name" form:"name"`
107
+	ID               int64            `gorm:"column:id" json:"id" form:"id"`
108
+	ModeId           int64            `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
+	PatientId        int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
+	Name             string           `gorm:"column:name" json:"name" form:"name"`
111
+	DialysisSolution DialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
111
 }
112
 }
112
 
113
 
113
 func (XtScheduleTwo) TableName() string {
114
 func (XtScheduleTwo) TableName() string {

+ 1 - 0
models/new_stock_models.go Parādīt failu

220
 	GansunaSet                 int64 `gorm:"column:gansuna_set" json:"gansuna_set" form:"gansuna_set"`
220
 	GansunaSet                 int64 `gorm:"column:gansuna_set" json:"gansuna_set" form:"gansuna_set"`
221
 	ZhetangtieSet              int64 `gorm:"column:zhetangtie_set" json:"zhetangtie_set" form:"zhetangtie_set"`
221
 	ZhetangtieSet              int64 `gorm:"column:zhetangtie_set" json:"zhetangtie_set" form:"zhetangtie_set"`
222
 	NiaojimeiSet               int64 `gorm:"column:niaojimei_set" json:"niaojimei_set" form:"niaojimei_set"`
222
 	NiaojimeiSet               int64 `gorm:"column:niaojimei_set" json:"niaojimei_set" form:"niaojimei_set"`
223
+	DialysisStrainerSet        int64 `gorm:"column:dialysis_strainer_set" json:"dialysis_strainer_set" form:"dialysis_strainer_set"`
223
 }
224
 }
224
 
225
 
225
 func (XtDialysisSetting) TableName() string {
226
 func (XtDialysisSetting) TableName() string {

+ 6 - 3
service/dialysis_parameter_service.go Parādīt failu

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"fmt"
4
 	"fmt"
5
+
6
+	"XT_New/models"
6
 	"github.com/jinzhu/gorm"
7
 	"github.com/jinzhu/gorm"
7
 )
8
 )
8
 
9
 
63
 	AssessmentBeforeDislysis models.PredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
64
 	AssessmentBeforeDislysis models.PredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
64
 	AssessmentAfterDislysis  models.AssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
65
 	AssessmentAfterDislysis  models.AssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
65
 	MonitoringRecord         []models.MonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
66
 	MonitoringRecord         []models.MonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
67
+	DialysisSolution         models.DialysisSolution        `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
66
 }
68
 }
67
 
69
 
68
 func (MonitorDialysisSchedule) TableName() string {
70
 func (MonitorDialysisSchedule) TableName() string {
70
 }
72
 }
71
 
73
 
72
 func GetDialysisParametersByKeyword(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, schedulDate int64) ([]*VMDialysisSchedule, error, int64) {
74
 func GetDialysisParametersByKeyword(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, schedulDate int64) ([]*VMDialysisSchedule, error, int64) {
73
-	fmt.Println("scheduletye ======================", schedulType)
75
+
74
 	var patients []*models.Patients
76
 	var patients []*models.Patients
75
 	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
77
 	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
76
 	if getPatientErr != nil {
78
 	if getPatientErr != nil {
118
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, schedulDate).
120
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, schedulDate).
119
 		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, schedulDate).
121
 		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, schedulDate).
120
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
122
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
121
-		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
123
+		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
124
+		Preload("DialysisSolution", "status=1 and user_org_id = ? and solution_status = 1", orgID)
122
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
125
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
123
 	if schedulDate > 0 {
126
 	if schedulDate > 0 {
124
 		db = db.Where("schedule_date = ?", schedulDate)
127
 		db = db.Where("schedule_date = ?", schedulDate)

+ 58 - 17
service/mobile_dialysis_service.go Parādīt failu

2754
 	return &record, nil
2754
 	return &record, nil
2755
 }
2755
 }
2756
 
2756
 
2757
+func GetDialysisPrescribeOne(orgID int64, patientID int64, recordDate int64) (models.DialysisPrescription, error) {
2758
+	var record models.DialysisPrescription
2759
+	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, recordDate).First(&record).Error
2760
+
2761
+	return record, err
2762
+}
2763
+
2757
 // 透析方案
2764
 // 透析方案
2758
 func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2765
 func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2759
 	var record models.DialysisSolution
2766
 	var record models.DialysisSolution
3279
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
3286
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
3280
 	his_doctor_advice_str, _ := redis.Get(key).Result()
3287
 	his_doctor_advice_str, _ := redis.Get(key).Result()
3281
 	redis.Set(key, "", time.Second)
3288
 	redis.Set(key, "", time.Second)
3282
-	if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3283
-		err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3284
-		if err != nil {
3285
-			if err == gorm.ErrRecordNotFound {
3286
-				if len(his) <= 0 {
3289
+	if orgid != 10721 {
3290
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3291
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3292
+			if err != nil {
3293
+				if err == gorm.ErrRecordNotFound {
3294
+					if len(his) <= 0 {
3295
+						redis.Set(key, "null", time.Second*60*60*18)
3296
+					}
3297
+					return his, nil
3298
+				} else {
3299
+					return his, err
3300
+				}
3301
+			} else {
3302
+				if len(his) > 0 {
3303
+					//缓存数据
3304
+					his_doctor_advice_str, err := json.Marshal(his)
3305
+					if err == nil {
3306
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3307
+					}
3308
+				} else {
3287
 					redis.Set(key, "null", time.Second*60*60*18)
3309
 					redis.Set(key, "null", time.Second*60*60*18)
3288
 				}
3310
 				}
3289
 				return his, nil
3311
 				return his, nil
3290
-			} else {
3291
-				return his, err
3292
 			}
3312
 			}
3293
-		} else {
3294
-			if len(his) > 0 {
3295
-				//缓存数据
3296
-				his_doctor_advice_str, err := json.Marshal(his)
3297
-				if err == nil {
3298
-					redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3313
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3314
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3315
+			return his, nil
3316
+		}
3317
+	}
3318
+
3319
+	if orgid == 10721 {
3320
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3321
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? and execution_frequency!='上机前' and delivery_way!='口服' ", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3322
+			if err != nil {
3323
+				if err == gorm.ErrRecordNotFound {
3324
+					if len(his) <= 0 {
3325
+						redis.Set(key, "null", time.Second*60*60*18)
3326
+					}
3327
+					return his, nil
3328
+				} else {
3329
+					return his, err
3299
 				}
3330
 				}
3300
 			} else {
3331
 			} else {
3301
-				redis.Set(key, "null", time.Second*60*60*18)
3332
+				if len(his) > 0 {
3333
+					//缓存数据
3334
+					his_doctor_advice_str, err := json.Marshal(his)
3335
+					if err == nil {
3336
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3337
+					}
3338
+				} else {
3339
+					redis.Set(key, "null", time.Second*60*60*18)
3340
+				}
3341
+				return his, nil
3302
 			}
3342
 			}
3343
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3344
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3303
 			return his, nil
3345
 			return his, nil
3304
 		}
3346
 		}
3305
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
3306
-		json.Unmarshal([]byte(his_doctor_advice_str), &his)
3307
-		return his, nil
3308
 	}
3347
 	}
3348
+
3349
+	return his, nil
3309
 }
3350
 }
3310
 
3351
 
3311
 func GetLastDialysisPrescriptionByPatientId(orgid int64, patientid int64, recorddate int64) (*models.DialysisPrescription, error) {
3352
 func GetLastDialysisPrescriptionByPatientId(orgid int64, patientid int64, recorddate int64) (*models.DialysisPrescription, error) {

+ 67 - 24
service/patient_service.go Parādīt failu

14
 )
14
 )
15
 
15
 
16
 // GetPatientList 返回患者的列表
16
 // GetPatientList 返回患者的列表
17
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64) (patients []*models.Patients, total int64, err error) {
17
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64) (patients []*models.Patients, total int64, err error) {
18
 
18
 
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
20
 	if orgID > 0 {
20
 	if orgID > 0 {
73
 	if nurse > 0 {
73
 	if nurse > 0 {
74
 		db = db.Where("p.head_nurse_id = ?", nurse)
74
 		db = db.Where("p.head_nurse_id = ?", nurse)
75
 	}
75
 	}
76
+	if patient_type > 0 {
77
+		db = db.Where("p.patient_type = ?", patient_type)
78
+	}
76
 
79
 
77
 	offset := (page - 1) * limit
80
 	offset := (page - 1) * limit
78
 	if lapseto == 2 || lapseto == 3 {
81
 	if lapseto == 2 || lapseto == 3 {
472
 	defer redis.Close()
475
 	defer redis.Close()
473
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":his_advices_list_all"
476
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":his_advices_list_all"
474
 	his_advices_all, _ := redis.Get(key).Result()
477
 	his_advices_all, _ := redis.Get(key).Result()
475
-
476
-	if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
477
-		err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
478
-		if err != nil {
479
-			if err == gorm.ErrRecordNotFound {
480
-				if len(hisAdvices) <= 0 {
478
+	redis.Set(key, "", time.Second)
479
+	if orgID != 10721 {
480
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
481
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
482
+			if err != nil {
483
+				if err == gorm.ErrRecordNotFound {
484
+					if len(hisAdvices) <= 0 {
485
+						redis.Set(key, "null", time.Second*60*60*18)
486
+					}
487
+					return nil, nil
488
+				} else {
489
+					return nil, err
490
+				}
491
+			} else {
492
+				if len(hisAdvices) > 0 {
493
+					//缓存数据
494
+					his_advices_all, err := json.Marshal(&hisAdvices)
495
+					if err == nil {
496
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
497
+					}
498
+				} else {
481
 					redis.Set(key, "null", time.Second*60*60*18)
499
 					redis.Set(key, "null", time.Second*60*60*18)
482
 				}
500
 				}
501
+				return hisAdvices, nil
502
+			}
503
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
504
+			if his_advices_all == "null" {
483
 				return nil, nil
505
 				return nil, nil
484
 			} else {
506
 			} else {
485
-				return nil, err
507
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
508
+				return hisAdvices, nil
486
 			}
509
 			}
487
-		} else {
488
-			if len(hisAdvices) > 0 {
489
-				//缓存数据
490
-				his_advices_all, err := json.Marshal(&hisAdvices)
491
-				if err == nil {
492
-					redis.Set(key, his_advices_all, time.Second*60*60*18)
510
+
511
+		}
512
+	}
513
+
514
+	if orgID == 10721 {
515
+
516
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
517
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ? and execution_frequency !='上机前' and delivery_way!='口服' ", orgID, scheduleDate).Find(&hisAdvices).Error
518
+			if err != nil {
519
+				if err == gorm.ErrRecordNotFound {
520
+					if len(hisAdvices) <= 0 {
521
+						redis.Set(key, "null", time.Second*60*60*18)
522
+					}
523
+					return nil, nil
524
+				} else {
525
+					return nil, err
493
 				}
526
 				}
494
 			} else {
527
 			} else {
495
-				redis.Set(key, "null", time.Second*60*60*18)
528
+				if len(hisAdvices) > 0 {
529
+					//缓存数据
530
+					his_advices_all, err := json.Marshal(&hisAdvices)
531
+					if err == nil {
532
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
533
+					}
534
+				} else {
535
+					redis.Set(key, "null", time.Second*60*60*18)
536
+				}
537
+				return hisAdvices, nil
538
+			}
539
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
540
+			if his_advices_all == "null" {
541
+				return nil, nil
542
+			} else {
543
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
544
+				return hisAdvices, nil
496
 			}
545
 			}
497
-			return hisAdvices, nil
498
-		}
499
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
500
-		if his_advices_all == "null" {
501
-			return nil, nil
502
-		} else {
503
-			json.Unmarshal([]byte(his_advices_all), &hisAdvices)
504
-			return hisAdvices, nil
505
-		}
506
 
546
 
547
+		}
507
 	}
548
 	}
549
+
550
+	return hisAdvices, nil
508
 }
551
 }
509
 
552
 
510
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {
553
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {

+ 22 - 7
service/sign_service.go Parādīt failu

2110
 	return err
2110
 	return err
2111
 }
2111
 }
2112
 
2112
 
2113
-func GetAllDialysisOrderTwo(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2113
+func GetAllDialysisOrderTwo(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2114
 
2114
 
2115
-	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1696089600", patient_id).Find(&list).Error
2115
+	err = XTReadDB().Where("user_org_id = ? and status =1 and dialysis_date=1730736000", user_org_id).Find(&list).Error
2116
 
2116
 
2117
 	return list, err
2117
 	return list, err
2118
 }
2118
 }
2119
 
2119
 
2120
-func GetAllDialysisOrder(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2120
+func GetAllDialysisPrescription(patient_id int64) (list []*models.XtDialysisPrescription, err error) {
2121
 
2121
 
2122
-	err = XTReadDB().Where("patient_id = ? and status =1", patient_id).Find(&list).Error
2122
+	err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
2123
+
2124
+	return list, err
2125
+}
2126
+func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
2127
+
2128
+	schedule := models.XtSchedule{}
2129
+
2130
+	err := XTWriteDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and status=1 and user_org_id =?", patient_id, record_date, user_org_id).Updates(map[string]interface{}{"mode_id": mode_id}).Error
2131
+
2132
+	return schedule, err
2133
+}
2134
+
2135
+func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
2136
+
2137
+	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=? and dialysis_date<=?", patient_id, start_time, end_time).Find(&list).Error
2123
 
2138
 
2124
 	return list, err
2139
 	return list, err
2125
 }
2140
 }
2127
 func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
2142
 func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
2128
 
2143
 
2129
 	schedule := models.Schedule{}
2144
 	schedule := models.Schedule{}
2130
-	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and status=0", patient_id, schedule_date).First(&schedule).Error
2145
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ?", patient_id, schedule_date).First(&schedule).Error
2131
 
2146
 
2132
 	return schedule, err
2147
 	return schedule, err
2133
 }
2148
 }
2134
 
2149
 
2135
-func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64) error {
2150
+func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64, mode_id int64) error {
2136
 
2151
 
2137
-	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1}).Error
2152
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1, "mode_id": mode_id}).Error
2138
 	return err
2153
 	return err
2139
 }
2154
 }
2140
 
2155