Browse Source

修改问题

张保健 3 years ago
parent
commit
36b96187b7

+ 7 - 1
controllers/dialysis_api_controller.go View File

@@ -3298,11 +3298,15 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3298 3298
 		//
3299 3299
 
3300 3300
 		//新增逻辑
3301
+		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
3301 3302
 
3302 3303
 		var dewater_amount float64
3303 3304
 		dewater_amount = 0
3304 3305
 		if evaluation.DryWeight > 0 {
3305 3306
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3307
+			if templateInfo.TemplateId == 17 {
3308
+				dewater_amount = dewater_amount * 1000
3309
+			}
3306 3310
 			if dewater_amount <= 0 {
3307 3311
 				dewater_amount = 0
3308 3312
 			}
@@ -4853,15 +4857,17 @@ func (this *DialysisApiController) GetTodayMonitor() {
4853 4857
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4854 4858
 			if template.TemplateId == 6 { //adminInfo.CurrentOrgId == 9538
4855 4859
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4860
+				record.UltrafiltrationRate = ultrafiltration_rate
4856 4861
 			}
4857 4862
 			// 只针对方济医院
4858 4863
 			if template.TemplateId == 1 {
4859 4864
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
4860 4865
 				ultrafiltration_rate = value
4866
+				record.UltrafiltrationRate = ultrafiltration_rate
4861 4867
 			}
4862 4868
 		}
4863 4869
 	}
4864
-	record.UltrafiltrationRate = ultrafiltration_rate
4870
+	// record.UltrafiltrationRate = ultrafiltration_rate
4865 4871
 	record.UltrafiltrationVolume = 0
4866 4872
 	if template.TemplateId == 1 {
4867 4873
 		if ultrafiltration_rate > 0 {

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

@@ -679,6 +679,24 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
679 679
 	}
680 680
 }
681 681
 
682
+func (c *CheckWeightApiController) GetPatientList() {
683
+	syncTime,_ := c.GetInt64("synctime", 0)
684
+	force,_ := c.GetInt64("force", 0)
685
+	adminUserInfo := c.GetMobileAdminUserInfo()
686
+	patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id,syncTime, force)
687
+	if error != nil {
688
+		c.ErrorLog("获取病人列表失败:%v", error)
689
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
690
+		return
691
+	}
692
+	serviceTime := time.Now().Unix()
693
+	c.ServeSuccessJSON(map[string]interface{}{
694
+		"patientlist": patientList,
695
+		"total": total,
696
+		"servicetime": serviceTime,
697
+	})
698
+}
699
+
682 700
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
683 701
 	id, _ := c.GetInt64("patient", 0)
684 702
 	if id <= 0 {

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

@@ -5532,15 +5532,17 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5532 5532
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5533 5533
 			if template.TemplateId == 6 {
5534 5534
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5535
+				record.UltrafiltrationRate = ultrafiltration_rate
5535 5536
 			}
5536 5537
 			// 只针对方济医院
5537 5538
 			if template.TemplateId == 1 {
5538 5539
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
5539 5540
 				ultrafiltration_rate = value
5541
+				record.UltrafiltrationRate = ultrafiltration_rate
5540 5542
 			}
5541 5543
 		}
5542 5544
 	}
5543
-	record.UltrafiltrationRate = ultrafiltration_rate
5545
+	// record.UltrafiltrationRate = ultrafiltration_rate
5544 5546
 	record.UltrafiltrationVolume = 0
5545 5547
 	if template.TemplateId == 1 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
5546 5548
 		if ultrafiltration_rate > 0 {

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

@@ -11,6 +11,7 @@ func MobileAPIControllersRegisterRouters() {
11 11
 	// beego.Router("/m/api/test", &DialysisTestAPIController{}, "get:Test")
12 12
 	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
13 13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14
+	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
14 15
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
15 16
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")
16 17
 	beego.Router("/m/api/scheduals", &DialysisAPIController{}, "get:Scheduals")

+ 4 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -843,6 +843,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
843 843
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
844 844
 		return
845 845
 	}
846
+	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
846 847
 	//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
847 848
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
848 849
 	var evaluation models.PredialysisEvaluation
@@ -890,6 +891,9 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
890 891
 	dewater_amount = 0
891 892
 	if evaluation.DryWeight > 0 {
892 893
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
894
+		if template.TemplateId == 17 {
895
+			dewater_amount = dewater_amount * 1000
896
+		}
893 897
 		if dewater_amount <= 0 {
894 898
 			dewater_amount = 0
895 899
 		}

+ 17 - 0
models/patient_models.go View File

@@ -1,5 +1,22 @@
1 1
 package models
2 2
 
3
+type PatientListForFace struct {
4
+	ID                           int64                `gorm:"column:id" json:"id" form:"id"`
5
+	UserOrgId                    int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6
+	Avatar                       string               `gorm:"column:avatar" json:"avatar" form:"avatar"`
7
+	DialysisNo                   string               `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
8
+	IdCardNo                     string               `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
9
+	Birthday                     int64                `gorm:"column:birthday" json:"birthday" form:"birthday"`
10
+	Phone                        string               `gorm:"column:phone" json:"phone" form:"phone"`	
11
+	Age                          int64                `gorm:"column:age" json:"age"`
12
+	CreatedTime                  int64                `gorm:"column:created_time" json:"created_time" form:"created_time"`
13
+	UpdatedTime                  int64                `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
14
+}
15
+
16
+func (PatientListForFace) TableName() string {
17
+	return "xt_patients"
18
+}
19
+
3 20
 type Patients struct {
4 21
 	ID                           int64                `gorm:"column:id" json:"id" form:"id"`
5 22
 	UserOrgId                    int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 9 - 0
service/patient_service.go View File

@@ -80,6 +80,15 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
80 80
 	return
81 81
 }
82 82
 
83
+func GetPatientListByUpdateTime(orgID int64,syncTime int64,force int64) (patients []*models.PatientListForFace, total int64, err error) {
84
+	db := readDb.Model(&models.PatientListForFace{}).Where("user_org_id=? and status=1", orgID)
85
+	if force == 0 {
86
+		db = db.Where("updated_time >= ?", syncTime)
87
+	}
88
+	err = db.Count(&total).Find(&patients).Error
89
+	return
90
+}
91
+
83 92
 func GetPatientCount(orgID int64) (total int64) {
84 93
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
85 94
 	return