source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXRRPCE5.m@ 1608

Last change on this file since 1608 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1PXRRPCE5 ;HIN/MjK - Clinic Specific Caseload Demographics ;6/7/96
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;;Aug 12, 1996
3BP ;_._._._._._._._._._._._._.Blood Pressure_._._._._._._._._._._._._._.
4 S PXRRDFN=0 F S PXRRDFN=$O(^TMP($J,PXRRCLIN,"CLINIC PATIENTS",PXRRDFN)) Q:'PXRRDFN I $D(^GMR(120.5,"C",PXRRDFN)) S PXRRBIEN=0 F S PXRRBIEN=$O(^GMR(120.5,"C",PXRRDFN,PXRRBIEN)) Q:'PXRRBIEN D
5 . Q:$P(^GMR(120.5,PXRRBIEN,0),U)'>PXRRSXMO
6 . Q:$P(^GMR(120.5,PXRRBIEN,0),U)'<DT
7 . Q:$P(^GMR(120.5,PXRRBIEN,0),U,3)'=1 ;Blood pressures only
8 . I $P(^GMR(120.5,PXRRBIEN,0),U,8) S X=$P(^(0),U,8),Y=$P(X,"/"),Z=$P(X,"/",2) D
9 .. ;X = blood pressure ;Y = systolic bp ;Z = diastolic bp
10 .. I Y>159!(Z>90) S ^TMP($J,"HIBP",PXRRCLIN,PXRRDFN)=Y_"/"_Z_U_$G(^GMR(120.5,PXRRBIEN,0))
11 S (PXRRBPT,PXRRDFN)=0 F S PXRRDFN=$O(^TMP($J,"HIBP",PXRRCLIN,PXRRDFN)) Q:'PXRRDFN S PXRRBPT=PXRRBPT+1
12PERCNT1 ;_._._._._._._._._._.Calculate % Pats by DXS_._._._._._._._._._.
13 F PXRR="PXRRDM","PXRRHTN","PXRRCAD","PXRRHLIP","PXRRHTDM","PXRRHLIP" S Y=@PXRR S PXRR(PXRR)=$S('Y:0,1:(Y/PXRRVPAT)*100)
14PERCNT2 ;_._._._._._._.Percentages for Preventive Medicine Data_._._._._._._.
15 I PXRRTPAT S PXRR("SMOKE")=(PXRRSMYR/PXRRTPAT)*100 S PXRR("MAMGRM")=$S(+PXRRF50:(PXRRMMYR/PXRRF50)*100,1:"N/A")
16 I +PXRR("MAMGRM") S PXRR("MAMGRM")=$J(PXRR("MAMGRM"),2,1)
17 S PXRRHBA1=$S(+PXRRHBA1:$J(PXRRHBA1,2,1),1:PXRRHBA1),PXRRLDL=$S(+PXRRLDL:$J(PXRRLDL,2,1),1:PXRRLDL)
18TOTS S ^TMP($J,"CLINIC TOTALS",PXRRCLIN)=PXRRTVS_U_PXRRSESS_U_PXRRAG_U_PXRRCAD_U_$J(PXRR("PXRRCAD"),2,1)_U_PXRRDM_U_$J(PXRR("PXRRDM"),2,1)_U_PXRRHTN_U_$J(PXRR("PXRRHTN"),2,1)_U_PXRRHTDM_U_$J(PXRR("PXRRHTDM"),2,1)_U_PXRRHBA1
19 S X=PXRRCDSM_U_PXRRLDL_U_PXRRNOLD_U_$J($G(PXRR("PXRRSXUN")),2,1)_U_$J($G(PXRR("PXRRSXER")),2,1)_U_$J($G(PXRR("PXRRSXHP")),2,1)_U_PXRRSMYR_U_PXRRMMYR_U_PXRRUTVS_U_$J($G(PXRR("SMOKE")),2,1)
20 S Y=$G(PXRR("MAMGRM"))_U_$J(PXRRHLIP,2,1)_U_$J($G(PXRR("PXRRHLIP")),2,1)_U_PXRRRTVS_U_$J(PXRRPTSS,2,1)_U_PXRRMPAT_U_PXRRFPAT_U_PXRRHBG7_U_PXRRGL_U_PXRRCHOL_U_PXRRCDSX_U_$J(PXRR("PXRRPSUT"),2,1)_U_$J(PXRR("PXRRCOST"),4,2)
21 S Z=PXRRBPT_U_PXRRF50
22 S ^TMP($J,"CLINIC TOTALS",PXRRCLIN)=^TMP($J,"CLINIC TOTALS",PXRRCLIN)_U_X_U_Y_U_Z
23 Q
24MEAN ;_._._._._._.Calculate Mean Against Selected Clinics_._._._._._._.
25 S (X,Y)=0 F S X=$O(^TMP($J,"CLINIC TOTALS",X)) Q:'X S Y=Y+1
26 S PXRRCNUM=Y
27 F I=5,7,9,11,12,13,14,16,17,18,21,22,23,25,30,31,32,33,34,35,36 S ^TMP($J,"MEAN",I)=0,PXRRCLIN=0 F S PXRRCLIN=$O(^TMP($J,"CLINIC TOTALS",PXRRCLIN)) Q:'PXRRCLIN D
28 . I I=12!(I=14) S Z=$P(^TMP($J,"CLINIC TOTALS",PXRRCLIN),U,I),^TMP($J,"MEAN",I)=^TMP($J,"MEAN",I)+$S('Z&(PXRRCNUM-1):^TMP($J,"MEAN",I)/(PXRRCNUM-1),1:Z) Q
29 . S Z=$P(^TMP($J,"CLINIC TOTALS",PXRRCLIN),U,I),^TMP($J,"MEAN",I)=^TMP($J,"MEAN",I)+Z
30 F I=35 S ^TMP($J,"MEAN",I)=^TMP($J,"MEAN",I)/PXRRCNUM,^TMP($J,"MEAN",I)=$S(+^TMP($J,"MEAN",I):$J(^TMP($J,"MEAN",I),4,2),1:"N/A")
31 F I=12,14 S ^TMP($J,"MEAN",I)=^TMP($J,"MEAN",I)/PXRRCNUM,^TMP($J,"MEAN",I)=$S(+^TMP($J,"MEAN",I):$J(^TMP($J,"MEAN",I),2,1),1:"N/A")
32 F I=5,7,9,11,13,16,17,18,21,22,23,25,30,31,32,33,34,36 S ^TMP($J,"MEAN",I)=$J((^TMP($J,"MEAN",I)/PXRRCNUM),2,1)
33 Q
34INITVAR S (PXRRCAD,PXRRSESS,PXRRAG,PXRRAGE,PXRRTVS,PXRRSXUN,PXRRVPAT,PXRRQPAT,PXRRTPAT,PXRRMPAT,PXRRPSUT,PXRRCOST)=0
35 S X1=PXRREDT,X2=-180 D C^%DTC S PXRRSXMO=X,X1=PXRREDT,X2=-365 D C^%DTC S PXRRYR=X
36 Q
Note: See TracBrowser for help on using the repository browser.