source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCBPFTP1.m@ 1259

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1MCBPFTP1 ;WISC/TJK,ALG-PFT BRIEF REPORT-DEMO INFO ;1/23/03 18:18
2 ;;2.3;Medicine;**5,14,16,17,22,25,35**;09/13/1996
3 ; Reference IA #3175 for measurement API XLFMSMT.
4 ; #10040 for Hospital Location File #44.
5 ; #10061 for VADPT call.
6 ; ------------------------
7 ; SSN = Enternal Format of the patients SSN with the first letter
8 ; of the last name tacked on the end
9 ; ------------------------
10 D DEM^VADPT S MCARGNM=VADM(1),SSN=VA("PID")
11 S X1=$E($P(MCPFT0,U),1,7),X2=$P(VADM(3),U)
12 ; ---------------------
13 ; AGE = the patients age at the date of the procedure
14 ; ---------------------
15 S AGE=$E(X1,1,3)-$E(X2,1,3)-($E(X1,4,7)<$E(X2,4,7))
16 S RACE=$P(VADM(8),U,2),CLIN="" S:$P(MCPFT0,U,10) CLIN=$P(MCPFT0,U,10) I CLIN,$D(^SC(CLIN,0)) S CLIN=$P(^(0),U)
17 N MCHOLD S MCHOLD=RACE,RACE=$$ETHN^MCPFTP1(MCHOLD,.VADM)
18 S DATE=$P(MCPFT0,U),DATE=+$E(DATE,4,5)_"/"_+$E(DATE,6,7)_"/"_$E(DATE,2,3)_$S($P(DATE,".",2):"@"_+$E(DATE,9,10)_":"_$S($L($E(DATE,11,12))=2:$E(DATE,11,12),$L($E(DATE,11,12))=1:$E(DATE,11)_"0",1:"00"),1:"")
19 N HTCM,HTIN,WTKG,WTLB
20 S (HTIN,HT1)=$P(MCPFT0,U,4),(HTCM,HT)=$P($$LENGTH^XLFMSMT(HTIN,"IN","CM")," ")
21 S (WTLB,WT1)=$P(MCPFT0,U,5),(WTKG,WT)=$P($$WEIGHT^XLFMSMT(WTLB,"LB","KG")," ")
22 I HT'>0 S (HTCM,HT)=$P(MCPFT0,U,3),(HTIN,HT1)=$P($$LENGTH^XLFMSMT(HTCM,"CM","IN")," ")
23 I WT'>0 S (WTKG,WT)=$P(MCPFT0,U,6),(WTLB,WT1)=$P($$WEIGHT^XLFMSMT(WTKG,"KG","LB")," ")
24 S $P(MCDOT,".",81)=""
25 ;S HT1=$P(MCPFT0,U,4),WT1=$P(MCPFT0,U,5) S $P(MCDOT,".",81)=""
26 ;S HT=HT1*2.54,WT=WT1/2.2
27 ;S:'HT HT=$P(MCPFT0,U,3),HT1=HT/2.54 S:'WT WT=$P(MCPFT0,U,6),WT1=WT*2.2
28 S (MC17,MCEFF,MCSEX)="" S:$D(^MCAR(700,MCARGDA,17)) MC17=^(17),MCEFF=$P(MC17,U,6),MCEFF=$S(MCEFF="G":"GOOD",MCEFF="E":"EXCELLENT",MCEFF="P":"POOR",1:"")
29 ;S MCSEX=$P(VADM(5),U),X=$P(VADM(3),"^",2) S MCARDOB=$S(X'="":X,1:""),X=$P(MCPFT0,U) D DTIME^MCARP S MCARGDT=X,MCARZ="PULMONARY FUNCTION TEST"
30 S MCSEX=$P(VADM(5),U),X=$P(VADM(3),"^",2) S MCARDOB=$S(X'="":X,1:""),X=$P(MCPFT0,U),MCARGDT=X,MCARZ="PULMONARY FUNCTION TEST"
31 D INP^VADPT S MCARWARD=$S(VAIN(4)'="":$P(VAIN(4),U,2),1:"NOT INPATIENT"),MCARRB=VAIN(5) D NOW^%DTC S X=% D DTIME^MCARP S MCARDTM=X
32 S MCARZ="PULMONARY FUNCTION TEST"
33 D INIT^MCARP1(MCARZ,MCARGDT,MCFILE),HEAD^MCARP
34 W !,"SEX: ",MCSEX," AGE:",AGE,?30,HT1," in/",WT1," lb",?60,"AMBIENT: ",$P(MCPFT0,U,12),"C/",$P(MCPFT0,U,7),"T" K HT1,WT1
35 W !,"RACE: ",RACE S TECH=$$GETVALUE^MCU(700,MCARGDA,34) W:$L(RACE)>60 !
36 W ?60,"TECH: ",$E(TECH,1,14)
37 W !,$S($P(MCPFT0,U,8)="Y":"SMOKER",$P(MCPFT0,U,8)="N":"NON-SMOKER",1:"")
38 W ?30 W:$P(MCPFT0,U,9)="Y" "CURRENT BRONCHODILATOR USE"
39 W ?60,"EFFORT: ",MCEFF
40 S MCFF="S DN=1,MCY="""" I $Y>(IOSL-3) R:$E(IOST,1,2)=""C-"" !!,""Press Return to Continue, '^' to escape: "",MCY:DTIME S:'$T MCY=U S:MCY=U MCOUT=1,DN=0 Q:$D(MCOUT) D:DN HEAD^MCARP D:$D(HEAD1) HEAD1^MCBPFTP2,HEAD2^MCBPFTP2 K MCY"
41 K ^UTILITY("DIQ1",$J) W !!,"CONSULT DX: " S DR(700.01)=.01,DIQ(0)="E",DIC="^MCAR(700,"
42 F K=0:0 S K=$O(^MCAR(700,MCARGDA,1,K)) Q:K'?1N.N S DA=MCARGDA,DA(700.01)=K,DR=11,DIQ(0)="E" D EN^DIQ1 I $D(^UTILITY("DIQ1",$J,700.01,K,.01,"E"))#2 W ?15,^("E"),! X MCFF Q:$D(MCOUT)
43 K ^UTILITY("DIQ1",$J),DIQ Q:$D(MCOUT) W !,MCDOT X MCFF Q:$D(MCOUT) D PRED
44 S RDATE=9999999.9999-$P(MCPFT0,U)
45 W:$D(MCRCN) !,MCRCN D ^MCBPFTP2
46 I '$D(MCOUT),$G(MCESON) D FOOTER^MCESPRT(MCFILE,MCARGDA) ;PATCH 28
47EXIT D:$D(ZTSK) KILL^%ZTLOAD K ZTSK
48EXIT1 D KVAR^VADPT K MCOUT,ACT,AGE,CK,CLIN,D0,D1,DA,DATE,CI95
49 K MCARGDT2,^UTILITY($J)
50 K BSA,HB,PH,PACO2,PAO2,O2HB,COHB,FIO2,MHB,PAAO2,QSQT,CAO2,CVO2
51 K DFN,DIC,DIW,DIWL,DIWR,DIWT,DLCOSB,DN,MCDOT,DR,FEV1,FRC,FVC,MC17
52 K HT,I,J,K,MCARGDA,MCARGNM,MCFF,MCK,MCN,MCPI,MCREC,MCREC1,MCVCN
53 K MCREC2,MCTLCN,MCVN,MCX,MEAS,FEF2575,ND,ND1,P1,P2,PC,PD1,PD11,MCEFF
54 K PD2,PD21,PF,MCPFT0,PG,PRED,MCPV,RACE,RDATE,RDATE1,RDATE2,RV,MCSEX
55 K SSN,TAB,TECH,TLC,TYPE,UNIT,UNITS,VC,WT,X,Z,VA,MCRCN
56 K MCMVVN,MVV,PMVV,MCSP,MCP1S0,MCP1S1,MCP1S2,MCP2S0,MCP2S1,MCP2S2
57 K CDLCOSB,MCIAO1,MCIAO2,MCIDA,MCIDL,MCIDP,MCIFA,MCIFE
58 K MCIFL,MCIFV,MCIPTL,MCIRV,MCITL,MCMAIN,MCP1,MCP2,MCRC,MCRCR,MCTYPEP,MCY,MCRC1,MCRC2,MCRC3,MCRC4 ;,MCARGDA
59 K MCARRB,MCARDOB,MCARWARD,MCARDTM,MCARHDR,MCARZ,MCARGDT,MCDL,MCLNG D KVAR^VADPT D ^%ZISC Q
60PRED S (FVC,CFVC,FEV1,F,TLC,MVV)=""
61 Q:'HT!'WT!'AGE!'$D(^MCAR(700,MCARGDA,"PV")) Q:'(^("PV"))
62 S MCPV=^MCAR(700,MCARGDA,"PV") Q:'$D(^MCAR(700.1,MCPV))
63 S BSA=$$BSA^MCPFTP1(HT,WT)
64 F I="FEV1","FVC","TLC","MVV" D
65 .S:$D(^MCAR(700.1,MCPV,I)) @("P"_I)="S "_I_"="_$P(^MCAR(700.2,^MCAR(700.1,MCPV,I),0),U),@("C"_I)=$P(^MCAR(700.2,^MCAR(700.1,MCPV,I),0),U,5) X:$D(^MCAR(700.1,MCPV,I)) @("P"_I)
66 K PDLCOSB,PFEV1,PFRC,PFVC,PFEF2575,PPF,PRV,PTLC,PVC
67 S MCRCR="",MCRC=$G(^MCAR(700.1,MCPV,"RC")) Q:MCRC=""
68 S MCRCR=$G(^MCAR(700,MCARGDA,17)) Q:MCRCR="" Q:$P(MCRCR,U,5)'="Y"
69 N MCRAC,MCMRAC S MCMRAC=0
70 S:RACE["ASIAN" MCMRAC=MCMRAC+1
71 S:RACE["BLACK" MCMRAC=MCMRAC+1
72 I MCMRAC>1 S MCRAC=$P(MCRCR,U,7),MCRAC=$S(MCRAC="A":"O",1:MCRAC)
73 S MCRCR=$S(RACE["BLACK":"B",RACE["ASIAN":"O",1:"") Q:MCRCR=""
74 I MCMRAC>1 S MCRCR=MCRAC Q:MCRCR=""
75 F I=1:1:6 I $P(MCRC,U,I) S J=$P(MCRC,U,I) D:J
76 .Q:'$D(^MCAR(700.2,J,0)) S J=$P(^(0),U,1)
77 .S @("MCRC"_I)="S PRED="_J
78 K J G ORIENTAL:MCRCR="O" K MCRC2,MCRC6
79 I '$D(MCRC1),'$D(MCRC3),'$D(MCRC4),'$D(MCRC5) Q
80 S:$D(MCRC1) MCRCN="TLC,FVC,FEV1" S:$D(MCRC3) MCRCN=MCRCN_",FRC,RV" S:$D(MCRC4) MCRCN=MCRCN_",FEF25-75" S:$D(MCRC5) MCRCN=MCRCN_",MVV" S:$E(MCRCN,1)="," MCRCN=$E(MCRCN,2,35)
81 G NOTE
82ORIENTAL I '$D(MCRC2),'$D(MCRC6) K MCRC1,MCRC3,MCRC4,MCRC5 Q
83 S:$D(MCRC2) MCRC1=MCRC2 S:$D(MCRC6) MCRC5=MCRC6 K MCRC3,MCRC4,MCRC6 S MCRCN="TLC,FVC,FEV1,MVV"
84NOTE S MCRCN="NOTE: Race Correction on predicted values: "_MCRCN
85 I $G(MCMRAC)>1 S MCRCN=MCRCN_$S(MCRCR="O":" - ASIAN",1:" - BLACK")
86 Q
Note: See TracBrowser for help on using the repository browser.