|
@@ -70,25 +70,33 @@ func (this *CommonApiController) SaveConfiguration() {
|
70
|
70
|
sort := dataBody["sort"].(string)
|
71
|
71
|
sorts, err := strconv.ParseInt(sort, 10, 64)
|
72
|
72
|
fmt.Println("sort", sort)
|
73
|
|
- standard := models.XtQualityControlStandard{
|
74
|
|
- InspectionMajor: inspectionmajor,
|
75
|
|
- InspectionMinor: inspectionMinor,
|
76
|
|
- MinRange: minrange,
|
77
|
|
- LargeRange: largerange,
|
78
|
|
- Sort: sorts,
|
79
|
|
- UserOrgId: orgid,
|
80
|
|
- Status: 1,
|
81
|
|
- CreatedTime: time.Now().Unix(),
|
82
|
|
- }
|
83
|
|
- fmt.Println(standard)
|
84
|
|
- err = service.SaveInspection(&standard)
|
85
|
|
- if err != nil {
|
86
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
73
|
+
|
|
74
|
+ _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
|
|
75
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
76
|
+ standard := models.XtQualityControlStandard{
|
|
77
|
+ InspectionMajor: inspectionmajor,
|
|
78
|
+ InspectionMinor: inspectionMinor,
|
|
79
|
+ MinRange: minrange,
|
|
80
|
+ LargeRange: largerange,
|
|
81
|
+ Sort: sorts,
|
|
82
|
+ UserOrgId: orgid,
|
|
83
|
+ Status: 1,
|
|
84
|
+ CreatedTime: time.Now().Unix(),
|
|
85
|
+ }
|
|
86
|
+ fmt.Println(standard)
|
|
87
|
+ err = service.SaveInspection(&standard)
|
|
88
|
+ if err != nil {
|
|
89
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
90
|
+ return
|
|
91
|
+ }
|
|
92
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
93
|
+ "standard": standard,
|
|
94
|
+ })
|
|
95
|
+ } else if errcode == nil {
|
|
96
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
87
|
97
|
return
|
88
|
98
|
}
|
89
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
90
|
|
- "standard": standard,
|
91
|
|
- })
|
|
99
|
+
|
92
|
100
|
}
|
93
|
101
|
|
94
|
102
|
func (this *CommonApiController) GetConfigurationlist() {
|
|
@@ -147,7 +155,15 @@ func (this *CommonApiController) UpdateConfiguration() {
|
147
|
155
|
largerange := dataBody["large_range"].(string)
|
148
|
156
|
fmt.Println("largerange", largerange)
|
149
|
157
|
sort := int64(dataBody["sort"].(float64))
|
150
|
|
-
|
|
158
|
+ fmt.Println("排序", sort)
|
|
159
|
+ adminInfo := this.GetAdminUserInfo()
|
|
160
|
+ orgId := adminInfo.CurrentOrgId
|
|
161
|
+ configuration, err := service.GetConfigurationByIdTwo(inspectionmajor, inspectionMinor, orgId)
|
|
162
|
+ fmt.Println("err", err)
|
|
163
|
+ if configuration.ID > 0 && configuration.ID != id {
|
|
164
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
165
|
+ return
|
|
166
|
+ }
|
151
|
167
|
standard := models.XtQualityControlStandard{
|
152
|
168
|
InspectionMajor: inspectionmajor,
|
153
|
169
|
InspectionMinor: inspectionMinor,
|
|
@@ -219,7 +235,7 @@ func (this *CommonApiController) SaveCheckConfiguration() {
|
219
|
235
|
sort := dataBody["sort"].(string)
|
220
|
236
|
sorts, err := strconv.ParseInt(sort, 10, 64)
|
221
|
237
|
fmt.Println("sort", sort)
|
222
|
|
- _, errcode := service.GetInspectionMajorById(inspectionmajor)
|
|
238
|
+ _, errcode := service.GetInspectionMajorById(inspectionmajor, orgid)
|
223
|
239
|
if errcode == gorm.ErrRecordNotFound {
|
224
|
240
|
configuration := models.XtCheckConfiguration{
|
225
|
241
|
InspectionMajor: inspectionmajor,
|
|
@@ -285,8 +301,9 @@ func (this *CommonApiController) UpdateCheck() {
|
285
|
301
|
fmt.Println("凭次", frequency)
|
286
|
302
|
sort := int64(dataBody["sort"].(float64))
|
287
|
303
|
fmt.Println("sort", sort)
|
288
|
|
-
|
289
|
|
- Inspection, err := service.GetInspectionMajorById(inspectionmajor)
|
|
304
|
+ adminInfo := this.GetAdminUserInfo()
|
|
305
|
+ orgId := adminInfo.CurrentOrgId
|
|
306
|
+ Inspection, err := service.GetInspectionMajorByIdTwo(inspectionmajor, orgId)
|
290
|
307
|
if Inspection.ID > 0 && Inspection.ID != id {
|
291
|
308
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
292
|
309
|
return
|
|
@@ -320,3 +337,136 @@ func (this *CommonApiController) DeleteCheck() {
|
320
|
337
|
this.ServeSuccessJSON(returnData)
|
321
|
338
|
return
|
322
|
339
|
}
|
|
340
|
+
|
|
341
|
+func (this *CommonApiController) GetDialysisModeType() {
|
|
342
|
+ timeLayout := "2006-01-02"
|
|
343
|
+ loc, _ := time.LoadLocation("Local")
|
|
344
|
+ startime := this.GetString("startime")
|
|
345
|
+ endtime := this.GetString("endtime")
|
|
346
|
+ fmt.Println("endtime", endtime)
|
|
347
|
+ startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
|
|
348
|
+ startimes := startTimes.Unix()
|
|
349
|
+ // fmt.Println("startime",startimes)
|
|
350
|
+ endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
|
|
351
|
+ endtimeData := endtimes.Unix()
|
|
352
|
+ // fmt.Println("结束日期",endtimeData)
|
|
353
|
+ adminUser := this.GetAdminUserInfo()
|
|
354
|
+ orgid := adminUser.CurrentOrgId
|
|
355
|
+ //统计透析总量
|
|
356
|
+ _, total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid)
|
|
357
|
+
|
|
358
|
+ modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid)
|
|
359
|
+ if err != nil {
|
|
360
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
361
|
+ return
|
|
362
|
+ }
|
|
363
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
364
|
+ "total": total,
|
|
365
|
+ "modetype": modeType,
|
|
366
|
+ })
|
|
367
|
+}
|
|
368
|
+
|
|
369
|
+func (this *CommonApiController) GetTotalLapseCount() {
|
|
370
|
+ adminUser := this.GetAdminUserInfo()
|
|
371
|
+ orgid := adminUser.CurrentOrgId
|
|
372
|
+ startime, _ := this.GetInt64("startime")
|
|
373
|
+ fmt.Println("startime--", startime)
|
|
374
|
+ endtime, _ := this.GetInt64("endtime")
|
|
375
|
+ fmt.Println("endtime--", endtime)
|
|
376
|
+
|
|
377
|
+ //统计一个月内转出的病人
|
|
378
|
+ patients, total, err := service.GetTotalRollOut(startime, endtime, orgid)
|
|
379
|
+ //统计总共病人
|
|
380
|
+ _, count, _ := service.GetPatientTotalCountTwo(orgid, startime, endtime)
|
|
381
|
+ if err != nil {
|
|
382
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
383
|
+ return
|
|
384
|
+ }
|
|
385
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
386
|
+ "patients": patients,
|
|
387
|
+ "total": total,
|
|
388
|
+ "count": count,
|
|
389
|
+ })
|
|
390
|
+}
|
|
391
|
+
|
|
392
|
+func (this *CommonApiController) GetTotalSexCount() {
|
|
393
|
+ adminUser := this.GetAdminUserInfo()
|
|
394
|
+ orgid := adminUser.CurrentOrgId
|
|
395
|
+ fmt.Println("orgid", orgid)
|
|
396
|
+ startime, _ := this.GetInt64("startime")
|
|
397
|
+ fmt.Println("开始时间", startime)
|
|
398
|
+ endtime, _ := this.GetInt64("endtime")
|
|
399
|
+ fmt.Println("结束时间", endtime)
|
|
400
|
+ //统计这个月透析病人的总数
|
|
401
|
+ _, total, err := service.GetPatientTotalCountTwo(orgid, startime, endtime)
|
|
402
|
+ //统计改月男病人的总数
|
|
403
|
+ _, totalSex, err := service.GetManPatientTotalCount(orgid, startime, endtime)
|
|
404
|
+
|
|
405
|
+ if err != nil {
|
|
406
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
407
|
+ return
|
|
408
|
+ }
|
|
409
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
410
|
+ "total": total,
|
|
411
|
+ "totalSex": totalSex,
|
|
412
|
+ })
|
|
413
|
+}
|
|
414
|
+
|
|
415
|
+func (this *CommonApiController) GetTotalInfectiouscount() {
|
|
416
|
+ adminUser := this.GetAdminUserInfo()
|
|
417
|
+ orgid := adminUser.CurrentOrgId
|
|
418
|
+ fmt.Println("orgid", orgid)
|
|
419
|
+ startime, _ := this.GetInt64("startime")
|
|
420
|
+ fmt.Println("开始时间", startime)
|
|
421
|
+ endtime, _ := this.GetInt64("endtime")
|
|
422
|
+ fmt.Println("结束时间", endtime)
|
|
423
|
+ //统计本月透析总人数
|
|
424
|
+ _, total, err := service.GetPatientTotalCountTwo(orgid, startime, endtime)
|
|
425
|
+ fmt.Println("err--", err)
|
|
426
|
+ fmt.Println("total", total)
|
|
427
|
+ //统计本月透析人数传染病所占比例
|
|
428
|
+ count, err := service.GetPatientInfectiousCount(orgid, startime, endtime)
|
|
429
|
+ fmt.Println("报错-------------", count)
|
|
430
|
+ if err != nil {
|
|
431
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
432
|
+ return
|
|
433
|
+ }
|
|
434
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
435
|
+ "total": total,
|
|
436
|
+ "count": count,
|
|
437
|
+ })
|
|
438
|
+}
|
|
439
|
+
|
|
440
|
+func (this *CommonApiController) GetTotalAgeCount() {
|
|
441
|
+ adminUser := this.GetAdminUserInfo()
|
|
442
|
+ orgid := adminUser.CurrentOrgId
|
|
443
|
+ fmt.Println("orgid", orgid)
|
|
444
|
+ startime, _ := this.GetInt64("startime")
|
|
445
|
+ fmt.Println("开始时间", startime)
|
|
446
|
+ endtime, _ := this.GetInt64("endtime")
|
|
447
|
+ fmt.Println("结束时间", endtime)
|
|
448
|
+ //统计本月透析总人数
|
|
449
|
+ _, total, err := service.GetPatientTotalCountTwo(orgid, startime, endtime)
|
|
450
|
+ fmt.Println("err--", err)
|
|
451
|
+ fmt.Println("total", total)
|
|
452
|
+ agecount, err := service.GetTotalAgeCount(orgid, startime, endtime)
|
|
453
|
+ //two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
|
|
454
|
+ if err != nil {
|
|
455
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
456
|
+ return
|
|
457
|
+ }
|
|
458
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
459
|
+ "total": total,
|
|
460
|
+ "ageCount": agecount,
|
|
461
|
+ })
|
|
462
|
+}
|
|
463
|
+
|
|
464
|
+func (this *CommonApiController) GetTotalDialysisCount() {
|
|
465
|
+ adminUser := this.GetAdminUserInfo()
|
|
466
|
+ orgid := adminUser.CurrentOrgId
|
|
467
|
+ fmt.Println("org", orgid)
|
|
468
|
+ startime, _ := this.GetInt64("startime")
|
|
469
|
+ fmt.Println(startime)
|
|
470
|
+ endtime, _ := this.GetInt64("endtime")
|
|
471
|
+ fmt.Println(endtime)
|
|
472
|
+}
|