Bladeren bron

11月9日库存管理

XMLWAN 2 jaren geleden
bovenliggende
commit
621461216e

+ 1 - 1
conf/app.conf Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode =dev
4 4
 #dev/prod
5 5
 

+ 27 - 3
controllers/dialysis_api_controller.go Bestand weergeven

@@ -441,7 +441,15 @@ func (c *DialysisApiController) PostPrescription() {
441 441
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
442 442
 	if dialysisPrescription.ID == 0 { //新增
443 443
 		if mode_id > 0 {
444
-			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
444
+			var str string
445
+			//查找该机构用的是什么透析器
446
+			filedConfig, _ := service.GetFiledConfig(adminUserInfo.CurrentOrgId)
447
+			if filedConfig.ID > 0 {
448
+				str = dialyzerPerfusionApparatus
449
+			} else {
450
+				str = dialysis_dialyszers + "/" + dialysis_irrigation
451
+			}
452
+			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
445 453
 		}
446 454
 
447 455
 		prescription.Creater = adminUserInfo.AdminUser.Id
@@ -483,7 +491,15 @@ func (c *DialysisApiController) PostPrescription() {
483 491
 
484 492
 	} else { //修改
485 493
 		if mode_id > 0 {
486
-			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
494
+			var str string
495
+			//查找该机构用的是什么透析器
496
+			filedConfig, _ := service.GetFiledConfig(adminUserInfo.CurrentOrgId)
497
+			if filedConfig.ID > 0 {
498
+				str = dialyzerPerfusionApparatus
499
+			} else {
500
+				str = dialysis_dialyszers + "/" + dialysis_irrigation
501
+			}
502
+			service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
487 503
 		}
488 504
 
489 505
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
@@ -672,7 +688,15 @@ func (c *DialysisApiController) PostSoulution() {
672 688
 	}
673 689
 
674 690
 	if mode_id > 0 {
675
-		service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
691
+		var str string
692
+		//查找该机构用的是什么透析器
693
+		filedConfig, _ := service.GetFiledConfig(adminUserInfo.CurrentOrgId)
694
+		if filedConfig.ID > 0 {
695
+			str = dialyzerPerfusionApparatus
696
+		} else {
697
+			str = dialysis_dialyszers + "/" + dialysis_irrigation
698
+		}
699
+		service.ModifyScheduleMode(mode_id, patient, recordDate.Unix(), adminUserInfo.CurrentOrgId, str)
676 700
 	}
677 701
 
678 702
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)

+ 22 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

@@ -1413,6 +1413,18 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1413 1413
 	//	}
1414 1414
 	//}
1415 1415
 
1416
+	if mode_id > 0 {
1417
+		var str string
1418
+		//查找该机构用的是什么透析器
1419
+		filedConfig, _ := service.GetFiledConfig(adminUserInfo.Org.Id)
1420
+		if filedConfig.ID > 0 {
1421
+			str = dialyzerPerfusionApparatus
1422
+		} else {
1423
+			str = dialysis_dialyszers + "/" + dialysis_irrigation
1424
+		}
1425
+		service.ModifyScheduleMode(mode_id, id, recordDate.Unix(), adminUserInfo.Org.Id, str)
1426
+	}
1427
+
1416 1428
 	//TODO 需要根据角色去判断
1417 1429
 
1418 1430
 	prescription := models.DialysisPrescription{
@@ -2664,7 +2676,16 @@ func (c *DialysisAPIController) PostSolution() {
2664 2676
 	water_machine := c.GetString("water_machine")
2665 2677
 	dialysis_remark := c.GetString("dialysis_remark")
2666 2678
 	if mode_id > 0 {
2667
-		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
2679
+
2680
+		var str string
2681
+		//查找该机构用的是什么透析器
2682
+		filedConfig, _ := service.GetFiledConfig(adminUserInfo.Org.Id)
2683
+		if filedConfig.ID > 0 {
2684
+			str = dialyzerPerfusionApparatus
2685
+		} else {
2686
+			str = dialysis_dialyszers + "/" + dialysis_irrigation
2687
+		}
2688
+		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id, str)
2668 2689
 	}
2669 2690
 
2670 2691
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)

+ 35 - 20
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Bestand weergeven

@@ -454,12 +454,14 @@ func (this *StaffScheduleApiController) UpdatePatientScheduleById() {
454 454
 		for index, _ := range list {
455 455
 			fmt.Println("index2322332", index)
456 456
 			schedule := models.XtSchedule{
457
-				PatientId: list[0].PatientId,
458
-				ModeId:    list[0].ModeId,
457
+				PatientId:           list[0].PatientId,
458
+				ModeId:              list[0].ModeId,
459
+				DialysisMachineName: list[0].DialysisMachineName,
459 460
 			}
460 461
 			xtSchedule := models.WeekSchedule{
461
-				PatientId: list[1].PatientId,
462
-				ModeId:    list[1].ModeId,
462
+				PatientId:           list[1].PatientId,
463
+				ModeId:              list[1].ModeId,
464
+				DialysisMachineName: list[1].DialysisMachineName,
463 465
 			}
464 466
 			err = service.UpdateStaffSchedule(list[1].ID, schedule)
465 467
 			fmt.Println("errrrrrrr2323323232323", err)
@@ -888,30 +890,43 @@ func (c *StaffScheduleApiController) ChangeScheduleBed() {
888 890
 		}
889 891
 		//调换位置
890 892
 		sch := models.Schedule{
891
-			PatientId: schedule.PatientId,
892
-			ModeId:    schedule.ModeId,
893
+			PatientId:           schedule.PatientId,
894
+			ModeId:              schedule.ModeId,
895
+			DialysisMachineName: schedule.DialysisMachineName,
893 896
 		}
894 897
 		service.UpdateScheduleById(id, sch)
895 898
 
896 899
 		schedu := models.Schedule{
897
-			PatientId: patient_id,
898
-			ModeId:    mode_id,
900
+			PatientId:           patient_id,
901
+			ModeId:              mode_id,
902
+			DialysisMachineName: schedule.DialysisMachineName,
899 903
 		}
900 904
 		service.UpdateScheduleById(schedule.ID, schedu)
901 905
 	} else {
906
+		var str string
907
+		//查找该机构用的是什么透析器
908
+		filedConfig, _ := service.GetFiledConfig(org_id)
909
+		if filedConfig.ID > 0 {
910
+			solutionType, _ := service.GetLastDialysisSolutionType(org_id, patient_id, mode_id)
911
+			str = solutionType.DialyzerPerfusionApparatus
912
+		} else {
913
+			solutionType, _ := service.GetLastDialysisSolutionType(org_id, patient_id, mode_id)
914
+			str = solutionType.DialysisDialyszers + "/" + solutionType.DialysisIrrigation
915
+		}
902 916
 		xtSchedule := models.Schedule{
903
-			UserOrgId:    org_id,
904
-			PartitionId:  numberlist.ZoneId,
905
-			BedId:        bed_id,
906
-			PatientId:    patient_id,
907
-			ScheduleDate: schedule_date,
908
-			ScheduleType: schedule_type,
909
-			ScheduleWeek: schedule_week,
910
-			ModeId:       mode_id,
911
-			Status:       1,
912
-			CreatedTime:  time.Now().Unix(),
913
-			UpdatedTime:  0,
914
-			IsExport:     20000,
917
+			UserOrgId:           org_id,
918
+			PartitionId:         numberlist.ZoneId,
919
+			BedId:               bed_id,
920
+			PatientId:           patient_id,
921
+			ScheduleDate:        schedule_date,
922
+			ScheduleType:        schedule_type,
923
+			ScheduleWeek:        schedule_week,
924
+			ModeId:              mode_id,
925
+			Status:              1,
926
+			CreatedTime:         time.Now().Unix(),
927
+			UpdatedTime:         0,
928
+			IsExport:            20000,
929
+			DialysisMachineName: str,
915 930
 		}
916 931
 		service.DeleteSchedule(id)
917 932
 		service.CreateSchedule(&xtSchedule)

+ 6 - 3
controllers/schedule_api_controller.go Bestand weergeven

@@ -1141,11 +1141,8 @@ func (c *ScheduleApiController) GetWeekPanels() {
1141 1141
 	}
1142 1142
 
1143 1143
 	if data == 1 {
1144
-		fmt.Println(ids)
1145 1144
 
1146 1145
 		partitions, _ := service.GetSchedulePartitionPanelOne(adminInfo.CurrentOrgId, ids)
1147
-		fmt.Println("````~~")
1148
-		fmt.Println(partitions)
1149 1146
 
1150 1147
 		returnData["partitions"] = partitions
1151 1148
 	}
@@ -3296,10 +3293,13 @@ func (this *ScheduleApiController) GetNextWeekDayScheduleOne() {
3296 3293
 	for _, item := range schedule {
3297 3294
 		order, _ := service.GetLastDialysisOrder(adminUserInfo.CurrentOrgId, item.PatientId, theStartTIme)
3298 3295
 		item.XtDialysisOrderSix = order
3296
+		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(adminUserInfo.CurrentOrgId, item.PatientId, item.ModeId)
3297
+		item.DialysisSolution = solutionLastWeek
3299 3298
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10340 {
3300 3299
 
3301 3300
 			dialysisprescription, _ := service.GetLastDialysisSolution(adminUserInfo.CurrentOrgId, item.PatientId, item.ModeId, item.ScheduleDate)
3302 3301
 			item.DialysisPrescription = dialysisprescription
3302
+
3303 3303
 		}
3304 3304
 
3305 3305
 	}
@@ -3349,6 +3349,9 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
3349 3349
 		hisDoctorAdvice, _ := service.GetHisDoctorAdviceListLastWeek(item.UserOrgId, item.PatientId, item.ScheduleDate)
3350 3350
 
3351 3351
 		item.HisDoctorAdviceInfo = hisDoctorAdvice
3352
+
3353
+		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(item.UserOrgId, item.PatientId, item.ModeId)
3354
+		item.DialysisSolution = solutionLastWeek
3352 3355
 	}
3353 3356
 	if err != nil {
3354 3357
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 56 - 56
models/device_models.go Bestand weergeven

@@ -117,18 +117,18 @@ func (DeviceZone) TableName() string {
117 117
 }
118 118
 
119 119
 type DeviceZonePb struct {
120
-	ID         int64  `gorm:"column:id" json:"id"`
121
-	OrgID      int64  `gorm:"column:org_id" json:"-"`
122
-	Name       string `json:"name"`
123
-	Type       int    `json:"type"`
124
-	TotalBed   int	  `json:"total_bed"`
125
-	SwBed      int	  `json:"sw_bed"`
126
-	XwBed      int	  `json:"xw_bed"`
127
-	WsBed      int	  `json:"ws_bed"`
128
-	CreateTime int64  `gorm:"column:ctime" json:"-"`
129
-	ModifyTime int64  `gorm:"column:mtime" json:"-"`
130
-	Status     int64  `gorm:"column:status" json:"status" form:"status"`
131
-	DeviceNumber   []*DeviceNumberPb   `json:"device" gorm:"foreignkey:ZoneID;AssociationForeignKey:ID;"`
120
+	ID           int64             `gorm:"column:id" json:"id"`
121
+	OrgID        int64             `gorm:"column:org_id" json:"-"`
122
+	Name         string            `json:"name"`
123
+	Type         int               `json:"type"`
124
+	TotalBed     int               `json:"total_bed"`
125
+	SwBed        int               `json:"sw_bed"`
126
+	XwBed        int               `json:"xw_bed"`
127
+	WsBed        int               `json:"ws_bed"`
128
+	CreateTime   int64             `gorm:"column:ctime" json:"-"`
129
+	ModifyTime   int64             `gorm:"column:mtime" json:"-"`
130
+	Status       int64             `gorm:"column:status" json:"status" form:"status"`
131
+	DeviceNumber []*DeviceNumberPb `json:"device" gorm:"foreignkey:ZoneID;AssociationForeignKey:ID;"`
132 132
 }
133 133
 
134 134
 func (DeviceZonePb) TableName() string {
@@ -136,14 +136,14 @@ func (DeviceZonePb) TableName() string {
136 136
 }
137 137
 
138 138
 type DialysisSolutionPb struct {
139
-	UserOrgId                  int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
140
-	PatientId                  int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
141
-	DialysisDialyszers         string                `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
142
-	DialysisIrrigation         string                `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
143
-	DialyzerPerfusionApparatus string                `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
144
-	ModeName                   string                `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
145
-	ModeId                     int64                 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
146
-	Anticoagulant              int64                 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
139
+	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
140
+	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
141
+	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
142
+	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
143
+	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
144
+	ModeName                   string `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
145
+	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
146
+	Anticoagulant              int64  `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
147 147
 }
148 148
 
149 149
 func (DialysisSolutionPb) TableName() string {
@@ -151,15 +151,15 @@ func (DialysisSolutionPb) TableName() string {
151 151
 }
152 152
 
153 153
 type DeviceNumberPb struct {
154
-	ID         int64      `gorm:"column:id" json:"id"`
155
-	OrgID      int64      `gorm:"column:org_id" json:"-"`
156
-	Number     string     `gorm:"column:number" json:"number"`
157
-	GroupID    int64      `gorm:"column:group_id" json:"group_id"`
158
-	ZoneID     int64      `gorm:"column:zone_id" json:"zone_id"`
159
-	Status     int64      `gorm:"column:status" json:"status" form:"status"`
160
-	CreateTime int64      `gorm:"column:ctime" json:"-"`
161
-	ModifyTime int64      `gorm:"column:mtime" json:"-"`
162
-	Sort       int64      `gorm:"column:sort" json:"sort" form:"sort"`
154
+	ID         int64             `gorm:"column:id" json:"id"`
155
+	OrgID      int64             `gorm:"column:org_id" json:"-"`
156
+	Number     string            `gorm:"column:number" json:"number"`
157
+	GroupID    int64             `gorm:"column:group_id" json:"group_id"`
158
+	ZoneID     int64             `gorm:"column:zone_id" json:"zone_id"`
159
+	Status     int64             `gorm:"column:status" json:"status" form:"status"`
160
+	CreateTime int64             `gorm:"column:ctime" json:"-"`
161
+	ModifyTime int64             `gorm:"column:mtime" json:"-"`
162
+	Sort       int64             `gorm:"column:sort" json:"sort" form:"sort"`
163 163
 	Schedule   []*BlodSchedulePb `json:"schedule" gorm:"foreignkey:BedId;AssociationForeignKey:ID;"`
164 164
 }
165 165
 
@@ -168,21 +168,21 @@ func (DeviceNumberPb) TableName() string {
168 168
 }
169 169
 
170 170
 type BlodSchedulePb struct {
171
-	ID                        int64                     `gorm:"column:id" json:"id" form:"id"`
172
-	UserOrgId                 int64                     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
-	PartitionId               int64                     `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
-	BedId                     int64                     `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
-	PatientId                 int64                     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
-	ScheduleDate              int64                     `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
-	ScheduleType              int64                     `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
-	ScheduleWeek              int64                     `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
-	ModeId                    int64                     `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
-	Status                    int64                     `gorm:"column:status" json:"status" form:"status"`
181
-	DialysisMachineName       string                    `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
182
-	VmBloodPatients           VmBloodPatients           `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
183
-	BloodDialysisOrder        BloodPatientDialysisOrder `json:"order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
171
+	ID                        int64                       `gorm:"column:id" json:"id" form:"id"`
172
+	UserOrgId                 int64                       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
+	PartitionId               int64                       `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
+	BedId                     int64                       `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
+	PatientId                 int64                       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
+	ScheduleDate              int64                       `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
+	ScheduleType              int64                       `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
+	ScheduleWeek              int64                       `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
+	ModeId                    int64                       `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
+	Status                    int64                       `gorm:"column:status" json:"status" form:"status"`
181
+	DialysisMachineName       string                      `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
182
+	VmBloodPatients           VmBloodPatients             `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
183
+	BloodDialysisOrder        BloodPatientDialysisOrder   `json:"order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
184 184
 	BloodDialysisPrescription BloodDialysisPrescriptionPb `json:"prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId;"`
185
-	DialysisSolution 		  DialysisSolutionPb `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
185
+	DialysisSolution          DialysisSolutionPb          `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
186 186
 }
187 187
 
188 188
 func (BlodSchedulePb) TableName() string {
@@ -190,19 +190,19 @@ func (BlodSchedulePb) TableName() string {
190 190
 }
191 191
 
192 192
 type BloodDialysisPrescriptionPb struct {
193
-	ID                         int64   `gorm:"column:id" json:"id" form:"id"`
194
-	UserOrgId                  int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
195
-	PatientId                  int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
196
-	Remark                     string  `gorm:"column:remark" json:"remark" form:"remark"`
197
-	ModeId                     int64   `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
198
-	Anticoagulant              int64   `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
199
-	AnticoagulantShouji        float64 `gorm:"column:anticoagulant_shouji" json:"anticoagulant_shouji" form:"anticoagulant_shouji"`
200
-	AnticoagulantWeichi        float64 `gorm:"column:anticoagulant_weichi" json:"anticoagulant_weichi" form:"anticoagulant_weichi"`
201
-	AnticoagulantZongliang     float64 `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
202
-	AnticoagulantGaimingcheng  string  `gorm:"column:anticoagulant_gaimingcheng" json:"anticoagulant_gaimingcheng" form:"anticoagulant_gaimingcheng"`
203
-	AnticoagulantGaijiliang    string  `gorm:"column:anticoagulant_gaijiliang" json:"anticoagulant_gaijiliang" form:"anticoagulant_gaijiliang"`
204
-	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
205
-	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
193
+	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
194
+	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
195
+	PatientId                 int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
196
+	Remark                    string  `gorm:"column:remark" json:"remark" form:"remark"`
197
+	ModeId                    int64   `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
198
+	Anticoagulant             int64   `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
199
+	AnticoagulantShouji       float64 `gorm:"column:anticoagulant_shouji" json:"anticoagulant_shouji" form:"anticoagulant_shouji"`
200
+	AnticoagulantWeichi       float64 `gorm:"column:anticoagulant_weichi" json:"anticoagulant_weichi" form:"anticoagulant_weichi"`
201
+	AnticoagulantZongliang    float64 `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
202
+	AnticoagulantGaimingcheng string  `gorm:"column:anticoagulant_gaimingcheng" json:"anticoagulant_gaimingcheng" form:"anticoagulant_gaimingcheng"`
203
+	AnticoagulantGaijiliang   string  `gorm:"column:anticoagulant_gaijiliang" json:"anticoagulant_gaijiliang" form:"anticoagulant_gaijiliang"`
204
+	DialysisDialyszers        string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
205
+	DialysisIrrigation        string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
206 206
 }
207 207
 
208 208
 func (BloodDialysisPrescriptionPb) TableName() string {

+ 16 - 0
models/patient_models.go Bestand weergeven

@@ -1764,3 +1764,19 @@ type NewDialysisPrescription struct {
1764 1764
 func (NewDialysisPrescription) TableName() string {
1765 1765
 	return "xt_dialysis_prescription"
1766 1766
 }
1767
+
1768
+type NewDialysisSolutionOne struct {
1769
+	ID                         int64  `gorm:"column:id" json:"id" form:"id"`
1770
+	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1771
+	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1772
+	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1773
+	Status                     int64  `gorm:"column:status" json:"status" form:"status"`
1774
+	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1775
+	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1776
+	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1777
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
1778
+}
1779
+
1780
+func (NewDialysisSolutionOne) TableName() string {
1781
+	return "xt_dialysis_solution"
1782
+}

+ 14 - 14
models/schedule_models.go Bestand weergeven

@@ -120,20 +120,20 @@ func (Search_Schedule) TableName() string {
120 120
 }
121 121
 
122 122
 type WeekSchedule struct {
123
-	ID           int64 `gorm:"column:id" json:"id" form:"id"`
124
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
125
-	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
126
-	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
127
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
128
-	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
129
-	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
130
-	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
131
-	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
132
-	Status       int64 `gorm:"column:status" json:"status" form:"status"`
133
-	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
134
-	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
135
-	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
136
-
123
+	ID                         int64                      `gorm:"column:id" json:"id" form:"id"`
124
+	UserOrgId                  int64                      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
125
+	PartitionId                int64                      `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
126
+	BedId                      int64                      `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
127
+	PatientId                  int64                      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
128
+	ScheduleDate               int64                      `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
129
+	ScheduleType               int64                      `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
130
+	ScheduleWeek               int64                      `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
131
+	ModeId                     int64                      `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
132
+	Status                     int64                      `gorm:"column:status" json:"status" form:"status"`
133
+	CreatedTime                int64                      `gorm:"column:created_time" json:"created_time" form:"created_time"`
134
+	UpdatedTime                int64                      `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
135
+	IsExport                   int64                      `gorm:"column:is_export" json:"is_export" form:"is_export"`
136
+	DialysisMachineName        string                     `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
137 137
 	Patient                    string                     `gorm:"-" json:"patient" form:"patient"`
138 138
 	DeviceZone                 DeviceZone                 `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
139 139
 	DeviceNumber               DeviceNumber               `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`

+ 1 - 1
service/device_service.go Bestand weergeven

@@ -833,7 +833,7 @@ func GetPartionId(bed_id int64, org_id int64) (models.XtDeviceNumber, error) {
833 833
 
834 834
 func UpdateScheduleById(id int64, schedule models.Schedule) error {
835 835
 
836
-	err := XTWriteDB().Model(&models.Schedule{}).Where("id = ? and status =1", id).Update(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId, "is_export": 10000}).Error
836
+	err := XTWriteDB().Model(&models.Schedule{}).Where("id = ? and status =1", id).Update(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId, "is_export": 10000, "dialysis_machine_name": schedule.DialysisMachineName}).Error
837 837
 	return err
838 838
 }
839 839
 

+ 9 - 2
service/dialysis_service.go Bestand weergeven

@@ -1109,9 +1109,9 @@ func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int6
1109 1109
 	return err
1110 1110
 }
1111 1111
 
1112
-func ModifyScheduleMode(mode_id int64, patient_id int64, recordDate int64, org_id int64) {
1112
+func ModifyScheduleMode(mode_id int64, patient_id int64, recordDate int64, org_id int64, dialysis_machine_name string) {
1113 1113
 	ut := writeDb.Begin()
1114
-	err = writeDb.Model(&models.Schedule{}).Where("status = 1   AND user_org_id = ? AND patient_id = ? AND schedule_date = ? ", org_id, patient_id, recordDate).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "mode_id": mode_id}).Error
1114
+	err = writeDb.Model(&models.Schedule{}).Where("status = 1   AND user_org_id = ? AND patient_id = ? AND schedule_date = ?", org_id, patient_id, recordDate).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "mode_id": mode_id, "dialysis_machine_name": dialysis_machine_name}).Error
1115 1115
 	if err != nil {
1116 1116
 		ut.Rollback()
1117 1117
 		return
@@ -2044,3 +2044,10 @@ func GetTodayInforMation(orgid int64, record_date int64) (list []*NewDeviceInfor
2044 2044
 	err = UserReadDB().Where("user_org_id = ? and date = ? and status = 1", orgid, record_date).Find(&list).Error
2045 2045
 	return list, err
2046 2046
 }
2047
+
2048
+func GetFiledConfig(orgid int64) (models.FiledConfig, error) {
2049
+
2050
+	config := models.FiledConfig{}
2051
+	err := XTReadDB().Where("filed_name = 'dialyzer_perfusion_apparatus' and org_id = ? and module =1 and is_show = 1", orgid).First(&config).Error
2052
+	return config, err
2053
+}

+ 2 - 2
service/doctor_schedule_service.go Bestand weergeven

@@ -707,13 +707,13 @@ func GetStaffScheduleById(ids []string) (schedule []*models.XtSchedule, err erro
707 707
 
708 708
 func UpdateStaffSchedule(nextid int64, schedule models.XtSchedule) error {
709 709
 
710
-	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId}).Error
710
+	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId, "dialysis_machine_name": schedule.DialysisMachineName}).Error
711 711
 	return err
712 712
 }
713 713
 
714 714
 func UpdateStaffScheduleOne(nextid int64, schedule models.WeekSchedule) error {
715 715
 
716
-	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId}).Error
716
+	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId, "dialysis_machine_name": schedule.DialysisMachineName}).Error
717 717
 	return err
718 718
 }
719 719
 

+ 48 - 16
service/schedule_service.go Bestand weergeven

@@ -970,12 +970,21 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
970 970
 	if orgID > 0 {
971 971
 		db = db.Where("s.user_org_id = ?", orgID)
972 972
 	}
973
-	if startime > 0 {
974
-		db = db.Where("s.schedule_date >= ?", startime)
973
+	if weektype == 0 {
974
+		if startime > 0 {
975
+			db = db.Where("s.schedule_date >= ?", startime)
976
+		}
977
+		if endtime > 0 {
978
+			db = db.Where("s.schedule_date <= ?", endtime)
979
+		}
975 980
 	}
976
-	if endtime > 0 {
977
-		db = db.Where("s.schedule_date <= ?", endtime)
981
+
982
+	if weektype > 0 {
983
+		if record_date > 0 {
984
+			db = db.Where("s.schedule_date = ?", record_date)
985
+		}
978 986
 	}
987
+
979 988
 	if weektime > 0 {
980 989
 		db = db.Where("s.schedule_type = ?", weektime)
981 990
 	}
@@ -987,9 +996,7 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
987 996
 	}
988 997
 	err = db.
989 998
 		Preload("DeviceZone", "status = 1 ").
990
-		Preload("DeviceNumber", "status = 1 ").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
991
-		return db.Where("status = 1").Order("id asc")
992
-	}).Joins("JOIN xt_patients as p ON p.id = s.patient_id").
999
+		Preload("DeviceNumber", "status = 1 ").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
993 1000
 		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,p.id_card_no as id_card_no,p.dialysis_no as dialysis_no,p.gender as gender,p.phone as phone").
994 1001
 		Order("s.partition_id desc").
995 1002
 		Find(&schedules).Error
@@ -1155,7 +1162,7 @@ func GetDataPrint(orgid int64) (models.XtDataPrint, error) {
1155 1162
 func GetNextWeekPanels(startime int64, endtime int64, orgid int64) (schedule []*models.XtSchedule, err error) {
1156 1163
 
1157 1164
 	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 {
1158
-		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, endtime)
1165
+		return db.Where("user_org_id = ? and status = 1 and  assessment_date>=1672502400  and assessment_date < ?", orgid, endtime)
1159 1166
 	}).Find(&schedule).Error
1160 1167
 	return schedule, err
1161 1168
 }
@@ -1300,7 +1307,7 @@ func GetLastDialysisOrder(org_id int64, patient_id int64, dialysis_date int64) (
1300 1307
 func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1301 1308
 
1302 1309
 	dialysisprescription := models.NewDialysisPrescription{}
1303
-	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date<?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1310
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date>=1672502400 and record_date<?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1304 1311
 	return dialysisprescription, err
1305 1312
 
1306 1313
 }
@@ -1317,18 +1324,37 @@ func GetHisDoctorAdviceListLastWeek(org_id int64, patient_id int64, schedule_dat
1317 1324
 	return advice, err
1318 1325
 }
1319 1326
 
1327
+func GetDialysisSolutionLastWeek(user_org_id int64, patient_id int64, mode_id int64) (models.DialysisSolution, error) {
1328
+
1329
+	solution := models.DialysisSolution{}
1330
+
1331
+	err := XTReadDB().Where("user_org_id =? and status = 1 and patient_id = ? and mode_id = ? and solution_status = 1", user_org_id, patient_id, mode_id).Find(&solution).Error
1332
+
1333
+	return solution, err
1334
+}
1335
+
1320 1336
 func GetNextWeekDayScheduleSix(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string, record_date int64) (schedules []*models.WeekScheduleSeven, err error) {
1321 1337
 
1322 1338
 	db := XTReadDB().Table("xt_schedule as s ").Where("s.status =1")
1323 1339
 	if orgID > 0 {
1324 1340
 		db = db.Where("s.user_org_id = ?", orgID)
1325 1341
 	}
1326
-	if startime > 0 {
1327
-		db = db.Where("s.schedule_date >= ?", startime)
1342
+	if weektype == 0 {
1343
+		if startime > 0 {
1344
+			db = db.Where("s.schedule_date >= ?", startime)
1345
+		}
1346
+		if endtime > 0 {
1347
+			db = db.Where("s.schedule_date <= ?", endtime)
1348
+		}
1328 1349
 	}
1329
-	if endtime > 0 {
1330
-		db = db.Where("s.schedule_date <= ?", endtime)
1350
+
1351
+	if weektype > 0 {
1352
+		if record_date > 0 {
1353
+			db = db.Where("s.schedule_date = ?", record_date)
1354
+		}
1355
+
1331 1356
 	}
1357
+
1332 1358
 	if weektime > 0 {
1333 1359
 		db = db.Where("s.schedule_type = ?", weektime)
1334 1360
 	}
@@ -1343,9 +1369,7 @@ func GetNextWeekDayScheduleSix(weektype int64, weektime int64, startime int64, e
1343 1369
 		Preload("DeviceNumber", "status = 1 ").
1344 1370
 		Preload("XtAssessmentBeforeDislysis", func(db *gorm.DB) *gorm.DB {
1345 1371
 			return db.Where("status = 1 and assessment_date = ?", record_date)
1346
-		}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
1347
-		return db.Where("status = 1").Order("id asc")
1348
-	}).Joins("JOIN xt_patients as p ON p.id = s.patient_id").
1372
+		}).Joins("JOIN xt_patients as p ON p.id = s.patient_id").
1349 1373
 		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,p.id_card_no as id_card_no,p.dialysis_no as dialysis_no,p.gender as gender,p.phone as phone").
1350 1374
 		Order("s.partition_id desc").
1351 1375
 		Find(&schedules).Error
@@ -1358,3 +1382,11 @@ func GetAssessmentBeforListLastWeek(schedule_date int64, patient_id int64, org_i
1358 1382
 	err := XTReadDB().Where("assessment_date = ? and patient_id = ? and user_org_id =? and status = 1", schedule_date, patient_id, org_id).Find(&dislysis).Error
1359 1383
 	return dislysis, err
1360 1384
 }
1385
+
1386
+func GetLastDialysisSolutionType(org_id int64, patient_id int64, mode_id int64) (models.NewDialysisSolutionOne, error) {
1387
+
1388
+	dialysisprescription := models.NewDialysisSolutionOne{}
1389
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and solution_status =1", org_id, patient_id, mode_id).First(&dialysisprescription).Error
1390
+	return dialysisprescription, err
1391
+
1392
+}