Sfoglia il codice sorgente

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

28169 4 settimane fa
parent
commit
363f97ac02
1 ha cambiato i file con 11 aggiunte e 36 eliminazioni
  1. 11 36
      service/statistis_qc_service.go

+ 11 - 36
service/statistis_qc_service.go Vedi File

@@ -717,7 +717,7 @@ func GetDialysisCompletionRate(org_id int64, start_time int64, end_time int64) (
717 717
             CASE
718 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 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 721
             END AS dialysis_status,
722 722
             COUNT(*) AS count
723 723
         FROM
@@ -765,8 +765,8 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
765 765
 	if mode == 0 {
766 766
 		query = `
767 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 770
 	      FROM_UNIXTIME(o.dialysis_date) as dialysis_date,
771 771
 	      CONCAT(p.dialysis_duration_hour, 'h', p.dialysis_duration_minute,'min') as dialysis_duration,
772 772
 	      CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
@@ -3326,35 +3326,10 @@ func GetNewDialysisWeightDetailTableTenT(
3326 3326
                ORDER BY b2.assessment_date DESC LIMIT 1
3327 3327
            ) AS last_weight_after,
3328 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 3333
                ELSE NULL
3359 3334
            END AS weight_add,
3360 3335
            CASE
@@ -3397,10 +3372,10 @@ func GetNewDialysisWeightDetailTableTenT(
3397 3372
                ORDER BY b2.assessment_date DESC LIMIT 1
3398 3373
            ) AS last_weight_after,
3399 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 3379
                ELSE NULL
3405 3380
            END AS weight_add,
3406 3381
            CASE