瀏覽代碼

11月8日库存管理

XMLWAN 3 年之前
父節點
當前提交
c92ebdc08b
共有 3 個文件被更改,包括 21 次插入13 次删除
  1. 13 12
      models/device_models.go
  2. 1 0
      models/schedule_models.go
  3. 7 1
      service/schedule_service.go

+ 13 - 12
models/device_models.go 查看文件

393
 }
393
 }
394
 
394
 
395
 type XtSchedule struct {
395
 type XtSchedule struct {
396
-	ID           int64 `gorm:"column:id" json:"id" form:"id"`
397
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
398
-	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
399
-	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
400
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
401
-	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
402
-	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
403
-	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
404
-	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
405
-	Status       int64 `gorm:"column:status" json:"status" form:"status"`
406
-	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
407
-	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
396
+	ID              int64                   `gorm:"column:id" json:"id" form:"id"`
397
+	UserOrgId       int64                   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
398
+	PartitionId     int64                   `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
399
+	BedId           int64                   `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
400
+	PatientId       int64                   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
401
+	ScheduleDate    int64                   `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
402
+	ScheduleType    int64                   `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
403
+	ScheduleWeek    int64                   `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
404
+	ModeId          int64                   `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
405
+	Status          int64                   `gorm:"column:status" json:"status" form:"status"`
406
+	CreatedTime     int64                   `gorm:"column:created_time" json:"created_time" form:"created_time"`
407
+	UpdatedTime     int64                   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
408
+	LastAfterWeight AssessmentAfterDislysis `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
408
 }
409
 }
409
 
410
 
410
 func (XtSchedule) TableName() string {
411
 func (XtSchedule) TableName() string {

+ 1 - 0
models/schedule_models.go 查看文件

197
 	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
197
 	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
198
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
198
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
199
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
199
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
200
+	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
200
 }
201
 }
201
 
202
 
202
 func (VmSchedulesRemind) TableName() string {
203
 func (VmSchedulesRemind) TableName() string {

+ 7 - 1
service/schedule_service.go 查看文件

609
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
609
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date =?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date =?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
611
 		return db.Where("status =1").Order("id asc")
611
 		return db.Where("status =1").Order("id asc")
612
+	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
613
+		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate)
612
 	}).Find(&list).Error
614
 	}).Find(&list).Error
613
 
615
 
614
 	return list, err
616
 	return list, err
634
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
636
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
635
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
637
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
636
 		return db.Where("status =1").Order("id asc")
638
 		return db.Where("status =1").Order("id asc")
639
+	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
640
+		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate)
637
 	}).Find(&list).Error
641
 	}).Find(&list).Error
638
 
642
 
639
 	return list, err
643
 	return list, err
987
 
991
 
988
 func GetNextWeekPanels(startime int64, endtime int64, orgid int64) (schedule []*models.XtSchedule, err error) {
992
 func GetNextWeekPanels(startime int64, endtime int64, orgid int64) (schedule []*models.XtSchedule, err error) {
989
 
993
 
990
-	err = XTReadDB().Model(&schedule).Where("schedule_date >=? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Find(&schedule).Error
994
+	err = XTReadDB().Model(&schedule).Where("schedule_date >=? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
995
+		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, endtime)
996
+	}).Find(&schedule).Error
991
 	return schedule, err
997
 	return schedule, err
992
 }
998
 }