Quellcode durchsuchen

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 vor 7 Monaten
Ursprung
Commit
363f97ac02
1 geänderte Dateien mit 11 neuen und 36 gelöschten Zeilen
  1. 11 36
      service/statistis_qc_service.go

+ 11 - 36
service/statistis_qc_service.go Datei anzeigen

717
             CASE
717
             CASE
718
                 WHEN ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) <= 15 THEN '达到透析处方时间'
718
                 WHEN ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) <= 15 THEN '达到透析处方时间'
719
                 WHEN TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15 THEN '超出处方时间'
719
                 WHEN TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0)) < -15 THEN '超出处方时间'
720
-                ELSE '未达处方时间'
720
+                ELSE '未达处方时间'
721
             END AS dialysis_status,
721
             END AS dialysis_status,
722
             COUNT(*) AS count
722
             COUNT(*) AS count
723
         FROM
723
         FROM
765
 	if mode == 0 {
765
 	if mode == 0 {
766
 		query = `
766
 		query = `
767
 	   SELECT
767
 	   SELECT
768
-	      p.dialysis_no as dialysis_no,
769
-	      p.name as patient_name,
768
+	      pp.dialysis_no as dialysis_no,
769
+	    	pp.name as patient_name,
770
 	      FROM_UNIXTIME(o.dialysis_date) as dialysis_date,
770
 	      FROM_UNIXTIME(o.dialysis_date) as dialysis_date,
771
 	      CONCAT(p.dialysis_duration_hour, 'h', p.dialysis_duration_minute,'min') as dialysis_duration,
771
 	      CONCAT(p.dialysis_duration_hour, 'h', p.dialysis_duration_minute,'min') as dialysis_duration,
772
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
772
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
3326
                ORDER BY b2.assessment_date DESC LIMIT 1
3326
                ORDER BY b2.assessment_date DESC LIMIT 1
3327
            ) AS last_weight_after,
3327
            ) AS last_weight_after,
3328
            CASE
3328
            CASE
3329
-               WHEN (
3330
-                   SELECT a2.weight_after
3331
-                   FROM xt_assessment_after_dislysis a2
3332
-                   JOIN xt_assessment_before_dislysis b2
3333
-                   ON a2.patient_id = b2.patient_id
3334
-                   AND a2.assessment_date = b2.assessment_date
3335
-                   WHERE b2.patient_id = b.patient_id
3336
-                   AND b2.assessment_date < b.assessment_date
3337
-                   ORDER BY b2.assessment_date DESC LIMIT 1
3338
-               ) IS NOT NULL
3339
-               THEN (b.weight_before - (
3340
-                   SELECT a2.weight_after
3341
-                   FROM xt_assessment_after_dislysis a2
3342
-                   JOIN xt_assessment_before_dislysis b2
3343
-                   ON a2.patient_id = b2.patient_id
3344
-                   AND a2.assessment_date = b2.assessment_date
3345
-                   WHERE b2.patient_id = b.patient_id
3346
-                   AND b2.assessment_date < b.assessment_date
3347
-                   ORDER BY b2.assessment_date DESC LIMIT 1
3348
-               )) / (
3349
-                   SELECT a2.weight_after
3350
-                   FROM xt_assessment_after_dislysis a2
3351
-                   JOIN xt_assessment_before_dislysis b2
3352
-                   ON a2.patient_id = b2.patient_id
3353
-                   AND a2.assessment_date = b2.assessment_date
3354
-                   WHERE b2.patient_id = b.patient_id
3355
-                   AND b2.assessment_date < b.assessment_date
3356
-                   ORDER BY b2.assessment_date DESC LIMIT 1
3357
-               )
3329
+               WHEN 
3330
+                    a.weight_after and b.dry_weight
3331
+                IS NOT NULL
3332
+               THEN a.weight_after - b.dry_weight
3358
                ELSE NULL
3333
                ELSE NULL
3359
            END AS weight_add,
3334
            END AS weight_add,
3360
            CASE
3335
            CASE
3397
                ORDER BY b2.assessment_date DESC LIMIT 1
3372
                ORDER BY b2.assessment_date DESC LIMIT 1
3398
            ) AS last_weight_after,
3373
            ) AS last_weight_after,
3399
            CASE
3374
            CASE
3400
-               WHEN b.dry_weight and b.weight_before IS NOT NULL 
3401
-               THEN (b.weight_before - b.dry_weight) / (
3402
-                   b.dry_weight
3403
-               )
3375
+               WHEN 
3376
+                    a.weight_after and b.dry_weight
3377
+                IS NOT NULL
3378
+               THEN a.weight_after - b.dry_weight
3404
                ELSE NULL
3379
                ELSE NULL
3405
            END AS weight_add,
3380
            END AS weight_add,
3406
            CASE
3381
            CASE