Browse Source

2024/6/17

28169 2 months ago
parent
commit
1d6f6d685b

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10633 //机构id
86
+		subscibe.OrgId = 10602 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10602 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 7421  //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10633 //机构id小英9675或4
332
+		subscibe.OrgId = 10602 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10602 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 7421  //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 3 - 1
controllers/dialysis_api_controller.go View File

@@ -5614,7 +5614,7 @@ func (c *DialysisApiController) UploadDryWeight() {
5614 5614
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5615 5615
 
5616 5616
 		//康桥
5617
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
5617
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
5618 5618
 			timeNowStr := time.Now().Format("2006-01-02")
5619 5619
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5620 5620
 
@@ -6177,6 +6177,7 @@ func (this *DialysisApiController) SaveDialysisSetting() {
6177 6177
 	gansuna_set, _ := this.GetInt64("gansuna_set")
6178 6178
 	zhetangtie_set, _ := this.GetInt64("zhetangtie_set")
6179 6179
 	niaojimei_set, _ := this.GetInt64("niaojimei_set")
6180
+	dialysis_strainer_set, _ := this.GetInt64("dialysis_strainer_set")
6180 6181
 	dialysisSetting := models.XtDialysisSetting{
6181 6182
 		Sodium:                     sodium_set,
6182 6183
 		Calcium:                    calcium_set,
@@ -6215,6 +6216,7 @@ func (this *DialysisApiController) SaveDialysisSetting() {
6215 6216
 		GansunaSet:                 gansuna_set,
6216 6217
 		ZhetangtieSet:              zhetangtie_set,
6217 6218
 		NiaojimeiSet:               niaojimei_set,
6219
+		DialysisStrainerSet:        dialysis_strainer_set,
6218 6220
 	}
6219 6221
 	err := service.SaveDialysisSetting(dialysisSetting)
6220 6222
 	if err == nil {

+ 1 - 1
controllers/doctors_api_controller.go View File

@@ -353,7 +353,7 @@ func (c *DoctorsApiController) UpdatedDryWeightData() {
353 353
 	}
354 354
 
355 355
 	//康桥
356
-	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
356
+	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
357 357
 		timeNowStr := time.Now().Format("2006-01-02")
358 358
 		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
359 359
 

+ 1 - 1
controllers/his_api_controller.go View File

@@ -3197,7 +3197,7 @@ func (c *HisApiController) CreateHisPrescription() {
3197 3197
 	var adviceList []models.HisDoctorAdviceInfo
3198 3198
 	var projectList []models.HisPrescriptionProject
3199 3199
 
3200
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 {
3200
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 {
3201 3201
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3202 3202
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3203 3203
 

+ 20 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -118,6 +118,7 @@ func (this *DialysisAPIController) Scheduals() {
118 118
 				dobulecheck, _ := service.GetAllDobuleCheckList(orgID, date.Unix())
119 119
 
120 120
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
121
+
121 122
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
122 123
 
123 124
 				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
@@ -561,8 +562,6 @@ func (this *DialysisAPIController) DialysisRecord() {
561 562
 
562 563
 	projects, _ = service.GetHisPrescriptionProjects(adminInfo.Org.Id, patientID, date.Unix())
563 564
 
564
-	fmt.Print("projectOne------------------------", projectsOne)
565
-
566 565
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
567 566
 
568 567
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
@@ -2803,6 +2802,11 @@ func (c *DialysisAPIController) Finish() {
2803 2802
 			tempassessmentAfterDislysis.ActualUltrafiltration = UltrafiltrationVolumeOne
2804 2803
 		}
2805 2804
 
2805
+		if adminUserInfo.Org.Id == 10721 {
2806
+			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
2807
+			tempassessmentAfterDislysis.SystolicBloodPressure = 0
2808
+		}
2809
+
2806 2810
 		if adminUserInfo.Org.Id == 10697 {
2807 2811
 			lastWeightAfter, _ := service.GetLastWeightAfter(tempassessmentAfterDislysis.PatientId, tempassessmentAfterDislysis.AssessmentDate, adminUserInfo.Org.Id)
2808 2812
 			floatAfeter := strconv.FormatFloat(lastWeightAfter.WeightAfter, 'f', -1, 64)
@@ -3080,6 +3084,11 @@ func (c *DialysisAPIController) Finish() {
3080 3084
 		lastWeightAfter.LastAfterWeight = floatAfeter
3081 3085
 	}
3082 3086
 
3087
+	if adminUserInfo.Org.Id == 10721 {
3088
+		tempassessmentAfterDislysis.DiastolicBloodPressure = 0
3089
+		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3090
+	}
3091
+
3083 3092
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3084 3093
 
3085 3094
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
@@ -3630,6 +3639,7 @@ func (this *DialysisAPIController) StartDialysis() {
3630 3639
 
3631 3640
 	var ultrafiltration_rate float64
3632 3641
 	var ultrafiltration_rate_one string
3642
+	var replacement_rate float64
3633 3643
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3634 3644
 	//后期预增脱水量
3635 3645
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
@@ -3751,6 +3761,11 @@ func (this *DialysisAPIController) StartDialysis() {
3751 3761
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3752 3762
 			}
3753 3763
 
3764
+			if adminUserInfo.Org.Id == 10721 {
3765
+				replacement_rate = math.Floor(prescription.ReplacementTotal * 1000 / float64(totalMin) * 60 * 1000)
3766
+				replacement_rate = replacement_rate / 1000
3767
+			}
3768
+
3754 3769
 		}
3755 3770
 	}
3756 3771
 
@@ -3769,6 +3784,7 @@ func (this *DialysisAPIController) StartDialysis() {
3769 3784
 		CreatedTime:            time.Now().Unix(),
3770 3785
 		UpdatedTime:            time.Now().Unix(),
3771 3786
 		UltrafiltrationRateOne: ultrafiltration_rate_one,
3787
+		ReplacementRate:        replacement_rate,
3772 3788
 	}
3773 3789
 
3774 3790
 	//只针对广慈医院
@@ -4834,6 +4850,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4834 4850
 			}
4835 4851
 
4836 4852
 			if adminInfo.Org.Id == 10721 {
4853
+				fmt.Println("prescription.PrescriptionWater-------------------", prescription.PrescriptionWater)
4837 4854
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4838 4855
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4839 4856
 			}
@@ -6164,7 +6181,7 @@ func (c *DialysisAPIController) UploadDryWeight() {
6164 6181
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6165 6182
 
6166 6183
 		//康桥
6167
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 {
6184
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10721 {
6168 6185
 			timeNowStr := time.Now().Format("2006-01-02")
6169 6186
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6170 6187
 

+ 10 - 1
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go View File

@@ -46,9 +46,13 @@ func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
46 46
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
47 47
 		var vlist []interface{}
48 48
 		var elist []interface{}
49
+
49 50
 		for _, item := range patient {
50 51
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
52
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
53
+			item.DialysisSolution = solution
51 54
 			vlist = append(vlist, prescription)
55
+
52 56
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
53 57
 
54 58
 			elist = append(elist, dialysis)
@@ -68,14 +72,19 @@ func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
68 72
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
69 73
 		//查询今日排班的病人
70 74
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
75
+
71 76
 		var vlist []interface{}
72 77
 		var elist []interface{}
78
+
73 79
 		for _, item := range patient {
74 80
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
75 81
 			vlist = append(vlist, prescription)
76 82
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
77
-			fmt.Println("dialysis-------------------------------------------", dialysis)
78 83
 			elist = append(elist, dialysis)
84
+
85
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
86
+			item.DialysisSolution = solution
87
+
79 88
 		}
80 89
 		if err == nil {
81 90
 			this.ServeSuccessJSON(map[string]interface{}{

+ 7 - 4
controllers/patient_api_controller.go View File

@@ -231,6 +231,7 @@ func (c *PatientApiController) GetPatientsList() {
231 231
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
232 232
 	isprescription, _ := c.GetInt64("isprescription", 0)
233 233
 	patientSoureType, _ := c.GetInt64("patientSoureType")
234
+	patient_type, _ := c.GetInt64("patient_type")
234 235
 	nurse, _ := c.GetInt64("nurse")
235 236
 	if page <= 0 {
236 237
 		page = 1
@@ -270,7 +271,7 @@ func (c *PatientApiController) GetPatientsList() {
270 271
 
271 272
 	var patients []*models.Patients
272 273
 	var total int64
273
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse)
274
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type)
274 275
 
275 276
 	c.ServeSuccessJSON(map[string]interface{}{
276 277
 		"patients": patients,
@@ -4689,12 +4690,14 @@ func (c *PatientApiController) GetPatientDialysisRecords() {
4689 4690
 
4690 4691
 	adminInfo := c.GetAdminUserInfo()
4691 4692
 	records, total, _ := service.GetPatientDialysisRecord(adminInfo.CurrentOrgId, patientID, page, limit, theStartTIme, theEndtTIme, mode_id)
4692
-
4693
+	fmt.Println("长度", len(records))
4693 4694
 	if len(records) == 0 {
4694
-		list, _ := service.GetAllDialysisOrder(patientID)
4695
+		list, _ := service.GetAllDialysisOrder(patientID, theStartTIme, theEndtTIme)
4695 4696
 		for _, item := range list {
4696 4697
 			schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType)
4697
-			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
4698
+			prescribeOne, _ := service.GetDialysisPrescribeOne(adminInfo.CurrentOrgId, item.PatientId, item.DialysisDate)
4699
+
4700
+			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID, prescribeOne.ModeId)
4698 4701
 		}
4699 4702
 	}
4700 4703
 	c.ServeSuccessJSON(map[string]interface{}{

+ 13 - 7
controllers/sign_api_controller.go View File

@@ -1227,7 +1227,7 @@ func (this *SignApiController) ToAutoDrug() {
1227 1227
 
1228 1228
 func (this *SignApiController) ToAutoDiagnose() {
1229 1229
 
1230
-	orgId := this.GetAdminUserInfo().CurrentOrgId
1230
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
1231 1231
 
1232 1232
 	//order, _ := service.GetDialysisOrderTotalCount()
1233 1233
 	//
@@ -1242,12 +1242,12 @@ func (this *SignApiController) ToAutoDiagnose() {
1242 1242
 	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1243 1243
 	//}
1244 1244
 
1245
-	list, _ := service.GetAllDialysisOrderTwo(10892)
1246
-	fmt.Println("list=============", list)
1247
-	for _, item := range list {
1248
-		schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
-		service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
-	}
1245
+	//list, _ := service.GetAllDialysisOrderTwo(10340)
1246
+	//
1247
+	//for _, item := range list {
1248
+	//	schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
+	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
+	//}
1251 1251
 
1252 1252
 	//drugList, _ := service.GetAllBaseDrugList(10318)
1253 1253
 	//for _, item := range drugList {
@@ -1261,6 +1261,12 @@ func (this *SignApiController) ToAutoDiagnose() {
1261 1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1262 1262
 	//}
1263 1263
 
1264
+	list, _ := service.GetAllDialysisPrescription(29190)
1265
+
1266
+	for _, item := range list {
1267
+		service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
1268
+	}
1269
+
1264 1270
 	this.ServeSuccessJSON(map[string]interface{}{
1265 1271
 		"msg": "ok",
1266 1272
 	})

+ 5 - 4
models/dialysis_parameter_models.go View File

@@ -104,10 +104,11 @@ func (BloodAutomaticReduceDetail) TableName() string {
104 104
 }
105 105
 
106 106
 type XtScheduleTwo struct {
107
-	ID        int64  `gorm:"column:id" json:"id" form:"id"`
108
-	ModeId    int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
-	PatientId int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
-	Name      string `gorm:"column:name" json:"name" form:"name"`
107
+	ID               int64            `gorm:"column:id" json:"id" form:"id"`
108
+	ModeId           int64            `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
+	PatientId        int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
+	Name             string           `gorm:"column:name" json:"name" form:"name"`
111
+	DialysisSolution DialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
111 112
 }
112 113
 
113 114
 func (XtScheduleTwo) TableName() string {

+ 1 - 0
models/new_stock_models.go View File

@@ -220,6 +220,7 @@ type XtDialysisSetting struct {
220 220
 	GansunaSet                 int64 `gorm:"column:gansuna_set" json:"gansuna_set" form:"gansuna_set"`
221 221
 	ZhetangtieSet              int64 `gorm:"column:zhetangtie_set" json:"zhetangtie_set" form:"zhetangtie_set"`
222 222
 	NiaojimeiSet               int64 `gorm:"column:niaojimei_set" json:"niaojimei_set" form:"niaojimei_set"`
223
+	DialysisStrainerSet        int64 `gorm:"column:dialysis_strainer_set" json:"dialysis_strainer_set" form:"dialysis_strainer_set"`
223 224
 }
224 225
 
225 226
 func (XtDialysisSetting) TableName() string {

+ 6 - 3
service/dialysis_parameter_service.go View File

@@ -1,8 +1,9 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
5
+
6
+	"XT_New/models"
6 7
 	"github.com/jinzhu/gorm"
7 8
 )
8 9
 
@@ -63,6 +64,7 @@ type MonitorDialysisSchedule struct {
63 64
 	AssessmentBeforeDislysis models.PredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
64 65
 	AssessmentAfterDislysis  models.AssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
65 66
 	MonitoringRecord         []models.MonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
67
+	DialysisSolution         models.DialysisSolution        `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
66 68
 }
67 69
 
68 70
 func (MonitorDialysisSchedule) TableName() string {
@@ -70,7 +72,7 @@ func (MonitorDialysisSchedule) TableName() string {
70 72
 }
71 73
 
72 74
 func GetDialysisParametersByKeyword(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, schedulDate int64) ([]*VMDialysisSchedule, error, int64) {
73
-	fmt.Println("scheduletye ======================", schedulType)
75
+
74 76
 	var patients []*models.Patients
75 77
 	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
76 78
 	if getPatientErr != nil {
@@ -118,7 +120,8 @@ func GetDialysisParameter(orgID int64, schedulDate int64, schedulType int64, par
118 120
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, schedulDate).
119 121
 		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, schedulDate).
120 122
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
121
-		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
123
+		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
124
+		Preload("DialysisSolution", "status=1 and user_org_id = ? and solution_status = 1", orgID)
122 125
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
123 126
 	if schedulDate > 0 {
124 127
 		db = db.Where("schedule_date = ?", schedulDate)

+ 58 - 17
service/mobile_dialysis_service.go View File

@@ -2754,6 +2754,13 @@ func GetDialysisPrescribe(orgID int64, patientID int64, recordDate int64) (*mode
2754 2754
 	return &record, nil
2755 2755
 }
2756 2756
 
2757
+func GetDialysisPrescribeOne(orgID int64, patientID int64, recordDate int64) (models.DialysisPrescription, error) {
2758
+	var record models.DialysisPrescription
2759
+	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, recordDate).First(&record).Error
2760
+
2761
+	return record, err
2762
+}
2763
+
2757 2764
 // 透析方案
2758 2765
 func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2759 2766
 	var record models.DialysisSolution
@@ -3279,33 +3286,67 @@ func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his
3279 3286
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
3280 3287
 	his_doctor_advice_str, _ := redis.Get(key).Result()
3281 3288
 	redis.Set(key, "", time.Second)
3282
-	if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3283
-		err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3284
-		if err != nil {
3285
-			if err == gorm.ErrRecordNotFound {
3286
-				if len(his) <= 0 {
3289
+	if orgid != 10721 {
3290
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3291
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3292
+			if err != nil {
3293
+				if err == gorm.ErrRecordNotFound {
3294
+					if len(his) <= 0 {
3295
+						redis.Set(key, "null", time.Second*60*60*18)
3296
+					}
3297
+					return his, nil
3298
+				} else {
3299
+					return his, err
3300
+				}
3301
+			} else {
3302
+				if len(his) > 0 {
3303
+					//缓存数据
3304
+					his_doctor_advice_str, err := json.Marshal(his)
3305
+					if err == nil {
3306
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3307
+					}
3308
+				} else {
3287 3309
 					redis.Set(key, "null", time.Second*60*60*18)
3288 3310
 				}
3289 3311
 				return his, nil
3290
-			} else {
3291
-				return his, err
3292 3312
 			}
3293
-		} else {
3294
-			if len(his) > 0 {
3295
-				//缓存数据
3296
-				his_doctor_advice_str, err := json.Marshal(his)
3297
-				if err == nil {
3298
-					redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3313
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3314
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3315
+			return his, nil
3316
+		}
3317
+	}
3318
+
3319
+	if orgid == 10721 {
3320
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3321
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? and execution_frequency!='上机前' and delivery_way!='口服' ", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3322
+			if err != nil {
3323
+				if err == gorm.ErrRecordNotFound {
3324
+					if len(his) <= 0 {
3325
+						redis.Set(key, "null", time.Second*60*60*18)
3326
+					}
3327
+					return his, nil
3328
+				} else {
3329
+					return his, err
3299 3330
 				}
3300 3331
 			} else {
3301
-				redis.Set(key, "null", time.Second*60*60*18)
3332
+				if len(his) > 0 {
3333
+					//缓存数据
3334
+					his_doctor_advice_str, err := json.Marshal(his)
3335
+					if err == nil {
3336
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3337
+					}
3338
+				} else {
3339
+					redis.Set(key, "null", time.Second*60*60*18)
3340
+				}
3341
+				return his, nil
3302 3342
 			}
3343
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3344
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3303 3345
 			return his, nil
3304 3346
 		}
3305
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
3306
-		json.Unmarshal([]byte(his_doctor_advice_str), &his)
3307
-		return his, nil
3308 3347
 	}
3348
+
3349
+	return his, nil
3309 3350
 }
3310 3351
 
3311 3352
 func GetLastDialysisPrescriptionByPatientId(orgid int64, patientid int64, recorddate int64) (*models.DialysisPrescription, error) {

+ 67 - 24
service/patient_service.go View File

@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 // GetPatientList 返回患者的列表
17
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64) (patients []*models.Patients, total int64, err error) {
17
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64) (patients []*models.Patients, total int64, err error) {
18 18
 
19 19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
20 20
 	if orgID > 0 {
@@ -73,6 +73,9 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
73 73
 	if nurse > 0 {
74 74
 		db = db.Where("p.head_nurse_id = ?", nurse)
75 75
 	}
76
+	if patient_type > 0 {
77
+		db = db.Where("p.patient_type = ?", patient_type)
78
+	}
76 79
 
77 80
 	offset := (page - 1) * limit
78 81
 	if lapseto == 2 || lapseto == 3 {
@@ -472,39 +475,79 @@ func GetAllHisAdvicesByList(orgID int64, scheduleDate int64) (hisAdvices []VMHis
472 475
 	defer redis.Close()
473 476
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":his_advices_list_all"
474 477
 	his_advices_all, _ := redis.Get(key).Result()
475
-
476
-	if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
477
-		err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
478
-		if err != nil {
479
-			if err == gorm.ErrRecordNotFound {
480
-				if len(hisAdvices) <= 0 {
478
+	redis.Set(key, "", time.Second)
479
+	if orgID != 10721 {
480
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
481
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
482
+			if err != nil {
483
+				if err == gorm.ErrRecordNotFound {
484
+					if len(hisAdvices) <= 0 {
485
+						redis.Set(key, "null", time.Second*60*60*18)
486
+					}
487
+					return nil, nil
488
+				} else {
489
+					return nil, err
490
+				}
491
+			} else {
492
+				if len(hisAdvices) > 0 {
493
+					//缓存数据
494
+					his_advices_all, err := json.Marshal(&hisAdvices)
495
+					if err == nil {
496
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
497
+					}
498
+				} else {
481 499
 					redis.Set(key, "null", time.Second*60*60*18)
482 500
 				}
501
+				return hisAdvices, nil
502
+			}
503
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
504
+			if his_advices_all == "null" {
483 505
 				return nil, nil
484 506
 			} else {
485
-				return nil, err
507
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
508
+				return hisAdvices, nil
486 509
 			}
487
-		} else {
488
-			if len(hisAdvices) > 0 {
489
-				//缓存数据
490
-				his_advices_all, err := json.Marshal(&hisAdvices)
491
-				if err == nil {
492
-					redis.Set(key, his_advices_all, time.Second*60*60*18)
510
+
511
+		}
512
+	}
513
+
514
+	if orgID == 10721 {
515
+
516
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
517
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ? and execution_frequency !='上机前' and delivery_way!='口服' ", orgID, scheduleDate).Find(&hisAdvices).Error
518
+			if err != nil {
519
+				if err == gorm.ErrRecordNotFound {
520
+					if len(hisAdvices) <= 0 {
521
+						redis.Set(key, "null", time.Second*60*60*18)
522
+					}
523
+					return nil, nil
524
+				} else {
525
+					return nil, err
493 526
 				}
494 527
 			} else {
495
-				redis.Set(key, "null", time.Second*60*60*18)
528
+				if len(hisAdvices) > 0 {
529
+					//缓存数据
530
+					his_advices_all, err := json.Marshal(&hisAdvices)
531
+					if err == nil {
532
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
533
+					}
534
+				} else {
535
+					redis.Set(key, "null", time.Second*60*60*18)
536
+				}
537
+				return hisAdvices, nil
538
+			}
539
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
540
+			if his_advices_all == "null" {
541
+				return nil, nil
542
+			} else {
543
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
544
+				return hisAdvices, nil
496 545
 			}
497
-			return hisAdvices, nil
498
-		}
499
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
500
-		if his_advices_all == "null" {
501
-			return nil, nil
502
-		} else {
503
-			json.Unmarshal([]byte(his_advices_all), &hisAdvices)
504
-			return hisAdvices, nil
505
-		}
506 546
 
547
+		}
507 548
 	}
549
+
550
+	return hisAdvices, nil
508 551
 }
509 552
 
510 553
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {

+ 22 - 7
service/sign_service.go View File

@@ -2110,16 +2110,31 @@ func UpdateAllPatient(id int64, diagose string, orgid int64) error {
2110 2110
 	return err
2111 2111
 }
2112 2112
 
2113
-func GetAllDialysisOrderTwo(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2113
+func GetAllDialysisOrderTwo(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2114 2114
 
2115
-	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1696089600", patient_id).Find(&list).Error
2115
+	err = XTReadDB().Where("user_org_id = ? and status =1 and dialysis_date=1730736000", user_org_id).Find(&list).Error
2116 2116
 
2117 2117
 	return list, err
2118 2118
 }
2119 2119
 
2120
-func GetAllDialysisOrder(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2120
+func GetAllDialysisPrescription(patient_id int64) (list []*models.XtDialysisPrescription, err error) {
2121 2121
 
2122
-	err = XTReadDB().Where("patient_id = ? and status =1", patient_id).Find(&list).Error
2122
+	err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
2123
+
2124
+	return list, err
2125
+}
2126
+func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
2127
+
2128
+	schedule := models.XtSchedule{}
2129
+
2130
+	err := XTWriteDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and status=1 and user_org_id =?", patient_id, record_date, user_org_id).Updates(map[string]interface{}{"mode_id": mode_id}).Error
2131
+
2132
+	return schedule, err
2133
+}
2134
+
2135
+func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
2136
+
2137
+	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=? and dialysis_date<=?", patient_id, start_time, end_time).Find(&list).Error
2123 2138
 
2124 2139
 	return list, err
2125 2140
 }
@@ -2127,14 +2142,14 @@ func GetAllDialysisOrder(patient_id int64) (list []*models.XtDialysisOrder, err
2127 2142
 func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
2128 2143
 
2129 2144
 	schedule := models.Schedule{}
2130
-	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and status=0", patient_id, schedule_date).First(&schedule).Error
2145
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ?", patient_id, schedule_date).First(&schedule).Error
2131 2146
 
2132 2147
 	return schedule, err
2133 2148
 }
2134 2149
 
2135
-func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64) error {
2150
+func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64, mode_id int64) error {
2136 2151
 
2137
-	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1}).Error
2152
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1, "mode_id": mode_id}).Error
2138 2153
 	return err
2139 2154
 }
2140 2155