XMLWAN 4 years ago
parent
commit
4ce41288ee

+ 36 - 40
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -89,20 +89,20 @@ func (this *CommonApiController) SaveConfiguration() {
89 89
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
90 90
 	fmt.Println("err", err)
91 91
 	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
92
-	fmt.Println("大项", inspectionmajor)
92
+	//fmt.Println("大项", inspectionmajor)
93 93
 	inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
94
-	fmt.Println("小项", inspectionMinor)
94
+	//fmt.Println("小项", inspectionMinor)
95 95
 	minrange := dataBody["min_range"].(string)
96
-	fmt.Println("minragne", minrange)
96
+	//fmt.Println("minragne", minrange)
97 97
 	largerange := dataBody["large_range"].(string)
98 98
 	fmt.Println("largerange", largerange)
99 99
 	sort := dataBody["sort"].(string)
100 100
 	sorts, err := strconv.ParseInt(sort, 10, 64)
101
-	fmt.Println("sort", sort)
101
+	//fmt.Println("sort", sort)
102 102
 	checktype := int64(dataBody["check_type"].(float64))
103
-	fmt.Println("检查类型", checktype)
103
+	//fmt.Println("检查类型", checktype)
104 104
 	rangvalue := dataBody["range_value"].(string)
105
-	fmt.Println("rangvalue", rangvalue)
105
+	//fmt.Println("rangvalue", rangvalue)
106 106
 	if rangvalue == "0" {
107 107
 		rangvalue = ""
108 108
 	}
@@ -154,7 +154,7 @@ func (this *CommonApiController) GetConfigurationlist() {
154 154
 
155 155
 func (this *CommonApiController) GetConfigurationDetail() {
156 156
 	id, _ := this.GetInt64("id")
157
-	fmt.Println("id是", id)
157
+	//fmt.Println("id是", id)
158 158
 	detail, err := service.GetConfigurationDetail(id)
159 159
 	if err != nil {
160 160
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -179,22 +179,22 @@ func (this *CommonApiController) GetAllInspectionminor() {
179 179
 
180 180
 func (this *CommonApiController) UpdateConfiguration() {
181 181
 	id, _ := this.GetInt64("id")
182
-	fmt.Println("id", id)
182
+	//fmt.Println("id", id)
183 183
 	dataBody := make(map[string]interface{}, 0)
184 184
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
185
-	fmt.Println("err", err)
185
+	//fmt.Println("err", err)
186 186
 	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
187
-	fmt.Println("大项", inspectionmajor)
187
+	//fmt.Println("大项", inspectionmajor)
188 188
 	inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
189
-	fmt.Println("小项", inspectionMinor)
189
+	//fmt.Println("小项", inspectionMinor)
190 190
 	minrange := dataBody["min_range"].(string)
191
-	fmt.Println("minragne", minrange)
191
+	//fmt.Println("minragne", minrange)
192 192
 	largerange := dataBody["large_range"].(string)
193
-	fmt.Println("largerange", largerange)
193
+	//fmt.Println("largerange", largerange)
194 194
 	sort := int64(dataBody["sort"].(float64))
195
-	fmt.Println("排序", sort)
195
+	//fmt.Println("排序", sort)
196 196
 	rangvalue := dataBody["range_value"].(string)
197
-	fmt.Println("范围", rangvalue)
197
+	//fmt.Println("范围", rangvalue)
198 198
 	if rangvalue == "0" {
199 199
 		rangvalue = ""
200 200
 	}
@@ -279,12 +279,12 @@ func (this *CommonApiController) SaveCheckConfiguration() {
279 279
 	adminUser := this.GetAdminUserInfo()
280 280
 	orgid := adminUser.CurrentOrgId
281 281
 	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
282
-	fmt.Println("大项", inspectionmajor)
282
+	//fmt.Println("大项", inspectionmajor)
283 283
 	frequency := dataBody["frequency"].(string)
284
-	fmt.Println("凭次", frequency)
284
+	//fmt.Println("凭次", frequency)
285 285
 	sort := dataBody["sort"].(string)
286 286
 	sorts, err := strconv.ParseInt(sort, 10, 64)
287
-	fmt.Println("sort", sort)
287
+	//fmt.Println("sort", sort)
288 288
 	_, errcode := service.GetInspectionMajorById(inspectionmajor, orgid)
289 289
 	if errcode == gorm.ErrRecordNotFound {
290 290
 		configuration := models.XtCheckConfiguration{
@@ -312,7 +312,7 @@ func (this *CommonApiController) SaveCheckConfiguration() {
312 312
 func (this *CommonApiController) GetAllCheckList() {
313 313
 	adminUser := this.GetAdminUserInfo()
314 314
 	orgid := adminUser.CurrentOrgId
315
-	fmt.Println("org", orgid)
315
+	//fmt.Println("org", orgid)
316 316
 	page, _ := this.GetInt64("page")
317 317
 	limit, _ := this.GetInt64("limit")
318 318
 	checkList, total, err := service.GetAllCheckList(orgid, page, limit)
@@ -346,11 +346,11 @@ func (this *CommonApiController) UpdateCheck() {
346 346
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
347 347
 	fmt.Println(err)
348 348
 	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
349
-	fmt.Println("大项", inspectionmajor)
349
+	//fmt.Println("大项", inspectionmajor)
350 350
 	frequency := dataBody["frequency"].(string)
351
-	fmt.Println("凭次", frequency)
351
+	//fmt.Println("凭次", frequency)
352 352
 	sort := int64(dataBody["sort"].(float64))
353
-	fmt.Println("sort", sort)
353
+	//fmt.Println("sort", sort)
354 354
 	adminInfo := this.GetAdminUserInfo()
355 355
 	orgId := adminInfo.CurrentOrgId
356 356
 	Inspection, err := service.GetInspectionMajorByIdTwo(inspectionmajor, orgId)
@@ -393,7 +393,7 @@ func (this *CommonApiController) GetDialysisModeType() {
393 393
 	loc, _ := time.LoadLocation("Local")
394 394
 	startime := this.GetString("startime")
395 395
 	endtime := this.GetString("endtime")
396
-	fmt.Println("endtime", endtime)
396
+	//fmt.Println("endtime", endtime)
397 397
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
398 398
 	startimes := startTimes.Unix()
399 399
 	// fmt.Println("startime",startimes)
@@ -424,19 +424,15 @@ func (this *CommonApiController) GetTotalLapseCount() {
424 424
 	startime := this.GetString("startime")
425 425
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
426 426
 	startnunix := startTimes.Unix()
427
-	//fmt.Println("开始时间==========",startnunix)
427
+	fmt.Println("开始时间---------------", startnunix)
428 428
 	endtime := this.GetString("endtime")
429 429
 	endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
430 430
 	endunix := endtimes.Unix()
431
-	//fmt.Println("结束日期========",endunix)
432
-	//统计一个月内转出的病人
433
-	//patients, total, err := service.GetTotalRollOut(startime, endtime, orgid)
431
+	fmt.Println("endunix==========", endunix)
434 432
 	//统计该机构的转出人数
435 433
 	patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix)
436 434
 	//统计该机构转出病人
437 435
 	patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startnunix, endunix)
438
-	//统计总共病人
439
-	//	_, count, _ := service.GetPatientTotalCountTwo(orgid, startime, endtime)
440 436
 	count := service.GetPatientTotalCount(orgid)
441 437
 	if err != nil {
442 438
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -682,12 +678,12 @@ func (this *CommonApiController) GetPrescritionByName() {
682 678
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
683 679
 
684 680
 	entime := endDate.Unix()
685
-	fmt.Println("开始时间", statime)
686
-	fmt.Println(endtime)
681
+	//fmt.Println("开始时间", statime)
682
+	//fmt.Println(endtime)
687 683
 	limit, _ := this.GetInt64("limit")
688
-	fmt.Println("limit", limit)
684
+	//fmt.Println("limit", limit)
689 685
 	page, _ := this.GetInt64("page")
690
-	fmt.Println("page", page)
686
+	//fmt.Println("page", page)
691 687
 	patient, total, err := service.GetPrescritionByName(orgId, patientid, statime, entime, limit, page)
692 688
 	if err != nil {
693 689
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -702,23 +698,23 @@ func (this *CommonApiController) GetPrescritionByName() {
702 698
 func (this *CommonApiController) GetStatistics() {
703 699
 	adminUser := this.GetAdminUserInfo()
704 700
 	orgId := adminUser.CurrentOrgId
705
-	fmt.Println("orgid", orgId)
701
+	//fmt.Println("orgid", orgId)
706 702
 	startime := this.GetString("start_time")
707
-	fmt.Println(startime)
703
+	//fmt.Println(startime)
708 704
 	endtime := this.GetString("end_time")
709 705
 	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
710 706
 	fmt.Println("parseDateErr", parseDateErr)
711 707
 	statime := startDate.Unix()
712
-	fmt.Println("开始时间", statime)
708
+	//fmt.Println("开始时间", statime)
713 709
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
714 710
 	entime := endDate.Unix()
715
-	fmt.Println("结束日期", entime)
711
+	//fmt.Println("结束日期", entime)
716 712
 	value, _ := this.GetInt64("value")
717
-	fmt.Println("value", value)
713
+	//fmt.Println("value", value)
718 714
 	limit, _ := this.GetInt64("limit")
719
-	fmt.Println("limit", limit)
715
+	//fmt.Println("limit", limit)
720 716
 	page, _ := this.GetInt64("page")
721
-	fmt.Println("page", page)
717
+	//fmt.Println("page", page)
722 718
 	modeId, _ := this.GetInt64("mode_id")
723 719
 	treatinfo, total, err := service.GetTreateInfo(orgId, statime, entime, value, limit, page)
724 720
 	statistics, ttd, _ := service.GetStatistics(orgId, statime, entime, modeId)

+ 5 - 5
service/common_service.go View File

@@ -188,14 +188,14 @@ func GetTotalRollOut(starttime int64, endtime int64, orgid int64) (counts []*mod
188 188
 func GetTotalRollOutPatients(orgid int64, startime int64, endtime int64) (patients []*models.XtPatients, err error) {
189 189
 
190 190
 	db := XTReadDB().Table("x.patients as x")
191
-	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 1 and x.status = 1 group by s.patient_id", startime, endtime, orgid).Scan(&patients).Error
191
+	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 1 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
192 192
 	return patients, err
193 193
 }
194 194
 
195 195
 func GetTotalRollOutPatientsTwo(orgid int64, startime int64, endtime int64) (patients []*models.XtPatients, err error) {
196 196
 
197 197
 	db := XTReadDB().Table("x.patients as x")
198
-	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1 group by s.patient_id", startime, endtime, orgid).Scan(&patients).Error
198
+	err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
199 199
 	return patients, err
200 200
 }
201 201
 
@@ -233,7 +233,7 @@ func GetManPatientTotal(orgid int64) (patients []*models.XtPatients, total int64
233 233
 
234 234
 func GetPatientInfectiousCount(orgid int64, startime int64, endtime int64) (counts []*models.PatientContagionsCountStruct, err error) {
235 235
 
236
-	err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and s.is_infectious = 2 and s.created_time>=? and s.created_time<=?", orgid, startime, endtime).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
236
+	err = readDb.Table("xt_patients_infectious_diseases as x").Joins("join xt_patients as s on s.id = x.patient_id").Where("s.user_org_id = ? and s.status = 1 and x.status = 1 and x.updated_time>=? and x.updated_time<=?", orgid, startime, endtime).Select("x.disease_id,count(x.disease_id) as count").Group("x.disease_id").Scan(&counts).Error
237 237
 	return counts, err
238 238
 }
239 239
 
@@ -1159,7 +1159,7 @@ func GetProjectStandListOne(orgid int64, lapseto int64, modetype int64, startime
1159 1159
 			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第三季度'" +
1160 1160
 			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第四季度'" +
1161 1161
 			" ELSE '其他'" +
1162
-			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value = r.range_value)"
1162
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 1 or s.lapseto = 2) and (x.inspect_value = r.range_value) and r.status = 1"
1163 1163
 		countParams := make([]interface{}, 0)
1164 1164
 		countParams = append(countParams, firststart)
1165 1165
 		countParams = append(countParams, firstend)
@@ -1217,7 +1217,7 @@ func GetProjectStandListOne(orgid int64, lapseto int64, modetype int64, startime
1217 1217
 			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第三季度'" +
1218 1218
 			" WHEN x.inspect_date>=? AND  x.inspect_date<=? AND x.inspect_value = r.range_value THEN '第四季度'" +
1219 1219
 			" ELSE '其他'" +
1220
-			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value = r.range_value)"
1220
+			"END AS nnd FROM xt_inspection as x  left join xt_quality_control_standard as  r on (r.inspection_minor = x.item_id AND r.user_org_id > 0) OR ( x.item_id = r.inspection_minor AND r.user_org_id = 0) left join xt_patients as s on s.id = x.patient_id  WHERE x.status=1 and (s.lapseto = 2) and (x.inspect_value = r.range_value) and r.status = 1"
1221 1221
 		countParams := make([]interface{}, 0)
1222 1222
 		countParams = append(countParams, firststart)
1223 1223
 		countParams = append(countParams, firstend)