Browse Source

提交代码

陈少旭 1 month ago
parent
commit
1ff0bda29e
2 changed files with 5 additions and 5 deletions
  1. 2 1
      controllers/statistics_api_controller.go
  2. 3 4
      service/statistis_qc_service.go

+ 2 - 1
controllers/statistics_api_controller.go View File

@@ -93,6 +93,7 @@ func (c *StatisticsApiController) GetPatientWeightDetail() {
93 93
 	after_type, _ := c.GetInt64("after_type")
94 94
 	page, _ := c.GetInt64("page")
95 95
 	limit, _ := c.GetInt64("limit")
96
+	keyword := c.GetString("keyword")
96 97
 
97 98
 	timeLayout := "2006-01-02"
98 99
 	loc, _ := time.LoadLocation("Local")
@@ -116,7 +117,7 @@ func (c *StatisticsApiController) GetPatientWeightDetail() {
116 117
 		}
117 118
 		endTime = theTime.Unix()
118 119
 	}
119
-	data, total, _ := service.GetNewDialysisWeightDetailTableTen(c.GetAdminUserInfo().CurrentOrgId, startTime, endTime, add_type, dry_type, after_type, page, limit)
120
+	data, total, _ := service.GetNewDialysisWeightDetailTableTen(c.GetAdminUserInfo().CurrentOrgId, startTime, endTime, add_type, dry_type, after_type, page, limit, keyword)
120 121
 	fmt.Println(data)
121 122
 	c.ServeSuccessJSON(map[string]interface{}{
122 123
 		"list":  data,

+ 3 - 4
service/statistis_qc_service.go View File

@@ -2090,12 +2090,11 @@ func GetNewDialysisWeightDetailTableTen(
2090 2090
 	user_org_id int64,
2091 2091
 	start_time int64,
2092 2092
 	end_time int64,
2093
-	addType, dryType, afterType, page, limit int64,
2094
-) ([]DialysisDataTwo, int64, error) {
2093
+	addType, dryType, afterType, page, limit int64, keyword string) ([]DialysisDataTwo, int64, error) {
2095 2094
 	offset := (page - 1) * limit
2096 2095
 	//var dialysisData []DialysisDataTwo
2097 2096
 	var total int64
2098
-
2097
+	keyword = "%" + keyword + "%"
2099 2098
 	// 构建基本查询
2100 2099
 	query := readDb.Table("xt_assessment_before_dislysis b").
2101 2100
 		Select(`
@@ -2159,7 +2158,7 @@ func GetNewDialysisWeightDetailTableTen(
2159 2158
                ELSE '其他'
2160 2159
            END AS weight_status
2161 2160
        `).
2162
-		Joins("left JOIN xt_patients p ON p.id = b.patient_id").
2161
+		Joins("JOIN xt_patients p ON p.id = b.patient_id and p.name like ?", keyword).
2163 2162
 		Joins("left JOIN xt_assessment_after_dislysis a ON p.id = a.patient_id AND b.assessment_date = a.assessment_date AND a.status = 1").
2164 2163
 		Where("b.user_org_id = ?", user_org_id).
2165 2164
 		Where("b.assessment_date >= ?", start_time).