ソースを参照

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 1 年間 前
コミット
f1747abd5f

+ 44 - 0
controllers/patient_api_controller.go ファイルの表示

@@ -82,6 +82,50 @@ func PatientApiRegistRouters() {
82 82
 	beego.Router("/api/patient/findepatientdialysislongsolutions", &PatientApiController{}, "Get:GetPatientDialysisLongSolution")
83 83
 	beego.Router("/api/patient/getdialysissolutiondetaillist", &PatientApiController{}, "Get:GetDialysisSolutionDetailList")
84 84
 
85
+	beego.Router("/api/patient/getexportlist", &PatientApiController{}, "Get:GetExportList")
86
+
87
+}
88
+func (c *PatientApiController) GetExportList() {
89
+	startTime := c.GetString("start_time")
90
+	endTime := c.GetString("end_time")
91
+	schedulType, _ := c.GetInt64("schedul_type", 0)
92
+	timeLayout := "2006-01-02"
93
+	loc, _ := time.LoadLocation("Local")
94
+
95
+	adminUserInfo := c.GetAdminUserInfo()
96
+	var theStartTIme int64
97
+	if len(startTime) > 0 {
98
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
99
+		if err != nil {
100
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
101
+			return
102
+		}
103
+
104
+		theStartTIme = theTime.Unix()
105
+	}
106
+
107
+	var theEndtTIme int64
108
+	if len(endTime) > 0 {
109
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
110
+		if err != nil {
111
+			utils.ErrorLog(err.Error())
112
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
113
+			return
114
+		}
115
+
116
+		theEndtTIme = theTime.Unix()
117
+	}
118
+	timeNowStr := time.Now().Format("2006-01-02")
119
+	timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
120
+	schedule, _ := service.GetPatientScheudleListTwenty(adminUserInfo.CurrentOrgId, schedulType, theStartTIme, theEndtTIme, timeNewDate.Unix())
121
+	fmt.Println("schedule23333333333333333", schedule)
122
+	patientsList, _ := service.GetAllpatient(adminUserInfo.CurrentOrgId)
123
+
124
+	c.ServeSuccessJSON(map[string]interface{}{
125
+		"schedule":     schedule,
126
+		"patientsList": patientsList,
127
+	})
128
+	return
85 129
 }
86 130
 
87 131
 // GetPatientsList 取患者列表

+ 73 - 1
controllers/schedule_api_controller.go ファイルの表示

@@ -62,6 +62,7 @@ func ScheduleApiRegistRouters() {
62 62
 	beego.Router("/api/schedule/weekpanelone", &ScheduleApiController{}, "Get:GetWeekPanelsOne")
63 63
 	beego.Router("/api/schedule/schedulesone", &ScheduleApiController{}, "Get:GetScheduleOne")
64 64
 	beego.Router("/api/schedule/scheduletwo", &ScheduleApiController{}, "Get:GetScheduleTwo")
65
+	beego.Router("/api/schedule/getschedulethreeone", &ScheduleApiController{}, "Get:GetScheduleThreeList")
65 66
 	beego.Router("/api/schedule/postscheduletemplate", &ScheduleApiController{}, "Get:SaveScheduleTemplate")
66 67
 	beego.Router("/api/schedule/getscheduletemplate", &ScheduleApiController{}, "Get:GetScheduleTemplate")
67 68
 	beego.Router("/api/order/changefuncprint", &ScheduleApiController{}, "Get:ChangeFuncPrint")
@@ -4585,9 +4586,80 @@ func (c *ScheduleApiController) GetScheduleTwo() {
4585 4586
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4586 4587
 	weekStartPoint := theStarTime.Unix()
4587 4588
 	weekEndPoint := theEndTime.Unix()
4588
-
4589 4589
 	schdules, _ := service.GetWeekScheduleThree(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type, WeekDayIds)
4590
+	c.ServeSuccessJSON(map[string]interface{}{
4591
+		"days":      days,
4592
+		"weekTitle": weekTitle,
4593
+		"schdules":  schdules,
4594
+		"today":     today,
4595
+	})
4596
+	return
4597
+}
4598
+
4599
+func (c *ScheduleApiController) GetScheduleThreeList() {
4600
+
4601
+	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4602
+
4603
+	patitionIdStr := c.GetString("patitionid")
4604
+
4605
+	ids := strings.Split(patitionIdStr, ",")
4606
+
4607
+	schedule_type, _ := c.GetInt64("schedule_type")
4590 4608
 
4609
+	adminInfo := c.GetAdminUserInfo()
4610
+	weekDateStr := c.GetString("week_date")
4611
+
4612
+	WeekDayIds := strings.Split(weekDateStr, ",")
4613
+
4614
+	thisTime := time.Now()
4615
+	today := thisTime.Format("2006-01-02")
4616
+	if week < 1 || week > 4 {
4617
+		week = 2
4618
+	}
4619
+	if week == 1 {
4620
+		thisTime = thisTime.AddDate(0, 0, -7)
4621
+	} else if week == 3 {
4622
+		thisTime = thisTime.AddDate(0, 0, 7)
4623
+	} else if week == 4 {
4624
+		thisTime = thisTime.AddDate(0, 0, 14)
4625
+	}
4626
+
4627
+	weekDay := int(thisTime.Weekday())
4628
+	if weekDay == 0 {
4629
+		weekDay = 7
4630
+	}
4631
+	weekEnd := 7 - weekDay
4632
+	weekStart := weekEnd - 6
4633
+	weekTitle := make([]string, 0)
4634
+	days := make([]string, 0)
4635
+	for index := weekStart; index <= weekEnd; index++ {
4636
+		theDay := thisTime.AddDate(0, 0, index)
4637
+		indexYear, indexMonthTime, indexDay := theDay.Date()
4638
+		indexMonth := int(indexMonthTime)
4639
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
4640
+		weekTitle = append(weekTitle, indexWeek)
4641
+		days = append(days, theDay.Format("2006-01-02"))
4642
+	}
4643
+
4644
+	weekStartDay := thisTime.AddDate(0, 0, weekStart)
4645
+	weekEndDay := thisTime.AddDate(0, 0, weekEnd)
4646
+	weekStartTime := weekStartDay.Format("2006-01-02") + " 00:00:00"
4647
+	weekEndTime := weekEndDay.Format("2006-01-02") + " 23:59:59"
4648
+
4649
+	timeLayout := "2006-01-02 15:04:05"
4650
+	loc, _ := time.LoadLocation("Local")
4651
+	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
4652
+	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4653
+	weekStartPoint := theStarTime.Unix()
4654
+	weekEndPoint := theEndTime.Unix()
4655
+	schdules, _ := service.GetWeekScheduleFour(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type, WeekDayIds)
4656
+
4657
+	if len(schdules) > 0 {
4658
+		for _, item := range schdules {
4659
+			listObj, _ := service.GetNextScheduleByList(item.PatientId, item.ScheduleDate, item.UserOrgId)
4660
+			item.SchedulePatientsOne = listObj
4661
+		}
4662
+	}
4591 4663
 	c.ServeSuccessJSON(map[string]interface{}{
4592 4664
 		"days":      days,
4593 4665
 		"weekTitle": weekTitle,

+ 84 - 38
controllers/sign_api_controller.go ファイルの表示

@@ -8,6 +8,7 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jung-kurt/gofpdf"
11
+	"github.com/mozillazg/go-pinyin"
11 12
 	"io/ioutil"
12 13
 	"time"
13 14
 )
@@ -88,6 +89,8 @@ func SignApiRegistRouters() {
88 89
 
89 90
 	beego.Router("/api/device/toautodrug", &SignApiController{}, "Get:ToAutoDrug")
90 91
 
92
+	beego.Router("/api/device/toautodiagnose", &SignApiController{}, "Get:ToAutoDiagnose")
93
+
91 94
 }
92 95
 
93 96
 // 短信服务接口
@@ -660,32 +663,32 @@ func (this *SignApiController) GetEnterPriseDetail() {
660 663
 func (this *SignApiController) UploadPrintOrder() {
661 664
 
662 665
 	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
663
-	//list, _ := service.GetAllPatientNew(10567)
664
-	//for _, item := range list {
665
-	//
666
-	//	hans := item.Name // 要转换的汉字字符串
667
-	//	// 创建一个拼音转换器
668
-	//	p := pinyin.NewArgs()
669
-	//
670
-	//	// 将汉字转为拼音
671
-	//	pinyinSlice := pinyin.Pinyin(hans, p)
672
-	//
673
-	//	// 输出拼音
674
-	//	fmt.Println("Pinyin:", pinyinSlice)
675
-	//
676
-	//	// 获取首字母
677
-	//	firstLetter := ""
678
-	//	for _, py := range pinyinSlice {
679
-	//		if len(py) > 0 {
680
-	//			firstLetter += string(py[0][0])
681
-	//		}
682
-	//	}
683
-	//
684
-	//	item.FirstLetter = firstLetter
685
-	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
686
-	//	// 输出首字母
687
-	//	//fmt.Println("First Letter:", firstLetter)
688
-	//}
666
+	list, _ := service.GetAllPatientNew(10587)
667
+	for _, item := range list {
668
+
669
+		hans := item.Name // 要转换的汉字字符串
670
+		// 创建一个拼音转换器
671
+		p := pinyin.NewArgs()
672
+
673
+		// 将汉字转为拼音
674
+		pinyinSlice := pinyin.Pinyin(hans, p)
675
+
676
+		// 输出拼音
677
+		fmt.Println("Pinyin:", pinyinSlice)
678
+
679
+		// 获取首字母
680
+		firstLetter := ""
681
+		for _, py := range pinyinSlice {
682
+			if len(py) > 0 {
683
+				firstLetter += string(py[0][0])
684
+			}
685
+		}
686
+
687
+		item.FirstLetter = firstLetter
688
+		service.UpdatePatientNew(item.ID, item.FirstLetter)
689
+		// 输出首字母
690
+		//fmt.Println("First Letter:", firstLetter)
691
+	}
689 692
 
690 693
 	//baseList, _ := service.GeteAllBaseList(10567)
691 694
 	//for _, item := range baseList {
@@ -1158,28 +1161,71 @@ func (this *SignApiController) ToAutoDrug() {
1158 1161
 	//	}
1159 1162
 	//}
1160 1163
 
1161
-	prescriptionList, _ := service.GetAllPrescriptionList(10579)
1164
+	//prescriptionList, _ := service.GetAllPrescriptionList(10579)
1162 1165
 
1163
-	for _, item := range prescriptionList {
1166
+	list, _ := service.GetScheduleListByOrder(10579)
1167
+
1168
+	for _, item := range list {
1169
+		soluton, _ := service.GetDialysisSoluton(item.PatientId, item.ModeId)
1164 1170
 		var DialysisMachineName string
1165
-		if len(item.DialysisDialyszers) > 0 {
1166
-			DialysisMachineName = item.DialysisDialyszers
1167
-		}
1168
-		if len(item.DialyzerPerfusionApparatus) > 0 {
1169
-			DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
1171
+		if len(soluton.DialysisDialyszers) > 0 {
1172
+			DialysisMachineName = soluton.DialysisDialyszers
1170 1173
 		}
1174
+		//if len(soluton.DialyzerPerfusionApparatus) > 0 {
1175
+		//	DialysisMachineName = DialysisMachineName + "," + soluton.DialyzerPerfusionApparatus
1176
+		//}
1171 1177
 
1172
-		if len(item.DialysisIrrigation) > 0 {
1173
-			DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
1178
+		if len(soluton.DialysisIrrigation) > 0 {
1179
+			DialysisMachineName = DialysisMachineName + "," + soluton.DialysisIrrigation
1174 1180
 		}
1175 1181
 
1176
-		if len(item.DialysisStrainer) > 0 {
1177
-			DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
1182
+		if len(soluton.DialysisStrainer) > 0 {
1183
+			DialysisMachineName = DialysisMachineName + "," + soluton.DialysisStrainer
1178 1184
 		}
1179 1185
 		DialysisMachineName = DialysisMachineName
1180
-		service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
1186
+
1187
+		service.UpdateDialysisSchedule(item.ID, DialysisMachineName)
1181 1188
 	}
1189
+
1190
+	//for _, item := range prescriptionList {
1191
+	//	var DialysisMachineName string
1192
+	//	if len(item.DialysisDialyszers) > 0 {
1193
+	//		DialysisMachineName = item.DialysisDialyszers
1194
+	//	}
1195
+	//	if len(item.DialyzerPerfusionApparatus) > 0 {
1196
+	//		DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
1197
+	//	}
1198
+	//
1199
+	//	if len(item.DialysisIrrigation) > 0 {
1200
+	//		DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
1201
+	//	}
1202
+	//
1203
+	//	if len(item.DialysisStrainer) > 0 {
1204
+	//		DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
1205
+	//	}
1206
+	//	DialysisMachineName = DialysisMachineName
1207
+	//	service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
1208
+	//}
1182 1209
 	this.ServeSuccessJSON(map[string]interface{}{
1183 1210
 		"msg": "ok",
1184 1211
 	})
1185 1212
 }
1213
+
1214
+func (this *SignApiController) ToAutoDiagnose() {
1215
+
1216
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1217
+	list, _ := service.GetNewAllpatient(orgId)
1218
+
1219
+	for _, item := range list {
1220
+		service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1221
+	}
1222
+
1223
+	//list, _ := service.GetAllDialysisOrder(10579)
1224
+	//for _, item := range list {
1225
+	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
1226
+	//}
1227
+	//this.ServeSuccessJSON(map[string]interface{}{
1228
+	//	"msg": "ok",
1229
+	//})
1230
+
1231
+}

+ 23 - 0
models/device_models.go ファイルの表示

@@ -522,6 +522,29 @@ func (XtSchedule) TableName() string {
522 522
 	return "xt_schedule"
523 523
 }
524 524
 
525
+type ScheduleTen struct {
526
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
527
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
528
+	PartitionId         int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
529
+	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
530
+	PatientId           int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
531
+	ScheduleDate        int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
532
+	ScheduleType        int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
533
+	ScheduleWeek        int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
534
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
535
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
536
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
537
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
538
+	IsExport            int64  `gorm:"column:is_export" json:"is_export" form:"is_export"`
539
+	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
540
+	Remark              string `gorm:"column:remark" json:"remark" form:"remark"`
541
+}
542
+
543
+func (ScheduleTen) TableName() string {
544
+
545
+	return "xt_schedule"
546
+}
547
+
525 548
 type DeviceInformationss struct {
526 549
 	ID                    int64  `gorm:"column:id" json:"id" form:"id"`
527 550
 	Date                  int64  `gorm:"column:date" json:"date" form:"date"`

+ 45 - 0
models/schedule_models.go ファイルの表示

@@ -84,6 +84,51 @@ func (ScheduleTwo) TableName() string {
84 84
 	return "xt_schedule"
85 85
 }
86 86
 
87
+type ScheduleThree struct {
88
+	ID                  int64                 `gorm:"column:id" json:"id" form:"id"`
89
+	UserOrgId           int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
90
+	PartitionId         int64                 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
91
+	BedId               int64                 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
92
+	PatientId           int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
93
+	ScheduleDate        int64                 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
94
+	ScheduleType        int64                 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
95
+	ScheduleWeek        int64                 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
96
+	ModeId              int64                 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
97
+	Status              int64                 `gorm:"column:status" json:"status" form:"status"`
98
+	CreatedTime         int64                 `gorm:"column:created_time" json:"created_time" form:"created_time"`
99
+	UpdatedTime         int64                 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
100
+	IsExport            int64                 `gorm:"column:is_export" json:"is_export" form:"is_export"`
101
+	Patient             string                `gorm:"-" json:"patient" form:"patient"`
102
+	DialysisMachineName string                `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
103
+	DialysisSolution    VmDialysisSolutionOne `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
104
+	SchedulePatientsOne SchedulePatientsOne   `json:"next_schedule" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
105
+	DeviceNumber        DeviceNumber          `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
106
+}
107
+
108
+func (ScheduleThree) TableName() string {
109
+	return "xt_schedule"
110
+}
111
+
112
+type SchedulePatientsOne struct {
113
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
114
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
115
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
116
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
117
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
118
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
119
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
120
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
121
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
122
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
123
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
124
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
125
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
126
+}
127
+
128
+func (SchedulePatientsOne) TableName() string {
129
+	return "xt_schedule"
130
+}
131
+
87 132
 type SchedulePatients struct {
88 133
 	ID           int64              `gorm:"column:id" json:"id" form:"id"`
89 134
 	UserOrgId    int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 25 - 0
service/patient_service.go ファイルの表示

@@ -3315,3 +3315,28 @@ func GetAllPrescriptionList(org_id int64) (prescription []*models.DialysisPrescr
3315 3315
 
3316 3316
 	return prescription, err
3317 3317
 }
3318
+
3319
+func GetPatientScheudleListTwenty(org_id int64, scheduel_type int64, startime int64, endtime int64, schedule_date int64) (schedule []*models.ScheduleTen, err error) {
3320
+
3321
+	db := XTReadDB().Model(&schedule).Where("status= 1")
3322
+	if org_id > 0 {
3323
+		db = db.Where("user_org_id = ?", org_id)
3324
+	}
3325
+	if scheduel_type > 0 {
3326
+		db = db.Where("schedule_type =?", scheduel_type)
3327
+	}
3328
+	if startime > 0 {
3329
+		db = db.Where("schedule_date >=?", startime)
3330
+	}
3331
+	if endtime > 0 {
3332
+		db = db.Where("schedule_date <=?", endtime)
3333
+	}
3334
+
3335
+	if startime == 0 && endtime == 0 {
3336
+		db = db.Where("schedule_date = ?", schedule_date)
3337
+	}
3338
+
3339
+	err = db.Find(&schedule).Error
3340
+	fmt.Println("err2330230320202023", err)
3341
+	return schedule, err
3342
+}

+ 30 - 0
service/schedule_service.go ファイルの表示

@@ -177,6 +177,29 @@ func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, schedu
177 177
 	return
178 178
 }
179 179
 
180
+func GetWeekScheduleFour(orgID int64, start, end int64, schIds []string, scheduletype int64, WeekDayIds []string) (schedules []*models.ScheduleThree, err error) {
181
+
182
+	db := readDb.Table("xt_schedule as s")
183
+
184
+	if len(schIds) > 0 {
185
+		db = db.Where("s.partition_id in (?)", schIds)
186
+	}
187
+	if scheduletype > 0 {
188
+		db = db.Where("s.schedule_type = ?", scheduletype)
189
+	}
190
+	if len(WeekDayIds) > 0 {
191
+		db = db.Where("s.schedule_week in(?)", WeekDayIds)
192
+	}
193
+	err = db.Preload("DeviceNumber", "status = 1 and org_id =?", orgID).
194
+		Preload("DialysisSolution", "status= 1 and solution_status = 1").
195
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
196
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
197
+		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,s.dialysis_machine_name, p.name as patient").
198
+		Order("updated_time asc").
199
+		Find(&schedules).Error
200
+	return
201
+}
202
+
180 203
 func GetDaySchedule(orgID, start, end, patientID int64) (schedule models.Schedule, err error) {
181 204
 	err = readDb.Model(&models.Schedule{}).Where("user_org_id=? and patient_id=? and schedule_date>=? and schedule_date<=? and status=1", orgID, patientID, start, end).First(&schedule).Error
182 205
 	return
@@ -217,6 +240,13 @@ func GetNextSchedule(orgID, end, patientID int64) (schedules []*models.PatientSc
217 240
 	return
218 241
 }
219 242
 
243
+func GetNextScheduleByList(patient_id int64, schedule_date int64, user_org_id int64) (models.SchedulePatientsOne, error) {
244
+
245
+	patientsOne := models.SchedulePatientsOne{}
246
+	err := XTReadDB().Where("patient_id = ? and schedule_date >? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).First(&patientsOne).Error
247
+	return patientsOne, err
248
+}
249
+
220 250
 func GetPointSchedule(orgID, scheduleDate, scheduleWeek, scheduleType, bedId int64) (schedule models.Schedule, err error) {
221 251
 	err = readDb.Model(&models.Schedule{}).Where("user_org_id=? and schedule_date=? and bed_id=? and schedule_week=? AND schedule_type=? and status=1", orgID, scheduleDate, bedId, scheduleWeek, scheduleType).First(&schedule).Error
222 252
 

+ 45 - 0
service/sign_service.go ファイルの表示

@@ -2096,3 +2096,48 @@ func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64,
2096 2096
 	err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id =? and schedule_date =? and user_org_id =?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"dialysis_machine_name": DialysisMachineName}).Error
2097 2097
 	return err
2098 2098
 }
2099
+
2100
+func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2101
+
2102
+	err = XTReadDB().Where("status =1 and user_org_id =9990").Find(&list).Error
2103
+
2104
+	return list, err
2105
+}
2106
+
2107
+func UpdateAllPatient(id int64, diagose string, orgid int64) error {
2108
+
2109
+	err := XTWriteDB().Model(models.XtPatients{}).Where("id = ? and user_org_id = ?", id, orgid).Updates(map[string]interface{}{"diagnose": diagose}).Error
2110
+	return err
2111
+}
2112
+
2113
+func GetAllDialysisOrder(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2114
+
2115
+	err = XTReadDB().Where("user_org_id = ? and dialysis_date =?", 10579, 1701360000).Find(&list).Error
2116
+
2117
+	return list, err
2118
+}
2119
+
2120
+func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) error {
2121
+
2122
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("schedule_date =? and user_org_id =? and status=1 and patient_id =?", schedule_date, user_org_id, patient_id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type}).Error
2123
+	return err
2124
+}
2125
+
2126
+func GetScheduleListByOrder(user_org_id int64) (list []*models.XtSchedule, err error) {
2127
+
2128
+	err = XTReadDB().Where("user_org_id = ? and schedule_date >=? and status =1 and schedule_date<=?", 10579, 1703260800, 1703347200).Find(&list).Error
2129
+	return list, err
2130
+}
2131
+
2132
+func GetDialysisSoluton(patient_id int64, mode_id int64) (models.DialysisSolution, error) {
2133
+
2134
+	solution := models.DialysisSolution{}
2135
+	err := XTReadDB().Where("patient_id =? and mode_id =? and status =1 and solution_status = 1", patient_id, mode_id).Find(&solution).Error
2136
+	return solution, err
2137
+}
2138
+
2139
+func UpdateDialysisSchedule(id int64, dialysis_machine_name string) error {
2140
+
2141
+	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
2142
+	return err
2143
+}