1 | YSCLTST2 ;DALOI/LB/RLM-TRANSMIT RX AND lAB DATA FOR CLOZAPINE ;19 Feb 93
|
---|
2 | ;;5.01;MENTAL HEALTH;**18,22,26,47,61,69,74,90,92**;Dec 30, 1994;Build 7
|
---|
3 | ; Reference to ^LAB(60 supported by IA #333
|
---|
4 | ; Reference to ^PSDRUG supported by IA #25
|
---|
5 | ; Reference to ^XMD supported by IA #10070
|
---|
6 | ;
|
---|
7 | TRANSMIT ; send remote and local, kill and quit
|
---|
8 | K XMZ S %DT="T",X="NOW" D ^%DT S YSCLNOW=$P(Y,".",2),YSCLSITE=$P($$SITE^VASITE,"^",2)
|
---|
9 | S $P(YSSTOP,",",7)=7 I $$S^%ZTLOAD D ABORT^YSCLTEST G END
|
---|
10 | I YSCLLN D
|
---|
11 | . K XMY
|
---|
12 | . S XMY("S.RUCLRXLAB@FO-HINES.MED.VA.GOV")=""
|
---|
13 | . I YSDEBUG K XMY S XMY("G.CLOZAPINE DEBUG@FO-DALLAS.MED.VA.GOV")="",XMY("G.RUCLRXLAB@FO-DALLAS.MED.VA.GOV")=""
|
---|
14 | . S XMDUZ="Clozapine MONITOR",XMTEXT="^TMP($J,",XMSUB=$S(YSDEBUG:"DEBUG ",1:"")_"Clozapine lab data @ "_YSCLSITE_" on "_DT_" at "_YSCLNOW D ^XMD
|
---|
15 | K XMY
|
---|
16 | S XMY("G.CLOZAPINE ROLL-UP@FORUM.VA.GOV")=""
|
---|
17 | I YSDEBUG K XMY S XMY("G.CLOZAPINE DEBUG@FO-DALLAS.MED.VA.GOV")=""
|
---|
18 | S XMY("G.PSOCLOZ")=""
|
---|
19 | S XMSUB=$S(YSDEBUG:"DEBUG ",1:"")_"Clozapine lab data @ "_YSCLSITE_" on "_DT_" at "_YSCLNOW
|
---|
20 | S ^TMP("YSCL",$J,2,0)=" ",^TMP("YSCL",$J,3,0)="In message # "_$S($D(XMZ):XMZ,1:"no data sent")
|
---|
21 | K XMZ S XMDUZ="Clozapine MONITOR",^TMP("YSCL",$J,1,0)="Clozapine lab data was transmitted, "_(YSCLLLN-3)_" records were sent",XMTEXT="^TMP(""YSCL"",$J," D ^XMD
|
---|
22 | S $P(^YSCL(603.03,1,0),"^",5)=$$NOW^XLFDT
|
---|
23 | END ;
|
---|
24 | G END1^YSCLTST3
|
---|
25 | Q
|
---|
26 | REXMIT ; retransmit lab and RX data
|
---|
27 | ; must be a tuesday
|
---|
28 | S DIR(0)="Y",DIR("A")="Are you sure you wish to retransmit lab data"
|
---|
29 | D ^DIR K DIR I Y'=1 K Y Q
|
---|
30 | DATE S %DT="AEXP",%DT(0)=-DT,%DT("A")="Ending date for data collection (must be a tuesday )"
|
---|
31 | D ^%DT K %DT G END:X="^",END:X="^" I Y=-1 G DATE
|
---|
32 | SERV S YSCLED=Y,X=Y D H^%DTC I %H#7'=5 W !,"MUST BE A TUESDAY" G DATE
|
---|
33 | S ZTDESC="Server triggered retransmission"
|
---|
34 | S ZTSAVE("YSCLED")="",ZTIO="",ZTRTN="REXMIT^YSCLTEST",ZTDTH=$H D ^%ZTLOAD G END
|
---|
35 | FLSET ;Set up file 603.02
|
---|
36 | W @IOF,"This option specifies the blood tests associated with the Clozapine"
|
---|
37 | W !,"reporting software. Two tests must be defined. The first is the White"
|
---|
38 | W !,"Blood Count. The second is the Granulocyte (or Neutrophil) percentage."
|
---|
39 | K DIR W !! S DIR(0)="PA^64:EMZ",DIR("A",1)="Enter the test that will be used to record the White Blood Count for the",DIR("A")="Clozapine patients: " D ^DIR
|
---|
40 | Q:Y=-1!($D(DUOUT))!($D(DTOUT))!($D(DIRUT))!($D(DIROUT))
|
---|
41 | S YSCLWBC=+Y
|
---|
42 | K DIR W !! S DIR(0)="PA^64:EMZ",DIR("A",1)="Enter the test that will be used to record the Neutrophil Count (percentage)",DIR("A")=" for the Clozapine patients: " D ^DIR
|
---|
43 | Q:Y=-1!($D(DUOUT))!($D(DTOUT))!($D(DIRUT))!($D(DIROUT))
|
---|
44 | S YSCLGRN=+Y
|
---|
45 | I YSCLWBC,YSCLGRN S ^YSCL(603.02,1,0)=YSCLWBC_"^"_YSCLGRN,$P(^YSCL(603.02,0),"^",3,4)="1^1"
|
---|
46 | ;Only one entry is allowed.
|
---|
47 | K DIR,X,Y,YSCLWBC,YSCLGRN,ZTDESC
|
---|
48 | Q
|
---|
49 | EN(DRG) ;
|
---|
50 | K LAB I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")'="PSOCLO1" S LAB("NOT")=0 Q
|
---|
51 | I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")="PSOCLO1" D
|
---|
52 | . S (CNT,I)=0 F S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I S CNT=$G(CNT)+1
|
---|
53 | . I CNT'=2 S LAB("BAD TEST")=0 K CNT Q
|
---|
54 | . K CNT F I=0:0 S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I D
|
---|
55 | . . S LABT=$S($P(^PSDRUG(DRG,"CLOZ2",I,0),"^",4)=1:"WBC",1:"ANC"),LAB(LABT)=$P(^PSDRUG(DRG,"CLOZ2",I,0),"^")_"^"_$P(^(0),"^",3)_"^"_$P(^(0),"^",4)
|
---|
56 | K LABT,I
|
---|
57 | Q
|
---|
58 | CL1(DFN,DAYS) ;The routine was split due to size
|
---|
59 | G CL1^YSCLTST4
|
---|
60 | Q
|
---|
61 | ;
|
---|
62 | CL(DFN) ;
|
---|
63 | K ^TMP("LRRR",$J) N RESULTS,YSCLYWBC,YSCLRANC,YSCLXWBC,YSCLRWBC,YSCLFRQ
|
---|
64 | I 'DFN Q "-1^-1^-1^-1^-1^-1^-1"
|
---|
65 | S YSCLFRQ=$O(^YSCL(603.01,"C",DFN,"")) I YSCLFRQ]"" S YSCLFRQ=$P(^YSCL(603.01,YSCLFRQ,0),"^",3)
|
---|
66 | I $G(^YSCL(603.03,1,1))=1!(YSCLFRQ="") Q "-1^0^0^0^0^0^"_YSCLFRQ
|
---|
67 | S X1=DT,X2="-7" D C^%DTC S YSCLSD=X
|
---|
68 | S YSCLA=0 F S YSCLA=$O(^YSCL(603.04,1,1,YSCLA)) Q:'YSCLA S YSCLTLS=^YSCL(603.04,1,1,YSCLA,0),YSCLTLS($P(YSCLTLS,"^",2),$P(YSCLTLS,"^",1))=$P(YSCLTLS,"^",3)
|
---|
69 | S YSCLTL="" F S YSCLTL=$O(^YSCL(603.04,1,1,"B",YSCLTL)) Q:'YSCLTL D
|
---|
70 | . D RR^LR7OR1(DFN,,YSCLSD,DT,,YSCLTL,"L")
|
---|
71 | . S YSCLSB1="" F S YSCLSB1=$O(^TMP("LRRR",$J,DFN,YSCLSB1)) Q:YSCLSB1="" D
|
---|
72 | . . S YSCLTDT="" F S YSCLTDT=$O(^TMP("LRRR",$J,DFN,YSCLSB1,YSCLTDT)) Q:YSCLTDT="" I $P(YSCLTDT,".",2)]"" D
|
---|
73 | . . . S YSCLTA="" F S YSCLTA=$O(^TMP("LRRR",$J,DFN,YSCLSB1,YSCLTDT,YSCLTA)) Q:YSCLTA="" I YSCLTA D
|
---|
74 | . . . . S RESULTS1=^TMP("LRRR",$J,DFN,YSCLSB1,YSCLTDT,YSCLTA)
|
---|
75 | . . . . S RESULTS(YSCLTL,YSCLTDT)=$P(RESULTS1,"^",2)
|
---|
76 | ;Find all entries for WBC and sort by inverse date.
|
---|
77 | S YSCLA="" F S YSCLA=$O(YSCLTLS("W",YSCLA)) Q:'YSCLA S YSCLXWBC(YSCLA)="" D
|
---|
78 | . S YSCLA1="" F S YSCLA1=$O(RESULTS(YSCLA,YSCLA1)) Q:'YSCLA1 S YSCLYWBC(YSCLA1)=RESULTS(YSCLA,YSCLA1)_"^"_$P($G(^LAB(60,YSCLA,0)),"^")_"^"_YSCLTLS("W",YSCLA)
|
---|
79 | S YSCLRWBC=$O(YSCLYWBC(0)) I 'YSCLRWBC D KILL Q "0^^^^^^"_YSCLFRQ
|
---|
80 | S YSCLMULT=$P(YSCLYWBC(YSCLRWBC),"^",3),YSCLMULT=$S(YSCLMULT:1000,1:1)
|
---|
81 | S YSCLRWBC(YSCLRWBC)=($P(YSCLYWBC(YSCLRWBC),"^")*YSCLMULT)_"^"_$P(YSCLYWBC(YSCLRWBC),"^",2)
|
---|
82 | ;Scan for Neutrophil count on same day and time as most recent WBC
|
---|
83 | S YSCLMTCH=0 F YSCLA="A","N","S","T" S YSCLTPT="" Q:YSCLMTCH F S YSCLTPT=$O(YSCLTLS(YSCLA,YSCLTPT)) Q:'YSCLTPT D Q:YSCLMTCH
|
---|
84 | . S YSCLMULT=YSCLTLS(YSCLA,YSCLTPT),YSCLMULT=$S(YSCLMULT:1000,1:1)
|
---|
85 | . I $D(RESULTS(YSCLTPT,YSCLRWBC)),YSCLA="A",RESULTS(YSCLTPT,YSCLRWBC)'?1A.E S YSCLMTCH=1,YSCLRANC(YSCLRWBC)=RESULTS(YSCLTPT,YSCLRWBC)*YSCLMULT_"^"_$P(^LAB(60,YSCLTPT,0),"^") Q
|
---|
86 | . I $D(RESULTS(YSCLTPT,YSCLRWBC)),YSCLA="N",RESULTS(YSCLTPT,YSCLRWBC)'?1A.E S YSCLMTCH=1,YSCLRANC(YSCLRWBC)=YSCLRWBC(YSCLRWBC)*((RESULTS(YSCLTPT,YSCLRWBC))*.01)_"^"_$P(^LAB(60,YSCLTPT,0),"^") Q
|
---|
87 | . I $D(RESULTS(YSCLTPT,YSCLRWBC)),YSCLA="S",RESULTS(YSCLTPT,YSCLRWBC)'?1A.E D
|
---|
88 | . . S YSCLSGS="" F S YSCLSGS=$O(YSCLTLS("B",YSCLSGS)) D Q:YSCLMTCH
|
---|
89 | . . . S:'YSCLSGS YSCLSGS="Z" I '$D(RESULTS(YSCLSGS,YSCLRWBC)) S RESULTS(YSCLSGS,YSCLRWBC)=0
|
---|
90 | . . . S YSCLMTCH=1,YSCLRANC(YSCLRWBC)=YSCLRWBC(YSCLRWBC)*((RESULTS(YSCLTPT,YSCLRWBC)*.01)+(RESULTS(YSCLSGS,YSCLRWBC)*.01))_"^"_$P(^LAB(60,YSCLTPT,0),"^")_"/"_$P($G(^LAB(60,YSCLSGS,0)),"^") Q
|
---|
91 | . I $D(RESULTS(YSCLTPT,YSCLRWBC)),YSCLA="C",RESULTS(YSCLTPT,YSCLRWBC)'?1A.E D
|
---|
92 | . . S YSCLSGS="" F S YSCLSGS=$O(YSCLTLS("T",YSCLSGS)) D Q:YSCLMTCH
|
---|
93 | . . . S:'YSCLSGS YSCLSGS="Z" I '$D(RESULTS(YSCLSGS,YSCLRWBC)) S RESULTS(YSCLSGS,YSCLRWBC)=0
|
---|
94 | . . . S YSCLMTCH=1,YSCLRANC(YSCLRWBC)=((RESULTS(YSCLTPT,YSCLRWBC)*YSCLMULT)+(RESULTS(YSCLSGS,YSCLRWBC)*YSCLMULT))_"^"_$P(^LAB(60,YSCLTPT,0),"^")_"/"_$P($G(^LAB(60,YSCLSGS,0)),"^") Q
|
---|
95 | D KILL
|
---|
96 | I $G(YSCLRWBC(YSCLRWBC))<3000!($G(YSCLRANC(YSCLRWBC))<1500) Q "0^"_$G(YSCLRWBC(YSCLRWBC))_"^"_$S($G(YSCLRANC(YSCLRWBC))="":"^",1:$G(YSCLRANC(YSCLRWBC)))_"^"_(9999999-YSCLRWBC)_"^"_YSCLFRQ
|
---|
97 | I $G(YSCLRWBC(YSCLRWBC))<3500!($G(YSCLRANC(YSCLRWBC))<2000) Q "2^"_$G(YSCLRWBC(YSCLRWBC))_"^"_$S($G(YSCLRANC(YSCLRWBC))="":"^",1:$G(YSCLRANC(YSCLRWBC)))_"^"_(9999999-YSCLRWBC)_"^"_YSCLFRQ
|
---|
98 | Q "1^"_YSCLRWBC(YSCLRWBC)_"^"_YSCLRANC(YSCLRWBC)_"^"_(9999999-YSCLRWBC)_"^"_YSCLFRQ
|
---|
99 | ;
|
---|
100 | KILL ;
|
---|
101 | K FDA,YSCLSGS,Y15,RESULTS,RESULTS1,YSCLA,YSCLA1,YSCLMTCH,YSCLSB1,YSCLSD,YSCLTA,YSCLMULT
|
---|
102 | K YSCLTL,YSCLTLS,X1,X2
|
---|
103 | Q
|
---|
104 | ;
|
---|
105 | OVERRIDE(DFN) ;Check for an over-ride.
|
---|
106 | S YSCLOVR=$O(^YSCL(603.01,"C",DFN,""))
|
---|
107 | Q:YSCLOVR="" 0
|
---|
108 | S YSCLOVR=$P(^YSCL(603.01,YSCLOVR,0),"^",4)
|
---|
109 | Q YSCLOVR=DT
|
---|
110 | ;
|
---|
111 | ZEOR ;YSCLTST2
|
---|