Browse Source

2024/6/17

28169 1 month ago
parent
commit
eeeade974e

BIN
XT_New.exe View File


+ 12 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -319,7 +319,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
319 319
 
320 320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
321 321
 
322
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 {
322
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10731 {
323 323
 		if adminUserInfo.Org.Id != 10447 {
324 324
 			dewater_amount = dewater_amount * 1000
325 325
 		}
@@ -954,6 +954,9 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
954 954
 				if adminUserInfo.Org.Id == 10721 {
955 955
 					evaluation.Temperature = 36.5
956 956
 				}
957
+				if adminUserInfo.Org.Id == 10702 {
958
+					evaluation.PulseFrequency = 0
959
+				}
957 960
 			}
958 961
 		} else {
959 962
 			evaluation.UpdatedTime = time.Now().Unix()
@@ -974,6 +977,14 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
974 977
 			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
975 978
 		}
976 979
 
980
+		//针对古镇乐生
981
+		if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
982
+
983
+			dewater_amount = (evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight) * 1000
984
+			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
985
+			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
986
+		}
987
+
977 988
 		err := service.UpadatePredialysisEvaluation(&evaluation)
978 989
 
979 990
 		//记录日志

+ 19 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -3011,7 +3011,7 @@ func (c *DialysisAPIController) Finish() {
3011 3011
 
3012 3012
 	}
3013 3013
 
3014
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 {
3014
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 {
3015 3015
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3016 3016
 		if evaluation.SystolicBloodPressure == 0 {
3017 3017
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -3937,7 +3937,7 @@ func (this *DialysisAPIController) StartDialysis() {
3937 3937
 
3938 3938
 			}
3939 3939
 
3940
-			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 {
3940
+			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 || adminUserInfo.Org.Id == 10731 {
3941 3941
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3942 3942
 				ultrafiltration_rate = ultrafiltration_rate
3943 3943
 			}
@@ -3972,6 +3972,21 @@ func (this *DialysisAPIController) StartDialysis() {
3972 3972
 				}
3973 3973
 			}
3974 3974
 
3975
+			if adminUserInfo.Org.Id == 10702 {
3976
+				if prescription.ModeId == 2 {
3977
+					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3978
+					if totalMin == 0 {
3979
+						totalMin = 240
3980
+					}
3981
+					if prescription.DisplaceLiquiValue == 0 {
3982
+						prescription.ReplacementTotal = 32
3983
+					}
3984
+
3985
+					//乘10 除10是为了保留一位小数
3986
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
3987
+				}
3988
+			}
3989
+
3975 3990
 		}
3976 3991
 	}
3977 3992
 
@@ -5076,7 +5091,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5076 5091
 				record.UltrafiltrationRate = ultrafiltration_rate
5077 5092
 			}
5078 5093
 
5079
-			if template.TemplateId == 20 || template.TemplateId == 22 {
5094
+			if template.TemplateId == 20 || template.TemplateId == 22 || adminInfo.Org.Id == 10731 {
5080 5095
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5081 5096
 				record.UltrafiltrationRate = ultrafiltration_rate
5082 5097
 			}
@@ -5226,7 +5241,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5226 5241
 		record.UltrafiltrationVolume = 0
5227 5242
 	}
5228 5243
 
5229
-	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 {
5244
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 {
5230 5245
 		if ultrafiltration_rate > 0 {
5231 5246
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5232 5247
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000

+ 127 - 4
controllers/patient_api_controller.go View File

@@ -162,6 +162,12 @@ func PatientApiRegistRouters() {
162 162
 
163 163
 	beego.Router("/api/patient/getpatientlapeso", &DialysisApiController{}, "Get:GetPatientLapseList")
164 164
 
165
+	beego.Router("/api/patient/adddeathsummary", &DialysisApiController{}, "Post:AddDeathSummary")
166
+
167
+	beego.Router("/api/patient/getpatientdeathsummary", &DialysisApiController{}, "Get:GetPatientDeathSummary")
168
+
169
+	beego.Router("/api/patient/deletepatientdeathsummary", &DialysisApiController{}, "Get:DeletePatientDeathSummary")
170
+
165 171
 }
166 172
 func (c *PatientApiController) GetExportList() {
167 173
 	startTime := c.GetString("start_time")
@@ -7626,6 +7632,8 @@ func (c *PatientApiController) SavePatientLapse() {
7626 7632
 
7627 7633
 	end_time_one := dataBody["end_time_one"].(string)
7628 7634
 
7635
+	is_check := int64(dataBody["is_check"].(float64))
7636
+
7629 7637
 	timeLayout := "2006-01-02"
7630 7638
 	loc, _ := time.LoadLocation("Local")
7631 7639
 	var recordDate int64
@@ -7711,9 +7719,11 @@ func (c *PatientApiController) SavePatientLapse() {
7711 7719
 
7712 7720
 		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
7713 7721
 
7714
-		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7722
+		if is_check == 2 {
7723
+			service.UpdateScheduleByDeathTime(patient_id, recordDate)
7724
+			service.UpdateScheduleItemByPatientId(patient_id)
7725
+		}
7715 7726
 
7716
-		service.UpdateScheduleItemByPatientId(patient_id)
7717 7727
 	}
7718 7728
 
7719 7729
 	//病人转出
@@ -7721,9 +7731,11 @@ func (c *PatientApiController) SavePatientLapse() {
7721 7731
 
7722 7732
 		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
7723 7733
 
7724
-		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7734
+		if is_check == 2 {
7735
+			service.UpdateScheduleByDeathTime(patient_id, recordDate)
7736
+			service.UpdateScheduleItemByPatientId(patient_id)
7737
+		}
7725 7738
 
7726
-		service.UpdateScheduleItemByPatientId(patient_id)
7727 7739
 	}
7728 7740
 
7729 7741
 	if lapse_type == 11 {
@@ -8024,3 +8036,114 @@ func (c *DialysisApiController) GetPatientLapseList() {
8024 8036
 	//
8025 8037
 	//}
8026 8038
 }
8039
+
8040
+func (c *DialysisApiController) AddDeathSummary() {
8041
+
8042
+	dataBody := make(map[string]interface{}, 0)
8043
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
8044
+	fmt.Println(err)
8045
+
8046
+	id := int64(dataBody["id"].(float64))
8047
+
8048
+	patient_id := int64(dataBody["patient_id"].(float64))
8049
+
8050
+	record_date := dataBody["record_date"].(string)
8051
+
8052
+	last_record_date := dataBody["last_record_date"].(string)
8053
+
8054
+	reason_one := dataBody["reason_one"].(string)
8055
+
8056
+	reason_two := dataBody["reason_two"].(string)
8057
+
8058
+	reason_three := dataBody["reason_three"].(string)
8059
+
8060
+	reason_four := dataBody["reason_four"].(string)
8061
+
8062
+	death_way := dataBody["death_way"].(string)
8063
+
8064
+	replace_way := dataBody["replace_way"].(string)
8065
+
8066
+	replace_reason := dataBody["replace_reason"].(string)
8067
+
8068
+	transplant := dataBody["transplant"].(string)
8069
+
8070
+	remark := dataBody["remark"].(string)
8071
+
8072
+	timeLayout := "2006-01-02"
8073
+	loc, _ := time.LoadLocation("Local")
8074
+	var recordDate int64
8075
+	if len(record_date) > 0 {
8076
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
8077
+		if err != nil {
8078
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8079
+			return
8080
+		}
8081
+		recordDate = theTime.Unix()
8082
+	}
8083
+
8084
+	var lastRecordDate int64
8085
+	if len(record_date) > 0 {
8086
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", last_record_date+" 00:00:00", loc)
8087
+		if err != nil {
8088
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8089
+			return
8090
+		}
8091
+		lastRecordDate = theTime.Unix()
8092
+	}
8093
+
8094
+	orgId := c.GetAdminUserInfo().CurrentOrgId
8095
+
8096
+	admin_user_id := c.GetAdminUserInfo().AdminUser.Id
8097
+
8098
+	deathSummary := models.XtDeathSummary{
8099
+		ID:             id,
8100
+		PatientId:      patient_id,
8101
+		UserOrgId:      orgId,
8102
+		RecordDate:     recordDate,
8103
+		ReasonOne:      reason_one,
8104
+		ReasonTwo:      reason_two,
8105
+		ReasonThree:    reason_three,
8106
+		ReasonFour:     reason_four,
8107
+		DeathWay:       death_way,
8108
+		ReplaceWay:     replace_way,
8109
+		ReplaceReason:  replace_reason,
8110
+		Transplant:     transplant,
8111
+		Ctime:          time.Now().Unix(),
8112
+		Remark:         remark,
8113
+		Mtime:          time.Now().Unix(),
8114
+		Status:         1,
8115
+		AdminUserId:    admin_user_id,
8116
+		UpdateCreater:  admin_user_id,
8117
+		LastRecordDate: lastRecordDate,
8118
+	}
8119
+
8120
+	service.CreateDeathSummary(deathSummary)
8121
+
8122
+	c.ServeSuccessJSON(map[string]interface{}{
8123
+		"deathSummary": deathSummary,
8124
+	})
8125
+}
8126
+
8127
+func (c *DialysisApiController) GetPatientDeathSummary() {
8128
+
8129
+	patient_id, _ := c.GetInt64("patient_id")
8130
+
8131
+	orgId := c.GetAdminUserInfo().CurrentOrgId
8132
+
8133
+	deathSummary, _ := service.GetPatientDeathSummary(patient_id, orgId)
8134
+
8135
+	c.ServeSuccessJSON(map[string]interface{}{
8136
+		"deathSummary": deathSummary,
8137
+	})
8138
+}
8139
+
8140
+func (c *DialysisApiController) DeletePatientDeathSummary() {
8141
+
8142
+	id, _ := c.GetInt64("id")
8143
+
8144
+	service.DeletePatientDeathSummary(id)
8145
+
8146
+	c.ServeSuccessJSON(map[string]interface{}{
8147
+		"msg": "删除成功",
8148
+	})
8149
+}

+ 0 - 9
controllers/patient_dataconfig_api_controller.go View File

@@ -866,15 +866,6 @@ func (this *PatientDataConfigAPIController) DeleteCourse() {
866 866
 	}
867 867
 
868 868
 	adminUserInfo := this.GetAdminUserInfo()
869
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
870
-	if getPatientErr != nil {
871
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
872
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
873
-		return
874
-	} else if patient == nil {
875
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
876
-		return
877
-	}
878 869
 
879 870
 	recordIDStrs := strings.Split(idsStr, ",")
880 871
 	recordIDs := make([]int64, 0, len(recordIDStrs))

+ 27 - 0
models/patient_models.go View File

@@ -2803,3 +2803,30 @@ func (XtPatientLaspseRecord) TableName() string {
2803 2803
 
2804 2804
 	return "xt_patient_laspse_record"
2805 2805
 }
2806
+
2807
+type XtDeathSummary struct {
2808
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
2809
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2810
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2811
+	RecordDate     int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2812
+	ReasonOne      string `gorm:"column:reason_one" json:"reason_one" form:"reason_one"`
2813
+	ReasonTwo      string `gorm:"column:reason_two" json:"reason_two" form:"reason_two"`
2814
+	ReasonThree    string `gorm:"column:reason_three" json:"reason_three" form:"reason_three"`
2815
+	ReasonFour     string `gorm:"column:reason_four" json:"reason_four" form:"reason_four"`
2816
+	DeathWay       string `gorm:"column:death_way" json:"death_way" form:"death_way"`
2817
+	ReplaceWay     string `gorm:"column:replace_way" json:"replace_way" form:"replace_way"`
2818
+	ReplaceReason  string `gorm:"column:replace_reason" json:"replace_reason" form:"replace_reason"`
2819
+	Transplant     string `gorm:"column:transplant" json:"transplant" form:"transplant"`
2820
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2821
+	Remark         string `gorm:"column:remark" json:"remark" form:"remark"`
2822
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2823
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
2824
+	AdminUserId    int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2825
+	UpdateCreater  int64  `gorm:"column:update_creater" json:"update_creater" form:"update_creater"`
2826
+	LastRecordDate int64  `gorm:"column:last_record_date" json:"last_record_date" form:"last_record_date"`
2827
+}
2828
+
2829
+func (XtDeathSummary) TableName() string {
2830
+
2831
+	return "xt_death_summary"
2832
+}

+ 25 - 0
service/patient_service.go View File

@@ -4359,3 +4359,28 @@ func GetDialysisPrescribeOneList(patient_id int64, record_date int64, user_org_i
4359 4359
 
4360 4360
 	return prescription, err
4361 4361
 }
4362
+
4363
+func CreateDeathSummary(summary models.XtDeathSummary) error {
4364
+
4365
+	err := XTWriteDB().Save(&summary).Error
4366
+
4367
+	return err
4368
+}
4369
+
4370
+func GetPatientDeathSummary(patient_id int64, user_org_id int64) (models.XtDeathSummary, error) {
4371
+
4372
+	deathSummary := models.XtDeathSummary{}
4373
+
4374
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and status=1", patient_id, user_org_id).Find(&deathSummary).Error
4375
+
4376
+	return deathSummary, err
4377
+}
4378
+
4379
+func DeletePatientDeathSummary(id int64) error {
4380
+
4381
+	summary := models.XtDeathSummary{}
4382
+
4383
+	err := XTWriteDB().Model(&summary).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4384
+
4385
+	return err
4386
+}