28169 1 gadu atpakaļ
vecāks
revīzija
ad1e4c07eb

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

71
 	this.BaseAPIController.Prepare()
71
 	this.BaseAPIController.Prepare()
72
 	if this.GetAdminUserInfo() == nil {
72
 	if this.GetAdminUserInfo() == nil {
73
 		var userAdmin models.AdminUser
73
 		var userAdmin models.AdminUser
74
-		userAdmin.Id = 841
74
+		userAdmin.Id = 796
75
 		userAdmin.Mobile = "15717313968"
75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 841 //4,809
76
+		userAdmin.Id = 796 //4,809
77
 		userAdmin.Mobile = "12222222222"
77
 		userAdmin.Mobile = "12222222222"
78
 		userAdmin.IsSuperAdmin = true
78
 		userAdmin.IsSuperAdmin = true
79
 		userAdmin.Status = 1
79
 		userAdmin.Status = 1
81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10537 //机构id 10344
84
+		subscibe.OrgId = 10138 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
94
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
95
 		adminUserInfo.CurrentAppId = 3244  //4
95
 		adminUserInfo.CurrentAppId = 3244  //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
316
 	this.BaseAPIController.Prepare()
316
 	this.BaseAPIController.Prepare()
317
 	if this.GetAdminUserInfo() == nil {
317
 	if this.GetAdminUserInfo() == nil {
318
 		var userAdmin models.AdminUser
318
 		var userAdmin models.AdminUser
319
-		userAdmin.Id = 841
319
+		userAdmin.Id = 796
320
 		userAdmin.Mobile = "15717313968"
320
 		userAdmin.Mobile = "15717313968"
321
-		userAdmin.Id = 841 //4,809
321
+		userAdmin.Id = 796 //4,809
322
 		userAdmin.Mobile = "12222222222"
322
 		userAdmin.Mobile = "12222222222"
323
 		userAdmin.IsSuperAdmin = false
323
 		userAdmin.IsSuperAdmin = false
324
 		userAdmin.Status = 1
324
 		userAdmin.Status = 1
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10537 //机构id小英10344或4
329
+		subscibe.OrgId = 10138 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
339
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
340
 		adminUserInfo.CurrentAppId = 3244  //4
340
 		adminUserInfo.CurrentAppId = 3244  //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes

+ 36 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Parādīt failu

8087
 	}
8087
 	}
8088
 }
8088
 }
8089
 
8089
 
8090
+func (c *DialysisAPIController) GetPrescriptionList() {
8091
+
8092
+	start_time := c.GetString("start_time")
8093
+	end_time := c.GetString("end_time")
8094
+	orgId := c.GetMobileAdminUserInfo().Org.Id
8095
+	timeLayout := "2006-01-02"
8096
+	loc, _ := time.LoadLocation("Local")
8097
+	var startTime int64
8098
+	if len(start_time) > 0 {
8099
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8100
+		if err != nil {
8101
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8102
+			return
8103
+		}
8104
+		startTime = theTime.Unix()
8105
+	}
8106
+	var endTime int64
8107
+	if len(end_time) > 0 {
8108
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
8109
+		if err != nil {
8110
+			utils.ErrorLog(err.Error())
8111
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8112
+			return
8113
+		}
8114
+		endTime = theTime.Unix()
8115
+	}
8116
+	schedulelist, _ := service.GetMobileScheduleListOne(startTime, endTime, orgId)
8117
+
8118
+	fmt.Println("schedulelist22222222", schedulelist)
8119
+	c.ServeSuccessJSON(map[string]interface{}{
8120
+		"list": schedulelist,
8121
+	})
8122
+	return
8123
+
8124
+}
8125
+
8090
 func (c *DialysisAPIController) BatchDeleteMonitor() {
8126
 func (c *DialysisAPIController) BatchDeleteMonitor() {
8091
 
8127
 
8092
 	ids := c.GetString("ids")
8128
 	ids := c.GetString("ids")

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Parādīt failu

145
 
145
 
146
 	beego.Router("/m/api/getmobileprintstockgood", &DialysisAPIController{}, "Get:GetMobilePrintStockGood")
146
 	beego.Router("/m/api/getmobileprintstockgood", &DialysisAPIController{}, "Get:GetMobilePrintStockGood")
147
 
147
 
148
+	beego.Router("/m/api/getprescriptionlist", &DialysisAPIController{}, "Get:GetPrescriptionList")
149
+
148
 	//批量删除监测
150
 	//批量删除监测
149
 	beego.Router("/m/api/batchdeletemonitor", &DialysisAPIController{}, "Get:BatchDeleteMonitor")
151
 	beego.Router("/m/api/batchdeletemonitor", &DialysisAPIController{}, "Get:BatchDeleteMonitor")
150
 	//获取单个患者1年的透析日期
152
 	//获取单个患者1年的透析日期

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

195
 	})
195
 	})
196
 }
196
 }
197
 
197
 
198
-func (this *NewCommonApiController) GetPrescriptionlist() {
198
+func (this *NewCommonApiController) GetPrescriptionlistOne() {
199
 
199
 
200
 	startime := this.GetString("startime")
200
 	startime := this.GetString("startime")
201
 
201
 
243
 	startime := this.GetString("startime")
243
 	startime := this.GetString("startime")
244
 
244
 
245
 	endtime := this.GetString("endtime")
245
 	endtime := this.GetString("endtime")
246
-	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
247
-	fmt.Println("parseDateErr", parseDateErr)
246
+	startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
247
+
248
 	statime := startDate.Unix()
248
 	statime := startDate.Unix()
249
 
249
 
250
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
250
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
251
 
251
 
252
 	entime := endDate.Unix()
252
 	entime := endDate.Unix()
253
 
253
 
254
-	fmt.Println(endtime)
255
 	limit, _ := this.GetInt64("limit")
254
 	limit, _ := this.GetInt64("limit")
256
 
255
 
257
 	page, _ := this.GetInt64("page")
256
 	page, _ := this.GetInt64("page")
258
 
257
 
259
 	patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
258
 	patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
259
+
260
 	if err != nil {
260
 	if err != nil {
261
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
261
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
262
 		return
262
 		return

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

11
 	beego.Router("/m/api/getmobiletotalagecount", &NewCommonApiController{}, "Get:GetMobileTotalAgeCount")
11
 	beego.Router("/m/api/getmobiletotalagecount", &NewCommonApiController{}, "Get:GetMobileTotalAgeCount")
12
 	beego.Router("/m/api/getmobiletotaldialysiscount", &NewCommonApiController{}, "Get:GetMobileTotalDialysisCount")
12
 	beego.Router("/m/api/getmobiletotaldialysiscount", &NewCommonApiController{}, "Get:GetMobileTotalDialysisCount")
13
 	beego.Router("/m/api/gemobilepatientlist", &NewCommonApiController{}, "Get:GetMobilePatientList")
13
 	beego.Router("/m/api/gemobilepatientlist", &NewCommonApiController{}, "Get:GetMobilePatientList")
14
-	beego.Router("/m/api/getprescriptionlist", &NewCommonApiController{}, "Get:GetPrescriptionlist")
14
+	beego.Router("/m/api/getprescriptionlist/one", &NewCommonApiController{}, "Get:GetPrescriptionlistOne")
15
 	beego.Router("/m/api/getmobilepatientdetail", &NewCommonApiController{}, "Get:GetMobilePatientDetail")
15
 	beego.Router("/m/api/getmobilepatientdetail", &NewCommonApiController{}, "Get:GetMobilePatientDetail")
16
 	beego.Router("/m/api/tosearchpatient", &NewCommonApiController{}, "Get:ToSearchPatient")
16
 	beego.Router("/m/api/tosearchpatient", &NewCommonApiController{}, "Get:ToSearchPatient")
17
 	beego.Router("/m/api/getallpatientsmode", &NewCommonApiController{}, "Get:GetAllPatientsMode")
17
 	beego.Router("/m/api/getallpatientsmode", &NewCommonApiController{}, "Get:GetAllPatientsMode")

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

1024
 	Number              string `gorm:"column:number" json:"number" form:"number"`
1024
 	Number              string `gorm:"column:number" json:"number" form:"number"`
1025
 	ZoneName            string `gorm:"column:name" json:"zon_name" form:"name"`
1025
 	ZoneName            string `gorm:"column:name" json:"zon_name" form:"name"`
1026
 	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
1026
 	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
1027
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1027
 }
1028
 }
1028
 
1029
 
1029
 type XtDeviceOxygenates struct {
1030
 type XtDeviceOxygenates struct {

+ 17 - 0
models/patient_models.go Parādīt failu

493
 	return "xt_dialysis_prescription"
493
 	return "xt_dialysis_prescription"
494
 }
494
 }
495
 
495
 
496
+type DialysisPrescriptionListSix struct {
497
+	ID                         int64  `gorm:"column:id" json:"id" form:"id"`
498
+	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
499
+	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
500
+	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
501
+	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
502
+	DialysisStrainer           string `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
503
+	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
504
+	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
505
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
506
+}
507
+
508
+func (DialysisPrescriptionListSix) TableName() string {
509
+	return "xt_dialysis_solution"
510
+}
511
+
496
 type DialysisAssesmentBefor struct {
512
 type DialysisAssesmentBefor struct {
497
 	ID                     int64 `gorm:"column:id" json:"id"`
513
 	ID                     int64 `gorm:"column:id" json:"id"`
498
 	UserOrgId              int64 `gorm:"column:user_org_id" json:"user_org_id"`
514
 	UserOrgId              int64 `gorm:"column:user_org_id" json:"user_org_id"`
1608
 type VmDialysisSolution struct {
1624
 type VmDialysisSolution struct {
1609
 	UserOrgId                  int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1625
 	UserOrgId                  int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1610
 	PatientId                  int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1626
 	PatientId                  int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1627
+	DialysisStrainer           string                `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
1611
 	DialysisDialyszers         string                `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1628
 	DialysisDialyszers         string                `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1612
 	DialysisIrrigation         string                `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1629
 	DialysisIrrigation         string                `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1613
 	DialyzerPerfusionApparatus string                `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1630
 	DialyzerPerfusionApparatus string                `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`

+ 29 - 0
service/gobal_config_service.go Parādīt failu

510
 	return
510
 	return
511
 }
511
 }
512
 
512
 
513
+func GetMobileScheduleListOne(start_time int64, end_time int64, org_id int64) (schedulelist []*models.XtScheduleList, err error) {
514
+
515
+	db := XTReadDB().Model(&schedulelist).Where("status =1 and user_org_id =?", org_id)
516
+	if start_time > 0 {
517
+		db = db.Where("schedule_date>=?", start_time)
518
+	}
519
+	if end_time > 0 {
520
+		db = db.Where("schedule_date<=?", end_time)
521
+	}
522
+	err = db.Preload("DialysisSolution", "status=1 and user_org_id =?", org_id).Find(&schedulelist).Error
523
+
524
+	return schedulelist, err
525
+
526
+}
527
+
528
+func GetMobileDialysisPrescriptionList(start_time int64, end_time int64, org_id int64) (prescription []*models.DialysisPrescription, err error) {
529
+
530
+	db := XTReadDB().Model(&prescription).Where("status =1 and user_org_id =?", org_id)
531
+
532
+	if start_time > 0 {
533
+		db = db.Where("record_date>=?", start_time)
534
+	}
535
+	if end_time > 0 {
536
+		db = db.Where("record_date<=?", end_time)
537
+	}
538
+	err = db.Find(&prescription).Error
539
+	return prescription, err
540
+}
541
+
513
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
542
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
514
 
543
 
515
 	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
544
 	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error

+ 2 - 2
service/inspection_service.go Parādīt failu

38
 }
38
 }
39
 
39
 
40
 func GetPatientInspectionByDate(orgId, patientId, date, projectId int64) (inspections []*models.Inspection, err error) {
40
 func GetPatientInspectionByDate(orgId, patientId, date, projectId int64) (inspections []*models.Inspection, err error) {
41
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id =? and inspect_date =? and status=1", patientId, orgId, projectId, date).Find(&inspections).Error
41
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id =? and inspect_date =? and status=1", patientId, orgId, projectId, date).Order("created_time desc").Find(&inspections).Error
42
 	return
42
 	return
43
 }
43
 }
44
 
44
 
169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
170
 
170
 
171
 	var projectCount models.UserInspectionProjectCount
171
 	var projectCount models.UserInspectionProjectCount
172
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Scan(&projectCount).Error
172
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("created_time desc").Scan(&projectCount).Error
173
 
173
 
174
 	if err != nil {
174
 	if err != nil {
175
 		return
175
 		return

+ 2 - 0
service/mobile_dialysis_service.go Parādīt failu

2941
 	LastDialysisBeforePrepare []*DialysisBeforePrepare         `gorm:"-" json:"last_good_user_detail"`
2941
 	LastDialysisBeforePrepare []*DialysisBeforePrepare         `gorm:"-" json:"last_good_user_detail"`
2942
 	Project                   []*models.HisPrescriptionProject `gorm:"-" json:"project"`
2942
 	Project                   []*models.HisPrescriptionProject `gorm:"-" json:"project"`
2943
 	//WarehouseOutInfo          []*models.WarehouseOutInfoSeven   `gorm:"ForeignKey:PatientId,ScheduleDate;AssociationForeignKey:PatientId,SysRecordTime" json:"ware_house_out_info"`
2943
 	//WarehouseOutInfo          []*models.WarehouseOutInfoSeven   `gorm:"ForeignKey:PatientId,ScheduleDate;AssociationForeignKey:PatientId,SysRecordTime" json:"ware_house_out_info"`
2944
+	DialysisPrescription models.DialysisPrescriptionListSix `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"prescription"`
2944
 }
2945
 }
2945
 
2946
 
2946
 func (MDialysisGoodsVM) TableName() string {
2947
 func (MDialysisGoodsVM) TableName() string {
2984
 
2985
 
2985
 	db := readDb.
2986
 	db := readDb.
2986
 		Table("xt_schedule as sch").
2987
 		Table("xt_schedule as sch").
2988
+		Preload("DialysisPrescription", "status=1 and user_org_id =? and solution_status = 1", orgID).
2987
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
2989
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
2988
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
2990
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
2989
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
2991
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).

+ 3 - 0
service/pharmacy_service.go Parādīt failu

1437
 	var g errgroup.Group
1437
 	var g errgroup.Group
1438
 	var lib []*models.BaseDrugLib
1438
 	var lib []*models.BaseDrugLib
1439
 	var lock sync.Mutex
1439
 	var lock sync.Mutex
1440
+
1440
 	if special {
1441
 	if special {
1441
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%' AND status = 1 and is_special_diseases = 1", orgid).Find(&lib).Error
1442
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%' AND status = 1 and is_special_diseases = 1", orgid).Find(&lib).Error
1443
+
1442
 	} else {
1444
 	} else {
1443
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%'  AND status = 1 ", orgid).Find(&lib).Error
1445
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%'  AND status = 1 ", orgid).Find(&lib).Error
1446
+
1444
 	}
1447
 	}
1445
 	if err != nil {
1448
 	if err != nil {
1446
 		return
1449
 		return

+ 1 - 1
service/schedule_service.go Parādīt failu

1174
 	if partionid > 0 {
1174
 	if partionid > 0 {
1175
 		db = db.Where("x.partition_id = ?", partionid)
1175
 		db = db.Where("x.partition_id = ?", partionid)
1176
 	}
1176
 	}
1177
-	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.bed_id,x.partition_id,t.name,n.number,z.name,x.dialysis_machine_name").Joins("left join xt_patients as t on t.id = x.patient_id and t.user_org_id = ? and t.status = 1", orgid).Joins("left join xt_device_zone as z on z.id = x.partition_id and z.org_id = ? and z.status =1", orgid).Joins("left join xt_device_number as n on n.id = x.bed_id and n.org_id = ? and n.status =1", orgid).Scan(&schedule).Error
1177
+	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.bed_id,x.partition_id,t.name,n.number,z.name,x.dialysis_machine_name,x.mode_id").Joins("left join xt_patients as t on t.id = x.patient_id and t.user_org_id = ? and t.status = 1", orgid).Joins("left join xt_device_zone as z on z.id = x.partition_id and z.org_id = ? and z.status =1", orgid).Joins("left join xt_device_number as n on n.id = x.bed_id and n.org_id = ? and n.status =1", orgid).Scan(&schedule).Error
1178
 
1178
 
1179
 	return schedule, err
1179
 	return schedule, err
1180
 }
1180
 }