XMLWAN 3 lat temu
rodzic
commit
73b31ca0d8

+ 2 - 1
controllers/dialysis_api_controller.go Wyświetl plik

@@ -3107,7 +3107,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3107 3107
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3108 3108
 				record.UltrafiltrationRate = ultrafiltration_rate
3109 3109
 			}
3110
-			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 9671 {
3110
+			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 10121 {
3111 3111
 
3112 3112
 				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3113 3113
 				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
@@ -3142,6 +3142,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3142 3142
 	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 {
3143 3143
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
3144 3144
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
3145
+
3145 3146
 			record.UltrafiltrationVolume = ultrafiltration_volume
3146 3147
 		}
3147 3148
 

+ 1 - 1
controllers/dialysis_record_api_controller.go Wyświetl plik

@@ -773,7 +773,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
773 773
 				}
774 774
 
775 775
 				//针对福建医师汇
776
-				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 9671 {
776
+				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 10121 {
777 777
 					if evaluation.ID > 0 {
778 778
 						dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
779 779
 						ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)

+ 3 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -2312,6 +2312,7 @@ func (this *DialysisAPIController) GetLastMonitorRecord() {
2312 2312
 }
2313 2313
 
2314 2314
 func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2315
+
2315 2316
 	thisTime := time.Now()
2316 2317
 	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
2317 2318
 	timeLayout := "2006-01-02 15:04:05"
@@ -2337,8 +2338,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2337 2338
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2338 2339
 
2339 2340
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2340
-			if template.TemplateId == 6 && adminInfo.Org.Id != 9671 {
2341
-
2341
+			if template.TemplateId == 6 && adminInfo.Org.Id != 9538 {
2342 2342
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2343 2343
 				record.UltrafiltrationRate = ultrafiltration_rate
2344 2344
 			}
@@ -2382,6 +2382,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2382 2382
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
2383 2383
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
2384 2384
 			record.UltrafiltrationVolume = ultrafiltration_volume
2385
+
2385 2386
 		}
2386 2387
 	}
2387 2388
 

+ 44 - 0
controllers/schedule_api_controller.go Wyświetl plik

@@ -64,6 +64,8 @@ func ScheduleApiRegistRouters() {
64 64
 	beego.Router("/api/schedule/schedulesone", &ScheduleApiController{}, "Get:GetScheduleOne")
65 65
 	beego.Router("/api/schedule/postscheduletemplate", &ScheduleApiController{}, "Get:SaveScheduleTemplate")
66 66
 	beego.Router("/api/schedule/getscheduletemplate", &ScheduleApiController{}, "Get:GetScheduleTemplate")
67
+	beego.Router("/api/order/changefuncprint", &ScheduleApiController{}, "Get:ChangeFuncPrint")
68
+	beego.Router("/api/order/getdataprint", &ScheduleApiController{}, "Get:GetDataPrint")
67 69
 }
68 70
 
69 71
 func (c *ScheduleApiController) GetWeekPanels() {
@@ -2623,3 +2625,45 @@ func (c *ScheduleApiController) GetScheduleTemplate() {
2623 2625
 	})
2624 2626
 	return
2625 2627
 }
2628
+
2629
+func (c *ScheduleApiController) ChangeFuncPrint() {
2630
+
2631
+	adminUserInfo := c.GetAdminUserInfo()
2632
+	orgId := adminUserInfo.CurrentOrgId
2633
+	is_open, _ := c.GetInt64("is_open")
2634
+	dataPrint := models.XtDataPrint{
2635
+		UserOrgId: orgId,
2636
+		IsOpen:    is_open,
2637
+		Status:    1,
2638
+		Ctime:     time.Now().Unix(),
2639
+	}
2640
+
2641
+	_, errcode := service.GetDataPrintByOrgId(orgId)
2642
+	fmt.Println("errcode222234444555556t66", errcode)
2643
+	if errcode == gorm.ErrRecordNotFound {
2644
+		service.CreateDataPrint(&dataPrint)
2645
+		c.ServeSuccessJSON(map[string]interface{}{
2646
+			"dataPrint": dataPrint,
2647
+		})
2648
+		return
2649
+	} else if errcode == nil {
2650
+		service.UpdteDataPrint(orgId, &dataPrint)
2651
+		c.ServeSuccessJSON(map[string]interface{}{
2652
+			"dataPrint": dataPrint,
2653
+		})
2654
+		return
2655
+	}
2656
+
2657
+}
2658
+
2659
+func (c *ScheduleApiController) GetDataPrint() {
2660
+
2661
+	adminUserInfo := c.GetAdminUserInfo()
2662
+	orgId := adminUserInfo.CurrentOrgId
2663
+
2664
+	dataPrint, _ := service.GetDataPrint(orgId)
2665
+	c.ServeSuccessJSON(map[string]interface{}{
2666
+		"dataPrint": dataPrint,
2667
+	})
2668
+	return
2669
+}

+ 15 - 0
models/schedule_models.go Wyświetl plik

@@ -22,6 +22,7 @@ type VmSchedules struct {
22 22
 	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
23 23
 	DialysisPrescription DialysisPrescription   `json:"prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
24 24
 	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
25
+	DialysisSolution     []*DialysisSolution    `json:"dialysissolution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
25 26
 }
26 27
 
27 28
 func (VmSchedules) TableName() string {
@@ -137,6 +138,7 @@ type WeekSchedule struct {
137 138
 	DialysisPrescription DialysisSolution       `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
138 139
 	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
139 140
 	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
141
+	DialysisSolution     []*DialysisSolution    `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
140 142
 }
141 143
 
142 144
 func (WeekSchedule) TableName() string {
@@ -155,3 +157,16 @@ type ScheduleTemplate struct {
155 157
 func (ScheduleTemplate) TableName() string {
156 158
 	return "xt_schedule_template"
157 159
 }
160
+
161
+type XtDataPrint struct {
162
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
163
+	IsOpen    int64 `gorm:"column:is_open" json:"is_open" form:"is_open"`
164
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
165
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
166
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
167
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
168
+}
169
+
170
+func (XtDataPrint) TableName() string {
171
+	return "xt_data_print"
172
+}

+ 1 - 1
service/patientmanage_service.go Wyświetl plik

@@ -865,7 +865,7 @@ func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, pag
865 865
 			return readUserDb.Where("org_id=? and status = 1", orgID)
866 866
 		}).
867 867
 		Joins("JOIN xt_schedule as s ON s.patient_id=? and FROM_UNIXTIME(s.schedule_date, '%Y-%m-%d')=FROM_UNIXTIME(do.dialysis_date, '%Y-%m-%d')", patientID).
868
-		Joins("JOIN xt_device_zone as dz ON dz.org_id = ? and dz.id=s.partition_id", orgID).
868
+		Joins("JOIN xt_device_zone as dz ON dz.org_id = ? and dz.id=s.partition_id and s.status = 1", orgID).
869 869
 		Where("do.patient_id=? and do.user_org_id=? and do.stage = 2 and do.status=1", patientID, orgID).Group("s.schedule_date")
870 870
 
871 871
 	if start > 0 {

+ 38 - 3
service/schedule_service.go Wyświetl plik

@@ -579,7 +579,7 @@ func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64)
579 579
 
580 580
 	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").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
581 581
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
582
-	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
582
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", "status = 1 and user_org_id = ?", orgid).Find(&list).Error
583 583
 
584 584
 	return list, err
585 585
 }
@@ -602,7 +602,7 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
602 602
 
603 603
 	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").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
604 604
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
605
-	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Find(&list).Error
605
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", "user_org_id =? and status = 1", orgid).Find(&list).Error
606 606
 
607 607
 	return list, err
608 608
 }
@@ -777,7 +777,9 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
777 777
 		Preload("DeviceNumber", "status = 1 ").
778 778
 		Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
779 779
 			return db.Where("status = 1").Order("id asc")
780
-		}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
780
+		}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
781
+		return db.Where("status = 1").Order("id asc")
782
+	}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
781 783
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
782 784
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
783 785
 		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, p.name as patient").
@@ -908,3 +910,36 @@ func GetScheduleTemplate(orgid int64) (models.ScheduleTemplate, error) {
908 910
 	err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&template).Error
909 911
 	return template, err
910 912
 }
913
+
914
+func GetDataPrintByOrgId(orgid int64) (*models.XtDataPrint, error) {
915
+
916
+	dataPrint := models.XtDataPrint{}
917
+
918
+	err := XTReadDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Find(&dataPrint).Error
919
+
920
+	if err == gorm.ErrRecordNotFound {
921
+		return nil, err
922
+	}
923
+	if err != nil {
924
+		return nil, err
925
+	}
926
+	return &dataPrint, nil
927
+}
928
+
929
+func CreateDataPrint(dataPrint *models.XtDataPrint) error {
930
+
931
+	err := XTWriteDB().Create(&dataPrint).Error
932
+	return err
933
+}
934
+
935
+func UpdteDataPrint(orgid int64, dataPrint *models.XtDataPrint) error {
936
+
937
+	err := XTWriteDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Updates(map[string]interface{}{"is_open": dataPrint.IsOpen}).Error
938
+	return err
939
+}
940
+
941
+func GetDataPrint(orgid int64) (models.XtDataPrint, error) {
942
+	dataPrint := models.XtDataPrint{}
943
+	err := XTReadDB().Model(&dataPrint).Where("user_org_id = ? and status = 1", orgid).Find(&dataPrint).Error
944
+	return dataPrint, err
945
+}