Browse Source

修改模版22超滤量和超滤率自动计算方式

csx 4 years ago
parent
commit
7037b172fb

+ 1 - 1
controllers/dialysis_record_api_controller.go View File

@@ -1714,7 +1714,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1714 1714
 								Status:                  1,
1715 1715
 								RecordTime:              startDate.Unix(),
1716 1716
 								OrgId:                   adminUserInfo.CurrentOrgId,
1717
-								GoodId:                  prescription.Dialyzer,
1717
+								GoodId:                  prescription.Dialyzers,
1718 1718
 								GoodTypeId:              dialyzers,
1719 1719
 							}
1720 1720
 							service.AddSigleAutoReduceRecordInfo(details)

+ 6 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -330,6 +330,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
330 330
 	// 	return
331 331
 	// }
332 332
 
333
+	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
334
+
335
+	if template.TemplateId == 22 {
336
+		dewater_amount = dewater_amount * 1000
337
+	}
338
+
333 339
 	if dialysistype == 1 {
334 340
 		// 保存透前相关数据
335 341
 		// 获取透析处方

+ 2 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -99,7 +99,7 @@ func (this *DialysisAPIController) Scheduals() {
99 99
 				//缓存数据
100 100
 				scheduals_json, err := json.Marshal(scheduals)
101 101
 				if err == nil {
102
-					redis.Set(key, scheduals_json, time.Minute*1)
102
+					redis.Set(key, scheduals_json, time.Second*30)
103 103
 				}
104 104
 			}
105 105
 
@@ -3827,7 +3827,7 @@ func (this *DialysisAPIController) StartDialysis() {
3827 3827
 								Status:                  1,
3828 3828
 								RecordTime:              startDate.Unix(),
3829 3829
 								OrgId:                   adminUserInfo.Org.Id,
3830
-								GoodId:                  prescription.Dialyzer,
3830
+								GoodId:                  prescription.Dialyzers,
3831 3831
 								GoodTypeId:              dialyzers,
3832 3832
 							}
3833 3833
 							service.AddSigleAutoReduceRecordInfo(details)

+ 18 - 2
controllers/schedule_api_controller.go View File

@@ -547,6 +547,8 @@ func (c *ScheduleApiController) ChangeSchedule() {
547 547
 // @param date:string yyyy-MM-dd 要打印的那一周中的任一天
548 548
 func (this *ScheduleApiController) PrintInitData() {
549 549
 	dateStr := this.GetString("date")
550
+	//week_type, _ := this.GetInt64("type", 0)
551
+
550 552
 	var date *time.Time
551 553
 	if len(dateStr) == 0 {
552 554
 		now := time.Now()
@@ -562,7 +564,21 @@ func (this *ScheduleApiController) PrintInitData() {
562 564
 
563 565
 	adminUserInfo := this.GetAdminUserInfo()
564 566
 	// 获取本周的排班
565
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(date)
567
+	var monday time.Time
568
+	var sunday time.Time
569
+	//switch week_type {
570
+	//case 1:
571
+	monday, sunday = utils.GetMondayAndSundayOfWeekDate(date)
572
+
573
+	//	break
574
+	//case 2:
575
+	//	monday, sunday = utils.GetMondayAndSundayOfNextWeekDate(date)
576
+	//
577
+	//	break
578
+	//case 3:
579
+	//	monday, sunday = utils.GetMondayAndSundayOfNextNextWeekDate(date)
580
+	//	break
581
+	//}
566 582
 	schedules, getScheduleErr := service.GetPrinitWeekSchedules(adminUserInfo.CurrentOrgId, monday.Unix(), sunday.Unix())
567 583
 	if getScheduleErr != nil {
568 584
 		this.ErrorLog("获取周排班失败:%v", getScheduleErr)
@@ -570,7 +586,7 @@ func (this *ScheduleApiController) PrintInitData() {
570 586
 		return
571 587
 	}
572 588
 
573
-	thisTime := time.Now()
589
+	thisTime := date
574 590
 
575 591
 	weekDay := int(thisTime.Weekday())
576 592
 	if weekDay == 0 {

+ 8 - 5
models/dialysis.go View File

@@ -274,11 +274,14 @@ func (PredialysisEvaluation) TableName() string {
274 274
 }
275 275
 
276 276
 type PredialysisEvaluationList struct {
277
-	ID             int64   `gorm:"column:id" json:"id"`
278
-	UserOrgId      int64   `gorm:"column:user_org_id" json:"user_org_id"`
279
-	PatientId      int64   `gorm:"column:patient_id" json:"patient_id"`
280
-	AssessmentDate int64   `gorm:"column:assessment_date" json:"assessment_date"`
281
-	WeightBefore   float64 `gorm:"column:weight_before" json:"weight_before"`
277
+	ID                     int64   `gorm:"column:id" json:"id"`
278
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
279
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id"`
280
+	AssessmentDate         int64   `gorm:"column:assessment_date" json:"assessment_date"`
281
+	WeightBefore           float64 `gorm:"column:weight_before" json:"weight_before"`
282
+	CreatedTime            int64   `gorm:"column:created_time" json:"created_time"`
283
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
284
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
282 285
 }
283 286
 
284 287
 func (PredialysisEvaluationList) TableName() string {

+ 13 - 1
service/mobile_dialysis_service.go View File

@@ -74,6 +74,18 @@ func MobileGetWaitingScheduals(orgID int64, scheduleDate int64) ([]*MDialysisSch
74 74
 	return vms, err
75 75
 }
76 76
 
77
+type VMTreatmentSummary struct {
78
+	ID              int64  `gorm:"column:id" json:"id"`
79
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id"`
80
+	PatientId       int64  `gorm:"column:patient_id" json:"patient_id"`
81
+	AssessmentDate  int64  `gorm:"column:assessment_date" json:"assessment_date"`
82
+	DialysisSummary string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
83
+}
84
+
85
+func (VMTreatmentSummary) TableName() string {
86
+	return "xt_treatment_summary"
87
+}
88
+
77 89
 type MDialysisScheduleVM struct {
78 90
 	ID           int64 `gorm:"column:id" json:"id"`
79 91
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
@@ -91,7 +103,7 @@ type MDialysisScheduleVM struct {
91 103
 	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"prescription"`
92 104
 	AssessmentBeforeDislysis *models.PredialysisEvaluationList `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"assessment_before_dislysis"`
93 105
 	Advices                  []*VMDoctorAdvice                 `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
94
-	TreatmentSummary         *models.TreatmentSummary          `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"treatment_summary"`
106
+	TreatmentSummary         *VMTreatmentSummary               `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"treatment_summary"`
95 107
 }
96 108
 
97 109
 func (MDialysisScheduleVM) TableName() string {

+ 1 - 1
service/stock_service.go View File

@@ -1186,7 +1186,7 @@ func FindAllGoodTypeByType(types int64) (goodType []*models.GoodsType, err error
1186 1186
 }
1187 1187
 
1188 1188
 func FindWarehouseInfoByGoodType(good_type_id int64, org_id int64) (info []*models.WarehousingInfo, err error) {
1189
-	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", " org_id = ? AND good_type_id = ? AND status = 1", org_id, good_type_id).Where(" org_id = ? AND good_type_id = ?  AND status = 1 ", org_id, good_type_id).Find(&info).Error
1189
+	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", " org_id = ? AND good_type_id = ? AND status = 1 AND specification_name <> '' ", org_id, good_type_id).Where(" org_id = ? AND good_type_id = ?  AND status = 1 ", org_id, good_type_id).Find(&info).Error
1190 1190
 	return info, err
1191 1191
 
1192 1192
 }

+ 30 - 0
utils/tools.go View File

@@ -229,3 +229,33 @@ func GetMondayAndSundayOfWeekDate(date *time.Time) (time.Time, time.Time) {
229 229
 	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 7-weekday).Format("2006-01-02")+" 23:59:59", loc)
230 230
 	return monday, sunday
231 231
 }
232
+
233
+func GetMondayAndSundayOfNextWeekDate(date *time.Time) (time.Time, time.Time) {
234
+	if date == nil {
235
+		now := time.Now()
236
+		date = &now
237
+	}
238
+	weekday := int(date.Weekday())
239
+	if weekday == 0 {
240
+		weekday = 7
241
+	}
242
+	loc, _ := time.LoadLocation("Local")
243
+	monday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 8-weekday).Format("2006-01-02")+" 00:00:00", loc)
244
+	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 14-weekday).Format("2006-01-02")+" 23:59:59", loc)
245
+	return monday, sunday
246
+}
247
+
248
+func GetMondayAndSundayOfNextNextWeekDate(date *time.Time) (time.Time, time.Time) {
249
+	if date == nil {
250
+		now := time.Now()
251
+		date = &now
252
+	}
253
+	weekday := int(date.Weekday())
254
+	if weekday == 0 {
255
+		weekday = 7
256
+	}
257
+	loc, _ := time.LoadLocation("Local")
258
+	monday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 15-weekday).Format("2006-01-02")+" 00:00:00", loc)
259
+	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 21-weekday).Format("2006-01-02")+" 23:59:59", loc)
260
+	return monday, sunday
261
+}