source: WorldVistAEHR/trunk/r/ICR_IMMUNOLOGY_CASE_REGISTRY-IMR/IMRVLRG.m@ 1042

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

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1IMRVLRG ;HCIOFO/FAI-Viral Load and CD4 Test Results Range ;11/13/01 09:00
2 ;;2.1;IMMUNOLOGY CASE REGISTRY;**5,16**;Feb 09, 1998
3BEGIN W !,?10,"####################################################"
4 W !,?10,"#",?20,"Local Viral Test and CD4 List By Range",?61,"#"
5 W !,?10,"####################################################"
6 S IMRPG=0,(RNG,TYPE,SELE,CDHN,CDLN,VLH,VLL,BCDH,BCDL,BVLH,BVLL)=""
7ASK D ^IMRDATE
8 I $G(IMRHNBEG)="" W !,"**NO DATE RANGE SELECTED**" D KILL Q
9TYP K DIR S DIR(0)="S^C:CD4;V:Viral Load;B:Both",DIR("A")="Select Type of Test(s) Results Requested" D ^DIR S TTYPE=Y K DIR
10 I $D(DIRUT) D KILL Q
11 G:TTYPE="V" VL
12 G:TTYPE="B" BCDVL
13CD4 ; cd4 high/low range
14 W !!,"What range of CD4 # ?" K DIR S DIR(0)="N^0:99999999",DIR("A")="High (enter number)" D ^DIR S CDHN=Y K DIR
15 I $D(DIRUT) D KILL Q
16 K DIR S DIR(0)="N^0:99999999",DIR("A")="Low (enter number)" D ^DIR S CDLN=Y K DIR
17 I $D(DIRUT) D KILL Q
18 G DELM
19VL ; viral load high/low range
20 W !!,"What range of Viral Load?" K DIR S DIR(0)="N^0:99999999",DIR("A")="High (enter number)" D ^DIR S VLH=Y K DIR
21 I $D(DIRUT) D KILL Q
22 K DIR S DIR(0)="N^0:99999999",DIR("A")="Low (enter number)" D ^DIR S VLL=Y K DIR
23 I $D(DIRUT) D KILL Q
24 G DELM
25BCDVL ; both cd4 and viral load range
26 W !!,"What range of CD4 # ?" K DIR S DIR(0)="N^0:99999999",DIR("A")="High (enter number)" D ^DIR S CDHN=Y K DIR
27 I $D(DIRUT) D KILL Q
28 K DIR S DIR(0)="N^0:99999999",DIR("A")="Low (enter number)" D ^DIR S CDLN=Y K DIR
29 I $D(DIRUT) D KILL Q
30 W !!,"What range of Viral Load?" K DIR S DIR(0)="N^0:99999999",DIR("A")="High (enter number)" D ^DIR S VLH=Y K DIR
31 I $D(DIRUT) D KILL Q
32 K DIR S DIR(0)="N^0:99999999",DIR("A")="Low (enter number)" D ^DIR S VLL=Y K DIR
33 I $D(DIRUT) D KILL Q
34DELM S DELIM="N" R !!,"Do you want the list in delimited format (Y/N)? N// ",X:DTIME S:X="" X="N" I "Yy"[$E(X) S DELIM="Y"
35 I "YyNn"'[$E(X) W $C(7)," ??",!!,"Enter YES or NO" G DELM
36DEV D IMRDEV^IMREDIT
37 G:POP KILL
38 I '$D(IO("Q")) W @IOF D SEARCH Q
39 I $D(IO("Q")) D G KILL
40 .S ZTRTN="DQ^IMRVLRG",ZTDESC="Local Viral Load and CD4 Range Lists"
41 .S ZTSAVE("*")="",ZTIO=ION_";"_IOM_";"_IOSL
42 .D ^%ZTLOAD K ZTRTN,ZTDESC,ZTSAVE,ZTSK
43 .Q
44 Q
45DQ D TYPE,HEAD,SORT,KILL
46 Q
47SEARCH D TYPE,HEAD,SORT,KILL
48 Q
49TYPE ; Entry with IMRDFN defined and pointers for local lab test name & NLT
50 ; FIND TYPE OF TEST EX:VIRAL LOAD
51 K ^TMP($J)
52 D ^IMRSDSP
53ICRPT F ICR=0:0 S ICR=$O(^IMR(158,ICR)) Q:ICR'>0 S X=+^(ICR,0),IFN=ICR,IMRCAT=$P(^(0),U,42) D ^IMRXOR S (DFN,IMRDFN)=X I $D(^DPT(DFN,0)) D SETLR
54 Q
55SETLR S PNAM=$P($G(^DPT(DFN,0)),U,1),SSN=$P($G(^DPT(DFN,0)),U,9),IMRTSTLR=$P($G(^DPT(DFN,"LR")),U,1)
56 D DATA
57 Q
58DATA K IMRCD
59 Q:$G(IMRTSTLR)=""
60 S (IMRTSTI,IMRTSTII)="",ILR=IMRTSTLR
61CHEMS S LDT="" F S LDT=$O(^LR(ILR,"CH",LDT)) Q:LDT="" D LINK
62 Q
63LINK S DNAM="" F S DNAM=$O(IMRVALS(DNAM)),LDR="" Q:DNAM="" D
64 . F S LDR=$O(IMRVALS(DNAM,LDR)) Q:LDR="" S GRP=$P(IMRVALS(DNAM,LDR),U,1),TYP=$P(IMRVALS(DNAM,LDR),U,2),LNM=$P(IMRVALS(DNAM,LDR),U,3) D LVAL
65 Q
66LVAL S LRES=$P($G(^LR(ILR,"CH",LDT,DNAM)),U,1),DTRC=$P($G(^LR(ILR,"CH",LDT,0)),U,1),Y=DTRC D DD^%DT S DTAA=Y D PLBS
67 Q
68PLBS Q:(DTRC>IMRHNEND)!(DTRC<IMRHNBEG)
69 Q:LRES=""
70 Q:(LRES["CANC")!(LRES["canc")
71 Q:(LRES["COMM")!(LRES["comm")
72 Q:(DTRC["CANC")!(DTRC["canc")
73 S OYR=$E(DTRC,1,3),ODYR=OYR+1700,ODYR=$E(ODYR,3,4),ODAT=$E(DTRC,4,5)_"/"_$E(DTRC,6,7)_"/"_ODYR
74 S DTAA=$E(DTAA,1,18),LDO=$E(LDT,1,7)
75 I (GRP="CD4")&(TYP'="CD4 PERCENT") Q:(LRES>CDHN)!(LRES<CDLN)
76 I GRP="VIRAL LOAD" S BRES=LRES D CHK I (LRES>VLH)!(LRES<VLL) S LRES=BRES Q
77 S ^TMP($J,PNAM,SSN,LDO,TYP,LRES,DNAM)=LNM_U_GRP_U_LDR_U_DTRC_U_ODAT
78 Q
79CHK S:LRES[" " LRES=$P(LRES," ",1)
80 S:LRES[">" LRES=$E(LRES,2,20)
81 S:LRES["<" LRES=$E(LRES,2,20)
82 S:LRES["," LRES=$P(LRES,",",1)_$P(LRES,",",2)
83 Q
84SORT I '$D(^TMP($J)) W !,"**NO DATA FOUND**" Q
85 S TY=""
86SEC S (D,P)=""
87 F S P=$O(^TMP($J,P)) Q:P="" F S D=$O(^TMP($J,P,D)),I="" Q:D="" F I=0:0 S I=$O(^TMP($J,P,D,I)),T="" Q:I="" F S T=$O(^TMP($J,P,D,I,T)),G="" Q:T="" F S G=$O(^TMP($J,P,D,I,T,G)),H="" Q:G="" F S H=$O(^TMP($J,P,D,I,T,G,H)) Q:H="" D SC
88 Q
89SC S RC=^TMP($J,P,D,I,T,G,H),LN=$P(RC,U,1),IMDATE=$P(RC,U,5)
90 W:DELIM="Y" !,$E(P,1,15)_"^"_$E(D,6,9)_"^"_$E(T,1,14)_"^"_IMDATE_"^"_$E(LN,1,15)_"^"_G
91 W:DELIM'="Y" !,$E(P,1,15),?17,$E(D,6,9),?23,$E(T,1,14),?39,IMDATE,?50,$E(LN,1,15),?67,$E(G,1,14)
92 S TY=T
93 Q
94KILL D ^%ZISC
95 K ^TMP($J),%,%DT,%I,B,BCDH,BCDL,BRES,BVLH,BVLL,C,CDHN,CDLN,D,DELIM,DNAM,DTAA,DTRC,G,GROUP,GRP,GRPNM,H,ICR,IFN,ILR,IMDATE,DIC,DTOUT,DUOUT,IMRLRC,IMRC,IMRC1,IMRFLG,IMRHNBEG,IMRHNEND
96 K IMRVALS,IMRUT,I,J,K,M,N,POP,X,X1,Y,DFN,K1,T,IMRV,VAERR,IMRY,IMRZ,DISYS,IMRDTE,IMRPG,IMRCD,IMRTSTI,IMRSSN,IMRTOT,IMRNODE
97 K IMRJ,IMRNAM,IMRSTN,IMRSD,IMRED,IMRX,IMRD,IMRAD,IMRDD,IMRDFN,IMRI,IMRLRFN,IMRCAT,IMRDFN,IMRDTNM,IMRFLG,IMRH1HED,IMRH2HED,IMRHENGD
98 K IMRHNBEG,IMRHNEND,IMRHQUIT,IMRHRANG,IMRHTART,IMRSTN,IMRTEST,IMRDATE,IMRDOT
99 K IMRTSTII,IMRTSTLR,L,LBNM,LDO,LDR,LDT,LN,LNM,LRES,NODE,ODAT,ODYR,OYR,P,PNAM,RC,RNG,SELE,SSN,TE,TTYPE,TY,TYP,TYPE,VLH,VLL
100 Q
101EOP ; Check End of Page
102 S IMRUT=0
103 Q:$D(IO("S"))
104 I $E(IOST,1,2)="C-" W ! S DIR(0)="E" D ^DIR K DIR I 'Y S IMRUT=1 Q
105 Q
106HEAD ; Heading of the Specific Lab Report
107 Q:$G(DELIM)="Y"
108 W:'($E(IOST,1,2)'="C-"&'IMRPG) @IOF S IMRPG=IMRPG+1
109 W:IOST'["C-" !!!
110 W !,?65,IMRHENGD,!!,?13,"C D 4 / V I R A L T E S T L I S T S B Y R A N G E"
111 W:$G(CDHN)'="" !!,?26,"CD4 Range: "_CDLN_" - "_CDHN
112 W:$G(VLH)'="" !,?26,"Viral Load Range: "_VLL_" - "_VLH
113 W !!,?10,"Date "_IMRHRANG,?65,"Page ",IMRPG,!!
114 W !,"Name",?17,"SSN",?25,"Type",?41,"Date",?52,"Test",?67,"Result"
115 W !,"----",?17,"---",?25,"----",?41,"----",?52,"----",?67,"------"
116 Q
Note: See TracBrowser for help on using the repository browser.