瀏覽代碼

历史排班

28169 3 週之前
父節點
當前提交
eb9caadfeb

二進制
XT_New.exe 查看文件


+ 8 - 7
controllers/base_api_controller.go 查看文件

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

+ 7 - 6
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -1,15 +1,9 @@
1 1
 package mobile_api_controllers
2 2
 
3 3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8 4
 	"encoding/json"
9 5
 	"errors"
10 6
 	"fmt"
11
-	"github.com/astaxie/beego"
12
-	"github.com/jinzhu/gorm"
13 7
 	"math"
14 8
 	"net/http"
15 9
 	"net/url"
@@ -17,6 +11,13 @@ import (
17 11
 	"strconv"
18 12
 	"strings"
19 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 23
 // type DialysisTestAPIController struct {

+ 45 - 63
controllers/new_mobile_api_controllers/new_manage_api_controller.go 查看文件

@@ -1,15 +1,16 @@
1 1
 package new_mobile_api_controllers
2 2
 
3 3
 import (
4
+	"fmt"
5
+	"strconv"
6
+	"time"
7
+
4 8
 	"XT_New/controllers/mobile_api_controllers"
5 9
 	"XT_New/enums"
6 10
 	"XT_New/models"
7 11
 	"XT_New/service"
8 12
 	"XT_New/utils"
9
-	"fmt"
10 13
 	"github.com/jinzhu/gorm"
11
-	"strconv"
12
-	"time"
13 14
 )
14 15
 
15 16
 type NewManageApiController struct {
@@ -160,69 +161,50 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
160 161
 		this.ServeSuccessJSON(returnData)
161 162
 		return
162 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 201
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
224 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 查看文件

@@ -1,18 +1,19 @@
1 1
 package new_mobile_api_controllers
2 2
 
3 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 4
 	"encoding/json"
10 5
 	"fmt"
11
-	"github.com/jinzhu/gorm"
12 6
 	"reflect"
13 7
 	"strconv"
14 8
 	"strings"
15 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 19
 type StaffScheduleApiController struct {
@@ -1506,3 +1507,15 @@ func (c *StaffScheduleApiController) UpdateMobileSchedule() {
1506 1507
 	})
1507 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 查看文件

@@ -38,4 +38,6 @@ func StaffScheduleApiControllersRegisterRouters() {
38 38
 
39 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 查看文件

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

+ 7 - 6
controllers/self_drug_api_congtroller.go 查看文件

@@ -1,18 +1,19 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8 4
 	"encoding/json"
9 5
 	"fmt"
10
-	"github.com/astaxie/beego"
11
-	"github.com/jinzhu/gorm"
12 6
 	"reflect"
13 7
 	"strconv"
14 8
 	"strings"
15 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 19
 type SelfDrugApiController struct {

+ 12 - 3
service/manage_service.go 查看文件

@@ -1,11 +1,12 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7 5
 	"strings"
8 6
 	"time"
7
+
8
+	"XT_New/models"
9
+	"github.com/jinzhu/gorm"
9 10
 )
10 11
 
11 12
 func GetEquitmentName(unit_type string, orgid int64) (*models.DeviceEquimentname, error) {
@@ -1240,6 +1241,14 @@ func GetPatientOrderInfo(schduledate int64, patientid int64, orgid int64) (model
1240 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 1252
 func CreateInformationTwo(information *models.DeviceInformation) error {
1244 1253
 	err := UserWriteDB().Create(&information).Error
1245 1254
 	return err
@@ -1247,7 +1256,7 @@ func CreateInformationTwo(information *models.DeviceInformation) error {
1247 1256
 
1248 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 1260
 	return err
1252 1261
 }
1253 1262
 

+ 12 - 8
service/schedule_service.go 查看文件

@@ -1,12 +1,13 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
6 5
 	"strconv"
7 6
 	"strings"
8 7
 	"time"
9 8
 
9
+	"XT_New/models"
10
+
10 11
 	"github.com/jinzhu/gorm"
11 12
 )
12 13
 
@@ -20,10 +21,6 @@ func GetSchedulePartitionPanel(orgID int64) (partitions []*models.Partition, err
20 21
 
21 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 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,10 +974,10 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
977 974
 
978 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 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 978
 		return db.Where("status =1 and solution_status = 1").Order("id asc")
982 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 981
 	}).Find(&list).Error
985 982
 
986 983
 	return list, err
@@ -1007,7 +1004,7 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
1007 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 1005
 		return db.Where("status =1 and solution_status =1").Order("id asc")
1009 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 1008
 	}).Find(&list).Error
1012 1009
 
1013 1010
 	return list, err
@@ -1510,6 +1507,13 @@ func GetLastDialysisOrder(org_id int64, patient_id int64, dialysis_date int64) (
1510 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 1517
 func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1514 1518
 
1515 1519
 	dialysisprescription := models.NewDialysisPrescription{}