|
@@ -579,7 +579,7 @@ func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64)
|
579
|
579
|
|
580
|
580
|
err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
581
|
581
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
582
|
|
- }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
|
|
582
|
+ }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", "status = 1 and user_org_id = ?", orgid).Find(&list).Error
|
583
|
583
|
|
584
|
584
|
return list, err
|
585
|
585
|
}
|
|
@@ -602,7 +602,7 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
|
602
|
602
|
|
603
|
603
|
err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
604
|
604
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
605
|
|
- }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
|
|
605
|
+ }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", "user_org_id =? and status = 1", orgid).Find(&list).Error
|
606
|
606
|
|
607
|
607
|
return list, err
|
608
|
608
|
}
|
|
@@ -777,7 +777,9 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
|
777
|
777
|
Preload("DeviceNumber", "status = 1 ").
|
778
|
778
|
Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
|
779
|
779
|
return db.Where("status = 1").Order("id asc")
|
780
|
|
- }).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
|
780
|
+ }).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
|
781
|
+ return db.Where("status = 1").Order("id asc")
|
|
782
|
+ }).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
781
|
783
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
782
|
784
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
|
783
|
785
|
Select("s.id,s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
|
|
@@ -908,3 +910,36 @@ func GetScheduleTemplate(orgid int64) (models.ScheduleTemplate, error) {
|
908
|
910
|
err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&template).Error
|
909
|
911
|
return template, err
|
910
|
912
|
}
|
|
913
|
+
|
|
914
|
+func GetDataPrintByOrgId(orgid int64) (*models.XtDataPrint, error) {
|
|
915
|
+
|
|
916
|
+ dataPrint := models.XtDataPrint{}
|
|
917
|
+
|
|
918
|
+ err := XTReadDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Find(&dataPrint).Error
|
|
919
|
+
|
|
920
|
+ if err == gorm.ErrRecordNotFound {
|
|
921
|
+ return nil, err
|
|
922
|
+ }
|
|
923
|
+ if err != nil {
|
|
924
|
+ return nil, err
|
|
925
|
+ }
|
|
926
|
+ return &dataPrint, nil
|
|
927
|
+}
|
|
928
|
+
|
|
929
|
+func CreateDataPrint(dataPrint *models.XtDataPrint) error {
|
|
930
|
+
|
|
931
|
+ err := XTWriteDB().Create(&dataPrint).Error
|
|
932
|
+ return err
|
|
933
|
+}
|
|
934
|
+
|
|
935
|
+func UpdteDataPrint(orgid int64, dataPrint *models.XtDataPrint) error {
|
|
936
|
+
|
|
937
|
+ err := XTWriteDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"is_open": dataPrint.IsOpen}).Error
|
|
938
|
+ return err
|
|
939
|
+}
|
|
940
|
+
|
|
941
|
+func GetDataPrint(orgid int64) (models.XtDataPrint, error) {
|
|
942
|
+ dataPrint := models.XtDataPrint{}
|
|
943
|
+ err := XTReadDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Find(&dataPrint).Error
|
|
944
|
+ return dataPrint, err
|
|
945
|
+}
|