瀏覽代碼

历史排班

28169 1 年之前
父節點
當前提交
b8c9d36719

+ 72 - 0
controllers/dialysis_api_controller.go 查看文件

@@ -115,6 +115,10 @@ func DialysisApiRegistRouters() {
115 115
 	beego.Router("/api/patient/savedialysisInformationsetting", &DialysisApiController{}, "Get:SaveDialysisInformationSetting")
116 116
 
117 117
 	beego.Router("/api/patient/getdialyisinformationsetting", &DialysisApiController{}, "Get:GetDialysisInformationSetting")
118
+
119
+	beego.Router("/api/patient/checkdialysisinformation", &DialysisApiController{}, "Get:CheckDialysisInformation")
120
+
121
+	beego.Router("/api/dialysis/patientsflow", &DialysisApiController{}, "Get:GetDialysisPatientsFlow")
118 122
 }
119 123
 
120 124
 func (c *DialysisApiController) GetQueueCall() {
@@ -6147,10 +6151,78 @@ func (this *DialysisApiController) GetDialysisInformationSetting() {
6147 6151
 
6148 6152
 	orgId := this.GetAdminUserInfo().CurrentOrgId
6149 6153
 
6154
+	limit, _ := this.GetInt64("limit")
6155
+	page, _ := this.GetInt64("page")
6150 6156
 	informationSetting, _ := service.GetDialysisInformationSetting(orgId)
6151 6157
 
6158
+	//未审核
6159
+	infor, total, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 2)
6160
+
6161
+	//已经审核
6162
+	inforList, totalOne, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 1)
6163
+
6164
+	patients, _ := service.GetAllpatientThirty(orgId)
6165
+
6166
+	appId := this.GetAdminUserInfo().CurrentAppId
6167
+	role, _ := service.GetAllDoctorListSix(orgId, appId)
6168
+
6152 6169
 	this.ServeSuccessJSON(map[string]interface{}{
6153 6170
 		"informaitonSetting": informationSetting,
6171
+		"infor":              infor,
6172
+		"total":              total,
6173
+		"totalOne":           totalOne,
6174
+		"inforList":          inforList,
6175
+		"patients":           patients,
6176
+		"adminList":          role,
6154 6177
 	})
6155 6178
 	return
6156 6179
 }
6180
+
6181
+func (this *DialysisApiController) CheckDialysisInformation() {
6182
+
6183
+	id, _ := this.GetInt64("id")
6184
+	application_status, _ := this.GetInt64("application_status")
6185
+	timeNow := time.Now().Unix()
6186
+	checker := this.GetAdminUserInfo().AdminUser.Id
6187
+	information, _ := service.CheckDialysisInformation(id, application_status, timeNow, checker)
6188
+	this.ServeSuccessJSON(map[string]interface{}{
6189
+		"information": information,
6190
+	})
6191
+	return
6192
+}
6193
+
6194
+func (this *DialysisApiController) GetDialysisPatientsFlow() {
6195
+
6196
+	page, _ := this.GetInt64("page", 1)
6197
+	limit, _ := this.GetInt64("limit", 10)
6198
+	schedulType, _ := this.GetInt64("schedul_type", 0)
6199
+	startTime, _ := this.GetInt64("schedul_time", 0)
6200
+	partitionType, _ := this.GetInt64("partition_type", 0)
6201
+	keywords := this.GetString("keywords")
6202
+	start_time, _ := this.GetInt64("start_time")
6203
+	end_time, _ := this.GetInt64("end_time")
6204
+	adminUserInfo := this.GetAdminUserInfo()
6205
+	if len(keywords) > 0 {
6206
+
6207
+		dialysisSchedule, err, total := service.GetDialysisWatchByKeywordFlow(adminUserInfo.CurrentOrgId, keywords, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6208
+		if err == nil {
6209
+			this.ServeSuccessJSON(map[string]interface{}{
6210
+				"schedule": dialysisSchedule,
6211
+				"total":    total,
6212
+			})
6213
+		} else {
6214
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6215
+		}
6216
+
6217
+	} else {
6218
+		dialysisSchedule, err, total := service.GetDialysisWatchFlow(adminUserInfo.CurrentOrgId, startTime/1000, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6219
+		if err == nil {
6220
+			this.ServeSuccessJSON(map[string]interface{}{
6221
+				"schedule": dialysisSchedule,
6222
+				"total":    total,
6223
+			})
6224
+		} else {
6225
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6226
+		}
6227
+	}
6228
+}

+ 7 - 0
controllers/mobile_api_controllers/mobile_api_base_controller.go 查看文件

@@ -143,6 +143,9 @@ func (this *MobileBaseAPIAuthController) Prepare() {
143 143
 
144 144
 			//redis key值
145 145
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
+			fmt.Println("ket--------------------", key)
147
+
148
+			redis.Set(key, "", time.Second)
146 149
 			purviews_json_str, _ := redis.Get(key).Result()
147 150
 			//获取该用户下所有角色的权限总集
148 151
 			var userRolePurviews string
@@ -152,10 +155,12 @@ func (this *MobileBaseAPIAuthController) Prepare() {
152 155
 			fmt.Println(purviews_json_str)
153 156
 			fmt.Println("----redis 结束----")
154 157
 
158
+			fmt.Println("purviews_json_str0000000000000000000000000000", len(purviews_json_str))
155 159
 			if len(purviews_json_str) == 0 {
156 160
 				for _, item := range roles {
157 161
 					role_id, _ := strconv.ParseInt(item, 10, 64)
158 162
 					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
163
+					fmt.Println("2333333333333333333", purviews)
159 164
 					if len(userRolePurviews) == 0 {
160 165
 						userRolePurviews = purviews
161 166
 					} else {
@@ -166,6 +171,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
166 171
 				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
167 172
 				//缓存数据
168 173
 				purview_json, err := json.Marshal(userRolePurviewsArr)
174
+				fmt.Println("errr-------------------", err)
169 175
 				if err == nil {
170 176
 					redis.Set(key, purview_json, time.Minute*60*60*24)
171 177
 				}
@@ -183,6 +189,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
183 189
 
184 190
 			//系统所记录的权限列表
185 191
 			allPermission, _ := service.GetAllFunctionPurview()
192
+			fmt.Println("allPermission-----------------------", allPermission)
186 193
 			for _, item := range allPermission {
187 194
 				//判断当前路由是否在权限路由列表里面
188 195
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 19 - 16
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -552,6 +552,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
552 552
 	origin, _ := c.GetInt64("origin", 0)
553 553
 	groupno, _ := c.GetInt64("groupno", -1)
554 554
 
555
+	fmt.Println("orgind===2=323322323232323", origin)
556
+	fmt.Println("groupno233333333333333333333", groupno)
555 557
 	if origin != 2 {
556 558
 		adminUserInfo := c.GetMobileAdminUserInfo()
557 559
 		execution_staff := adminUserInfo.AdminUser.Id
@@ -619,6 +621,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
619 621
 			UpdatedTime:    time.Now().Unix(),
620 622
 		}
621 623
 		var err error
624
+		fmt.Println("groupno==============", groupno)
622 625
 		if groupno > 0 {
623 626
 			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
624 627
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -1445,22 +1448,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1445 1448
 					}
1446 1449
 
1447 1450
 					//
1448
-					//if config.IsOpen == 1 && item.UserOrgId == 10088 {
1449
-					//
1450
-					//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1451
-					//	//更新字典里面的库存
1452
-					//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1453
-					//	var sum_count int64
1454
-					//	for _, its := range stockInfo {
1455
-					//		if its.MaxUnit == medical.MaxUnit {
1456
-					//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1457
-					//		}
1458
-					//		sum_count += its.StockMaxNumber + its.StockMinNumber
1459
-					//	}
1460
-					//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1461
-					//	//剩余库存
1462
-					//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1463
-					//}
1451
+					if config.IsOpen == 1 && item.UserOrgId == 10028 {
1452
+
1453
+						service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1454
+						//更新字典里面的库存
1455
+						stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1456
+						var sum_count int64
1457
+						for _, its := range stockInfo {
1458
+							if its.MaxUnit == medical.MaxUnit {
1459
+								its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1460
+							}
1461
+							sum_count += its.StockMaxNumber + its.StockMinNumber
1462
+						}
1463
+						service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1464
+						//剩余库存
1465
+						service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1466
+					}
1464 1467
 
1465 1468
 				}
1466 1469
 			}

+ 13 - 0
controllers/patient_api_controller.go 查看文件

@@ -1666,6 +1666,19 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1666 1666
 	advice.PatientId = patient
1667 1667
 	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1668 1668
 
1669
+	if advice.UserOrgId == 3877 || advice.UserOrgId == 10340 || advice.UserOrgId == 9671 {
1670
+		if advice.PrescribingNumber == 0 {
1671
+			advice.PrescribingNumber = 1
1672
+		}
1673
+		//查询该患者今日有没有双人核对
1674
+		check, _ := service.MobileGetDoubleCheckSix(advice.UserOrgId, patientInfo.ID, advice.AdviceDate)
1675
+
1676
+		if check.ID > 0 {
1677
+			advice.Checker = check.Modifier
1678
+			advice.CheckState = 1
1679
+			advice.CheckTime = time.Now().Unix()
1680
+		}
1681
+	}
1669 1682
 	err := service.CreateDoctorAdvice(&advice)
1670 1683
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1671 1684
 	redis := service.RedisClient()

+ 63 - 0
models/dialysis.go 查看文件

@@ -1487,3 +1487,66 @@ type XtDialysisInformaitonSetting struct {
1487 1487
 func (XtDialysisInformaitonSetting) TableName() string {
1488 1488
 	return "xt_dialysis_informaiton_setting"
1489 1489
 }
1490
+
1491
+type DialysisInformation struct {
1492
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
1493
+	Module            int64  `gorm:"column:module" json:"module" form:"module"`
1494
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1495
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1496
+	ApplicationDate   int64  `gorm:"column:application_date" json:"application_date" form:"application_date"`
1497
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
1498
+	ApplicationStatus int64  `gorm:"column:application_status" json:"application_status" form:"application_status"`
1499
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
1500
+	CheckTime         int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
1501
+	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
1502
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1503
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1504
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
1505
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1506
+}
1507
+
1508
+func (DialysisInformation) TableName() string {
1509
+	return "xt_dialysis_information"
1510
+}
1511
+
1512
+type DialysisScheduleFlow struct {
1513
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1514
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1515
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1516
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1517
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1518
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1519
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1520
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1521
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1522
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1523
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
1524
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1525
+
1526
+	MonitorPatients *MonitorPatients `gorm:"ForeignKey:PatientId" json:"patient"`
1527
+	DeviceNumber    *DeviceNumber    `gorm:"ForeignKey:BedId" json:"device_number"`
1528
+	DeviceZone      *DeviceZone      `gorm:"ForeignKey:PartitionId" json:"device_zone"`
1529
+	TreatmentMode   *TreatmentMode   `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
1530
+	DialysisFinish  *DialysisFinish  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId" json:"dialysis_finish"`
1531
+}
1532
+
1533
+func (DialysisScheduleFlow) TableName() string {
1534
+	return "xt_schedule"
1535
+}
1536
+
1537
+type DialysisFinish struct {
1538
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1539
+	IsFinish   int64 `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`
1540
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1541
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
1542
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1543
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1544
+	Module     int64 `gorm:"column:module" json:"module" form:"module"`
1545
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1546
+	Sourse     int64 `gorm:"column:sourse" json:"sourse" form:"sourse"`
1547
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1548
+}
1549
+
1550
+func (DialysisFinish) TableName() string {
1551
+	return "xt_dialysis_finish"
1552
+}

+ 2 - 0
models/patient_models.go 查看文件

@@ -1602,6 +1602,7 @@ type VmDialysisSolutionOne struct {
1602 1602
 	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1603 1603
 	ModeName                   string `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
1604 1604
 	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1605
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
1605 1606
 }
1606 1607
 
1607 1608
 func (VmDialysisSolutionOne) TableName() string {
@@ -1634,6 +1635,7 @@ type XtScheduleList struct {
1634 1635
 	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1635 1636
 	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1636 1637
 	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1638
+	Status           int64              `gorm:"column:status" json:"status" form:"status"`
1637 1639
 }
1638 1640
 
1639 1641
 func (XtScheduleList) TableName() string {

+ 4 - 3
models/schedule_models.go 查看文件

@@ -74,9 +74,10 @@ type ScheduleTwo struct {
74 74
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
75 75
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
76 76
 
77
-	Patient                   string               `gorm:"-" json:"patient" form:"patient"`
78
-	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
-	DialysisMachineName       string               `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
77
+	Patient                   string                `gorm:"-" json:"patient" form:"patient"`
78
+	PatientInfectiousDiseases []InfectiousDiseases  `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
+	DialysisMachineName       string                `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
80
+	DialysisSolution          VmDialysisSolutionOne `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
80 81
 }
81 82
 
82 83
 func (ScheduleTwo) TableName() string {

+ 105 - 1
service/dialysis_service.go 查看文件

@@ -2020,7 +2020,7 @@ func FindAllDoctorAdviceByIds(orgID int64, ids []string) (advice []models.Doctor
2020 2020
 }
2021 2021
 
2022 2022
 func ExectionBloodMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
2023
-	fmt.Println("ids2323232323323223233223wode", ids)
2023
+
2024 2024
 	advice := models.DoctorAdviceThrity{}
2025 2025
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
2026 2026
 	return err
@@ -2135,3 +2135,107 @@ func GetDialysisInformationSetting(user_org_id int64) (infor []*models.XtDialysi
2135 2135
 
2136 2136
 	return infor, err
2137 2137
 }
2138
+
2139
+func GetDialysisInformationIsNoCheck(user_org_id int64, limit int64, page int64, application_status int64) (infor []*models.DialysisInformation, total int64, err error) {
2140
+
2141
+	db := XTReadDB().Model(&infor).Where("status= 1")
2142
+	if application_status > 0 {
2143
+		db = db.Where("application_status = ?", application_status)
2144
+	}
2145
+	if user_org_id > 0 {
2146
+		db = db.Where("user_org_id = ?", user_org_id)
2147
+	}
2148
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Find(&infor).Error
2149
+	return infor, total, err
2150
+}
2151
+
2152
+func CheckDialysisInformation(id int64, application_status int64, timenow int64, checker int64) (models.DialysisInformation, error) {
2153
+
2154
+	information := models.DialysisInformation{}
2155
+
2156
+	err := XTWriteDB().Model(&information).Where("id=? and status = 1", id).Updates(map[string]interface{}{"application_status": application_status, "check_time": timenow, "checker": checker}).Error
2157
+
2158
+	return information, err
2159
+
2160
+}
2161
+
2162
+func GetDialysisWatchByKeywordFlow(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) ([]*models.DialysisScheduleFlow, error, int64) {
2163
+	var patients []*models.Patients
2164
+	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
2165
+	if getPatientErr != nil {
2166
+		return nil, getPatientErr, 0
2167
+	}
2168
+	patientIDs := make([]int64, len(patients))
2169
+	for index, patient := range patients {
2170
+		patientIDs[index] = patient.ID
2171
+	}
2172
+
2173
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2174
+	if start > 0 && end > 0 {
2175
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2176
+			// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
2177
+			Preload("TreatmentMode", "status = 1").
2178
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date >= ? and record_date<=?", orgID, start, end).
2179
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2180
+	} else {
2181
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2182
+			Preload("TreatmentMode", "status = 1").
2183
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ?", orgID).
2184
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2185
+	}
2186
+
2187
+	db = db.Where("xt_schedule.status = 1 AND patient_id in (?)", patientIDs)
2188
+	if schedulType > 0 {
2189
+		db = db.Where("schedule_type = ?", schedulType)
2190
+	}
2191
+	if start > 0 {
2192
+		db = db.Where("schedule_date >= ?", start)
2193
+	}
2194
+	if end > 0 {
2195
+		db = db.Where("schedule_date<=?", end)
2196
+	}
2197
+	if partitionType > 0 {
2198
+		db = db.Joins("inner join xt_device_number as d_n on d_n.id = xt_schedule.bed_id and d_n.zone_id = ?", partitionType)
2199
+	}
2200
+	var schedules []*models.DialysisScheduleFlow
2201
+	total := int64(0)
2202
+	err := db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("schedule_date desc").Find(&schedules).Error
2203
+	return schedules, err, total
2204
+}
2205
+
2206
+func GetDialysisWatchFlow(orgID int64, schedulDate int64, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) (schedule []*models.DialysisScheduleFlow, err error, total int64) {
2207
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2208
+	if start > 0 && end > 0 {
2209
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2210
+			Preload("TreatmentMode", "status = 1").
2211
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, start, end).
2212
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2213
+		db = db.Where("xt_schedule.status = 1")
2214
+	}
2215
+	if schedulDate > 0 {
2216
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2217
+			Preload("TreatmentMode", "status = 1").
2218
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date>=? and record_date<=?", orgID, schedulDate, schedulDate).
2219
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2220
+		db = db.Where("xt_schedule.status = 1")
2221
+		db = db.Where("schedule_date = ?", schedulDate)
2222
+	}
2223
+	if schedulType > 0 {
2224
+		db = db.Where("schedule_type = ?", schedulType)
2225
+	}
2226
+	if start > 0 {
2227
+		db = db.Where("schedule_date >= ?", start)
2228
+	}
2229
+	if end > 0 {
2230
+		db = db.Where("schedule_date <= ?", end)
2231
+	}
2232
+	if orgID > 0 {
2233
+		db = db.Where("user_org_id = ?", orgID)
2234
+	}
2235
+	if partitionType > 0 {
2236
+		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ?", partitionType)
2237
+	}
2238
+	offset := (page - 1) * limit
2239
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("bed_id desc").Find(&schedule).Error
2240
+	return schedule, err, total
2241
+}

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

@@ -168,6 +168,7 @@ func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, schedu
168 168
 		db = db.Where("s.schedule_week in(?)", WeekDayIds)
169 169
 	}
170 170
 	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
171
+		Preload("DialysisSolution", "status= 1 and solution_status = 1").
171 172
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
172 173
 		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
173 174
 		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").