source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSCLTEST.m@ 711

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

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1YSCLTEST ;DALOI/LB/RLM-COLLECT RX AND LAB DATA FOR CLOZAPINE ;18 Feb 93
2 ;;5.01;MENTAL HEALTH;**18,22,26,47,61,69,74,90**;Dec 30, 1994;Build 18
3 ; Reference to ^DPT supported by IA #10035
4 ; Reference to ^DIC(5 supported by IA #10056
5 ; Reference to ^PS(55 supported by IA #787
6 ; Reference to ^PSDRUG supported by IA #25
7 ; Reference to ^PSRX supported by IA #780
8 ; Reference to ^XMD supported by IA #10070
9BKGRD ;Normal entry for weekly background job - dates from T-10 to T-3
10 S X=DT D DW^%DTC Q:X'=$P(^YSCL(603.03,1,0),"^",2) ;Make the day to run a parameter settable by the server.
11 S YSOFF=$S(X="SUNDAY":0,X="MONDAY":1,X="TUESDAY":2,X="WEDNESDAY":3,X="THURSDAY":4,X="FRIDAY":5,X="SATURDAY":6,1:7) Q:YSOFF>6
12 S X="T-"_YSOFF D ^%DT S YSCLED=Y,YSCLRET=""
13 ;S YSCL=$H#7-2 S:YSCL<1 YSCL=YSCL+7 S X="T-"_(YSCL+7) D ^%DT S YSCLED=Y,YSCLRET="" K YSCL ;Make sure it's a Sunday ending date.
14RUN ; entry from above for normal or below for requeue
15 S YSDEBUG=$P(^YSCL(603.03,1,0),"^",3)
16 ;I $G(^YSCL(603.02,1,0))'?1.N1"^"1.N G FLERR^YSCLTST3 ;Check for entry in file 603.02, report an error if either entry is missing.
17 D DMG^YSCLTST3
18 S YSCLSITE=$P($$SITE^VASITE,"^",2)
19 K XMY
20 S XMY("G.CLOZAPINE ROLL-UP@FORUM.VA.GOV")=""
21 I YSDEBUG K XMY S XMY("G.CLOZAPINE DEBUG@FO-DALLAS.MED.VA.GOV")=""
22 S %DT="T",X="NOW" D ^%DT S YSCLNOW=$P(Y,".",2)
23 S XMSUB=$S(YSDEBUG:"DEBUG ",1:"")_"Clozapine lab data started at "_YSCLSITE_" on "_DT_" at "_YSCLNOW,^TMP("YSCL",$J,1,0)=" ",^TMP("YSCL",$J,2,0)="+++ Clozapine data collection started at "_YSCLSITE_" on "_DT_" +++",^TMP("YSCL",$J,3,0)=" "
24 S XMTEXT="^TMP(""YSCL"",$J,",XMDUZ="Clozapine MONITOR" D ^XMD
25 S $P(^YSCL(603.03,1,0),"^",4)=$$NOW^XLFDT
26 ;send MM message when routine started.
27 S YSCLLN=0,YSCLLLN=3,X1=$P(YSCLED,"."),X2=-60 D C^%DTC S YSCLM28=X,X1=$P(YSCLED,"."),X2=-28 D C^%DTC S YSCLM7=X,YSCLED=YSCLED+.5 ;28 TO 60 and 14 to 28 6/15/05
28 S X1=$P(YSCLED,"."),X2=-180 D C^%DTC S YSCLM180=X
29 S X1=$P(YSCLED,"."),X2=-56 D C^%DTC S YSCLM56=X
30 S YSCLIF=+$$SITE^VASITE_","
31 D GETS^DIQ(4,YSCLIF,"1.01;1.02;1.03;.02;1.04","I","YSCLFF")
32 S $P(YSCLDEMO,"^",1)=YSCLFF(4,YSCLIF,1.01,"I")
33 S $P(YSCLDEMO,"^",2)=YSCLFF(4,YSCLIF,1.02,"I")
34 S $P(YSCLDEMO,"^",3)=YSCLFF(4,YSCLIF,1.03,"I")
35 S $P(YSCLDEMO,"^",4)=$P(^DIC(5,YSCLFF(4,YSCLIF,.02,"I"),0),"^",2)
36 S $P(YSCLDEMO,"^",5)=YSCLFF(4,YSCLIF,1.04,"I")
37 S $P(YSCLDEMO,"^",6)=""
38 K J,YSCLF,YSCLFF,YSCLIF,X
39 ;YSCLDEMO=street1^street2^city^state(2 letter)^ZIP^phone
40 K ^TMP($J),^TMP("YSCL",$J) S (DFN,YSCLIEN)=0
41 F K YSCLA S YSCLIEN=$O(^YSCL(603.01,YSCLIEN)),YSCLLD=0 Q:'YSCLIEN S DFN=$P($G(^YSCL(603.01,YSCLIEN,0)),"^",2) S $P(YSSTOP,",",1)=1 Q:$$S^%ZTLOAD D:DFN
42 . I $D(^DPT(DFN,0)),$D(^YSCL(603.01,YSCLIEN,0)) S YSCLSAND=$P($G(^YSCL(603.01,YSCLIEN,0)),"^",2),YSCL=^DPT(DFN,0),YSCLX=$E($P($P(YSCL,"^"),",",2))_$E(YSCL)_"^"_$P(YSCL,"^",9) D
43 . . S YSCLLAB="" D GET I YSCLLAB]"" D CHECK^YSCLTST1 I YSCLT D LOAD^YSCLTST1
44 G TRANSMIT^YSCLTST2
45GET ;prescriptions
46 Q:$$S^%ZTLOAD
47 S YSCLPHY="",$P(YSCLX,"^",6)=$P(YSCLDEMO,"^",5),$P(YSCLX,"^",11)=$P($P($G(^YSCL(603.01,YSCLIEN,0)),"^"),"^"),$P(YSCLX,"^",16)=DT
48 ;site zip(p6),registration number (p11), today (p16)
49 F YSCL=0:0 S YSCL=$O(^PS(55,DFN,"P",YSCL)) Q:'YSCL I $D(^(YSCL,0)) S YSCL1=^(0) I $D(^PSRX(YSCL1,0)) S YSCLRX=^(0) D ACTIVE I YSACT=0,$P($G(^PSDRUG(+$P(YSCLRX,"^",6),"CLOZ1")),"^")="PSOCLO1" D
50 . S YSCLZ2=0 F S YSCLZ2=$O(^PSDRUG(+$P(YSCLRX,"^",6),"CLOZ2",YSCLZ2)) Q:'YSCLZ2 I $P($G(^PSDRUG(+$P(YSCLRX,"^",6),"CLOZ2",YSCLZ2,0)),"^")]"",$P($G(^PSDRUG(+$P(YSCLRX,"^",6),"CLOZ2",YSCLZ2,0)),"^",4)=1 D Q
51 . . S YSCLLAB=^(0)
52 . . S YSCLID=$P(YSCLRX,"^",13) S:YSCLID>YSCLLD YSCLLD=YSCLID I YSCLID'>DT,YSCLID'<YSCLM28 S YSCLA(-YSCLID,-YSCL1)="" ;Changed YSCLED to DT RLM
53 Q
54ACTIVE ;Test for Active prescriptions
55 S YSACT=$$GET1^DIQ(52,YSCL1_",",100,"I")
56 Q
57REXMIT ;Resend Clozapine data
58 S X1=YSCLED,X2=-3 D C^%DTC S YSCLED=X,YSCLRET=1,ZTREQ="@" G RUN
59 Q
60ABORT ;
61 K XMY
62 S XMY("G.CLOZAPINE ROLL-UP@FORUM.VA.GOV")=""
63 I YSDEBUG K XMY S XMY("G.CLOZAPINE DEBUG@FO-DALLAS.MED.VA.GOV")=""
64 S %DT="T",X="NOW" D ^%DT S YSCLNOW=$P(Y,".",2)
65 S YSCLSITE=$P($$SITE^VASITE,"^",2)
66 S XMSUB="Clozapine Roll-Up aborted ["_$G(YSSTOP)_"] at "_YSCLSITE_" on "_DT
67 S YSTEXT(1,0)=" "
68 S YSTEXT(2,0)=$S(YSDEBUG:"DEBUG ",1:"")_"Clozapine Roll-Up aborted ["_$G(YSSTOP)_"] at "_YSCLSITE_" on "_DT_" at "_YSCLNOW,^TMP("YSCL",$J,1,0)=" "
69 S XMTEXT="YSTEXT(",XMDUZ="Clozapine MONITOR" D ^XMD
70 S ZTSTOP=1 Q
71ZEOR ;YSCLTEST
Note: See TracBrowser for help on using the repository browser.