28169 1 vuosi sitten
vanhempi
commit
eb9caadfeb

BIN
XT_New.exe Näytä tiedosto


+ 8 - 7
controllers/base_api_controller.go Näytä tiedosto

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
 	"fmt"
4
 	"fmt"
8
 	"strconv"
5
 	"strconv"
9
 	"strings"
6
 	"strings"
7
+
8
+	"XT_New/enums"
9
+	"XT_New/models"
10
+	"XT_New/service"
10
 )
11
 )
11
 
12
 
12
 type BaseAPIController struct {
13
 type BaseAPIController struct {
81
 		userAdmin.ModifyTime = 1530786071
82
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
83
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
84
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10480 //机构id 10344
85
+		subscibe.OrgId = 10278 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
88
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
93
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
94
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10480 //机构id小英9675或4
95
+		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
95
 		adminUserInfo.CurrentAppId = 3467  //4
96
 		adminUserInfo.CurrentAppId = 3467  //4
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
98
 		adminUserInfo.Subscibes = subscibes
326
 		userAdmin.ModifyTime = 1530786071
327
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
328
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
329
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10480 //机构id小英10344或4
330
+		subscibe.OrgId = 10278 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
333
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
338
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
339
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10480 //机构id小英9675或4
340
+		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
340
 		adminUserInfo.CurrentAppId = 3467  //4
341
 		adminUserInfo.CurrentAppId = 3467  //4
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
343
 		adminUserInfo.Subscibes = subscibes

+ 7 - 6
controllers/mobile_api_controllers/dialysis_api_controller.go Näytä tiedosto

1
 package mobile_api_controllers
1
 package mobile_api_controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"errors"
5
 	"errors"
10
 	"fmt"
6
 	"fmt"
11
-	"github.com/astaxie/beego"
12
-	"github.com/jinzhu/gorm"
13
 	"math"
7
 	"math"
14
 	"net/http"
8
 	"net/http"
15
 	"net/url"
9
 	"net/url"
17
 	"strconv"
11
 	"strconv"
18
 	"strings"
12
 	"strings"
19
 	"time"
13
 	"time"
14
+
15
+	"XT_New/enums"
16
+	"XT_New/models"
17
+	"XT_New/service"
18
+	"XT_New/utils"
19
+	"github.com/astaxie/beego"
20
+	"github.com/jinzhu/gorm"
20
 )
21
 )
21
 
22
 
22
 // type DialysisTestAPIController struct {
23
 // type DialysisTestAPIController struct {

+ 45 - 63
controllers/new_mobile_api_controllers/new_manage_api_controller.go Näytä tiedosto

1
 package new_mobile_api_controllers
1
 package new_mobile_api_controllers
2
 
2
 
3
 import (
3
 import (
4
+	"fmt"
5
+	"strconv"
6
+	"time"
7
+
4
 	"XT_New/controllers/mobile_api_controllers"
8
 	"XT_New/controllers/mobile_api_controllers"
5
 	"XT_New/enums"
9
 	"XT_New/enums"
6
 	"XT_New/models"
10
 	"XT_New/models"
7
 	"XT_New/service"
11
 	"XT_New/service"
8
 	"XT_New/utils"
12
 	"XT_New/utils"
9
-	"fmt"
10
 	"github.com/jinzhu/gorm"
13
 	"github.com/jinzhu/gorm"
11
-	"strconv"
12
-	"time"
13
 )
14
 )
14
 
15
 
15
 type NewManageApiController struct {
16
 type NewManageApiController struct {
160
 		this.ServeSuccessJSON(returnData)
161
 		this.ServeSuccessJSON(returnData)
161
 		return
162
 		return
162
 	} else {
163
 	} else {
163
-		_, errcode := service.GetInforTwo(patientid, scheduledate, orgid, scheduletype)
164
-		if errcode == gorm.ErrRecordNotFound {
165
-			information := models.DeviceInformation{
166
-				Date:                  scheduledate,
167
-				Zone:                  zoneid,
168
-				Class:                 scheduletype,
169
-				BedNumber:             bedid,
170
-				PatientId:             patientid,
171
-				DialysisMode:          modeid,
172
-				LongTime:              strconv.FormatInt(disinfectime, 10),
173
-				Disinfection:          1,
174
-				DialysisConcentration: 1,
175
-				DisinfectionStatus:    1,
176
-				Move:                  1,
177
-				UserOrgId:             orgid,
178
-				DisinfectType:         plan.Way,
179
-				DisinfectantType:      plan.MachineDisinfectant,
180
-				FluidPath:             plan.DisinfectanWay, //液路消毒方式
181
-				Disinfectant:          plan.Disinfectant,
182
-				Ctime:                 time.Now().Unix(),
183
-				Status:                1,
184
-				SignName:              order.FinishNurse,
185
-				EquimentId:            addmacher.ID,
186
-				DisinfectionResidue:   2,
187
-				Bed:                   addmacher.BedNumber,
188
-				StartTime:             order.StartTime,
189
-				EndTime:               order.EndTime,
190
-				Contagion:             con,
191
-				WeightLoss:            dislysis.WeightLoss,
192
-				Hyperfiltratio:        dislysis.ActualUltrafiltration,
193
-				DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
194
-				MachineRun:            1,
195
-				DisinfecStartime:      startdateunix,
196
-				DisinfecEndtime:       enddateunix,
197
-			}
198
-			err := service.CreateInformationTwo(&information)
199
-			fmt.Println("报错", err)
200
-			if err != nil {
201
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
202
-				return
203
-			}
204
-			this.ServeSuccessJSON(map[string]interface{}{
205
-				"information": information,
206
-			})
207
-		} else if errcode == nil {
208
-			information := models.DeviceInformation{
209
-				DisinfecStartime: startdateunix,
210
-				DisinfecEndtime:  enddateunix,
211
-				LongTime:         strconv.FormatInt(disinfectime, 10),
212
-			}
213
-
214
-			errcode := service.UpdateInformation(&information, scheduledate, bedid, scheduletype)
215
-			if errcode != nil {
216
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
217
-				return
218
-			}
219
-			this.ServeSuccessJSON(map[string]interface{}{
220
-				"information": information,
221
-			})
222
-		} else {
164
+		information := models.DeviceInformation{
165
+			Date:                  scheduledate,
166
+			Zone:                  zoneid,
167
+			Class:                 scheduletype,
168
+			BedNumber:             bedid,
169
+			PatientId:             patientid,
170
+			DialysisMode:          modeid,
171
+			LongTime:              strconv.FormatInt(disinfectime, 10),
172
+			Disinfection:          1,
173
+			DialysisConcentration: 1,
174
+			DisinfectionStatus:    1,
175
+			Move:                  1,
176
+			UserOrgId:             orgid,
177
+			DisinfectType:         plan.Way,
178
+			DisinfectantType:      plan.MachineDisinfectant,
179
+			FluidPath:             plan.DisinfectanWay, //液路消毒方式
180
+			Disinfectant:          plan.Disinfectant,
181
+			Ctime:                 time.Now().Unix(),
182
+			Status:                1,
183
+			SignName:              order.FinishNurse,
184
+			EquimentId:            addmacher.ID,
185
+			DisinfectionResidue:   2,
186
+			Bed:                   addmacher.BedNumber,
187
+			StartTime:             order.StartTime,
188
+			EndTime:               order.EndTime,
189
+			Contagion:             con,
190
+			WeightLoss:            dislysis.WeightLoss,
191
+			Hyperfiltratio:        dislysis.ActualUltrafiltration,
192
+			DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
193
+			MachineRun:            1,
194
+			DisinfecStartime:      startdateunix,
195
+			DisinfecEndtime:       enddateunix,
196
+		}
197
+		service.DeleteInformation(patientid, scheduledate, orgid)
198
+		err := service.CreateInformationTwo(&information)
199
+		fmt.Println("报错", err)
200
+		if err != nil {
223
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
201
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
224
 			return
202
 			return
225
 		}
203
 		}
204
+		this.ServeSuccessJSON(map[string]interface{}{
205
+			"information": information,
206
+		})
207
+
226
 	}
208
 	}
227
 }
209
 }
228
 
210
 

+ 19 - 6
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Näytä tiedosto

1
 package new_mobile_api_controllers
1
 package new_mobile_api_controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
 	"encoding/json"
4
 	"encoding/json"
10
 	"fmt"
5
 	"fmt"
11
-	"github.com/jinzhu/gorm"
12
 	"reflect"
6
 	"reflect"
13
 	"strconv"
7
 	"strconv"
14
 	"strings"
8
 	"strings"
15
 	"time"
9
 	"time"
10
+
11
+	"XT_New/controllers/mobile_api_controllers"
12
+	"XT_New/enums"
13
+	"XT_New/models"
14
+	"XT_New/service"
15
+	"XT_New/utils"
16
+	"github.com/jinzhu/gorm"
16
 )
17
 )
17
 
18
 
18
 type StaffScheduleApiController struct {
19
 type StaffScheduleApiController struct {
1506
 	})
1507
 	})
1507
 	return
1508
 	return
1508
 }
1509
 }
1510
+
1511
+func (c *StaffScheduleApiController) GetPatientMap() {
1512
+
1513
+	patient_id, _ := c.GetInt64("patient_id")
1514
+	orgId := c.GetMobileAdminUserInfo().Org.Id
1515
+	sitemap, _ := service.GetPatientSitemap(patient_id, orgId)
1516
+
1517
+	c.ServeSuccessJSON(map[string]interface{}{
1518
+		"sitemap": sitemap,
1519
+	})
1520
+	return
1521
+}

+ 2 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_router.go Näytä tiedosto

38
 
38
 
39
 	beego.Router("m/api/schedule/updateschedule", &StaffScheduleApiController{}, "Get:UpdateMobileSchedule")
39
 	beego.Router("m/api/schedule/updateschedule", &StaffScheduleApiController{}, "Get:UpdateMobileSchedule")
40
 
40
 
41
+	beego.Router("m/api/patient/getpatientmap", &StaffScheduleApiController{}, "Get:GetPatientMap")
42
+
41
 }
43
 }

+ 9 - 5
controllers/schedule_api_controller.go Näytä tiedosto

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"fmt"
5
 	"fmt"
10
-	"github.com/jinzhu/gorm"
11
 	"reflect"
6
 	"reflect"
12
 	"strconv"
7
 	"strconv"
13
 	"strings"
8
 	"strings"
14
 	"time"
9
 	"time"
15
 
10
 
11
+	"XT_New/enums"
12
+	"XT_New/models"
13
+	"XT_New/service"
14
+	"XT_New/utils"
15
+	"github.com/jinzhu/gorm"
16
+
16
 	"github.com/astaxie/beego"
17
 	"github.com/astaxie/beego"
17
 )
18
 )
18
 
19
 
4487
 
4488
 
4488
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4489
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4489
 
4490
 
4491
+	fmt.Println("week_type-------------------------", week_type)
4490
 	if week_type > 0 {
4492
 	if week_type > 0 {
4491
 		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
4493
 		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
4492
 		for _, item := range list {
4494
 		for _, item := range list {
4493
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
4495
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
4496
+			adviceList, _ := service.GetHisDoctorAdviceList(orgId, item.PatientId, targetDay.Unix())
4497
+			item.HisDoctorAdviceInfo = adviceList
4494
 			item.XtDialysisOrderSix = order
4498
 			item.XtDialysisOrderSix = order
4495
 			if orgId == 10340 {
4499
 			if orgId == 10340 {
4496
 
4500
 

+ 7 - 6
controllers/self_drug_api_congtroller.go Näytä tiedosto

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"fmt"
5
 	"fmt"
10
-	"github.com/astaxie/beego"
11
-	"github.com/jinzhu/gorm"
12
 	"reflect"
6
 	"reflect"
13
 	"strconv"
7
 	"strconv"
14
 	"strings"
8
 	"strings"
15
 	"time"
9
 	"time"
10
+
11
+	"XT_New/enums"
12
+	"XT_New/models"
13
+	"XT_New/service"
14
+	"XT_New/utils"
15
+	"github.com/astaxie/beego"
16
+	"github.com/jinzhu/gorm"
16
 )
17
 )
17
 
18
 
18
 type SelfDrugApiController struct {
19
 type SelfDrugApiController struct {

+ 12 - 3
service/manage_service.go Näytä tiedosto

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"fmt"
4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7
 	"strings"
5
 	"strings"
8
 	"time"
6
 	"time"
7
+
8
+	"XT_New/models"
9
+	"github.com/jinzhu/gorm"
9
 )
10
 )
10
 
11
 
11
 func GetEquitmentName(unit_type string, orgid int64) (*models.DeviceEquimentname, error) {
12
 func GetEquitmentName(unit_type string, orgid int64) (*models.DeviceEquimentname, error) {
1240
 	return order, err
1241
 	return order, err
1241
 }
1242
 }
1242
 
1243
 
1244
+func DeleteInformation(patient_id int64, schedule_date int64, user_org_id int64) (models.DeviceInformation, error) {
1245
+
1246
+	information := models.DeviceInformation{}
1247
+
1248
+	err := UserWriteDB().Model(&information).Where("patient_id =? and date =? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 0}).Error
1249
+	return information, err
1250
+}
1251
+
1243
 func CreateInformationTwo(information *models.DeviceInformation) error {
1252
 func CreateInformationTwo(information *models.DeviceInformation) error {
1244
 	err := UserWriteDB().Create(&information).Error
1253
 	err := UserWriteDB().Create(&information).Error
1245
 	return err
1254
 	return err
1247
 
1256
 
1248
 func UpdateInformation(information *models.DeviceInformation, scheduledate int64, bedid int64, scheduletype int64) error {
1257
 func UpdateInformation(information *models.DeviceInformation, scheduledate int64, bedid int64, scheduletype int64) error {
1249
 
1258
 
1250
-	err := UserWriteDB().Model(&information).Where("date = ? and bed_number = ? and class = ?", scheduledate, bedid, scheduletype).Updates(map[string]interface{}{"long_time": information.LongTime, "disinfec_startime": information.DisinfecStartime, "disinfec_endtime": information.DisinfecEndtime}).Error
1259
+	err := UserWriteDB().Model(&information).Where("date = ? and bed_number = ? and class = ?", scheduledate, bedid, scheduletype).Updates(map[string]interface{}{"long_time": information.LongTime, "disinfec_startime": information.DisinfecStartime, "disinfec_endtime": information.DisinfecEndtime, "bed_number": information.BedNumber, "zone": information.Zone}).Error
1251
 	return err
1260
 	return err
1252
 }
1261
 }
1253
 
1262
 

+ 12 - 8
service/schedule_service.go Näytä tiedosto

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"fmt"
4
 	"fmt"
6
 	"strconv"
5
 	"strconv"
7
 	"strings"
6
 	"strings"
8
 	"time"
7
 	"time"
9
 
8
 
9
+	"XT_New/models"
10
+
10
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
11
 )
12
 )
12
 
13
 
20
 
21
 
21
 func GetSchedulePartitionPanelOne(orgID int64, partionId []string) (partitions []*models.Partition, err error) {
22
 func GetSchedulePartitionPanelOne(orgID int64, partionId []string) (partitions []*models.Partition, err error) {
22
 
23
 
23
-	//if len(partionId) > 0 {
24
-	//	err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1 and zone_id in (?)", orgID, partionId).Where("org_id=? and status=1 and id  ?", orgID, partionId).Find(&partitions).Error
25
-	//}
26
-	//if len(partionId) == 0 {
27
 	err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Find(&partitions).Error
24
 	err = readDb.Model(&models.DeviceZone{}).Preload("Jihaos", "org_id=? and status=1", orgID).Where("org_id=? and status=1", orgID).Find(&partitions).Error
28
 	//}
25
 	//}
29
 
26
 
977
 
974
 
978
 	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 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
975
 	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 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
979
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
976
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
980
-	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ? and user_org_id = ? ", scheduleDate, orgid).Preload("DialysisPrescription", "status = 1 and record_date =? and user_org_id = ?", scheduleDate, orgid).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
977
+	}).Preload("DialysisPrescription", "status = 1 and record_date =? and user_org_id = ?", scheduleDate, orgid).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
981
 		return db.Where("status =1 and solution_status = 1").Order("id asc")
978
 		return db.Where("status =1 and solution_status = 1").Order("id asc")
982
 	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
979
 	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
983
-		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate)
980
+		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate).Limit(1)
984
 	}).Find(&list).Error
981
 	}).Find(&list).Error
985
 
982
 
986
 	return list, err
983
 	return list, err
1007
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
1004
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
1008
 		return db.Where("status =1 and solution_status =1").Order("id asc")
1005
 		return db.Where("status =1 and solution_status =1").Order("id asc")
1009
 	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
1006
 	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
1010
-		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate)
1007
+		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate).Limit(1)
1011
 	}).Find(&list).Error
1008
 	}).Find(&list).Error
1012
 
1009
 
1013
 	return list, err
1010
 	return list, err
1510
 	return order, err
1507
 	return order, err
1511
 }
1508
 }
1512
 
1509
 
1510
+func GetHisDoctorAdviceList(org_id int64, patient_id int64, dialysis_date int64) (adviceInfo []*models.HisDoctorAdviceInfo, err error) {
1511
+
1512
+	err = XTReadDB().Where("patient_id=? and user_org_id = ? and advice_date= ? and status=1", patient_id, org_id, dialysis_date).Find(&adviceInfo).Error
1513
+
1514
+	return adviceInfo, err
1515
+}
1516
+
1513
 func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1517
 func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1514
 
1518
 
1515
 	dialysisprescription := models.NewDialysisPrescription{}
1519
 	dialysisprescription := models.NewDialysisPrescription{}