source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSGAFTR.m@ 1154

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1YSGAFTR ;DALOI/MJE/MJD-GAF INT ENTRY BUILD ROUTINE ;09/01/98 16:17
2 ;;5.01;MENTAL HEALTH;**43,49,59**;Dec 30, 1994
3 ;
4 ;This routine will be executed from option YS GAF TRANSMISSION.
5 ;This routine will transmit GAF data for the dates entered. This
6 ;routine will also be used to re-transmit GAF data as needed.
7 ;It will only transmit GAF records containing all necessary
8 ;pieces of information. A MAILMAN message for each GAF score
9 ;transmitted will be sent to users enrolled in mail group
10 ;YS GAF TRANSMISSION ACK.
11 ;
12 ;
13 Q
14START ;
15 ; Date range will be from no less than 10-01-1997 to any time
16 ; in the future.
17 I '$D(DUZ) D Q
18 .W !!,$C(7),"ERROR: DUZ is not defined. Use ^XUP or ask your "
19 .W !,"IRM why you don't have a DUZ variable defined.",!!
20 .D CLNUP
21 ;
22 S YSGFDATE=""
23 D DTRANGE Q:+Y<1
24 K ^TMP("YSGAFTR",$J)
25 S ZTRTN="GEN^YSGAFTR"
26 ;
27 ;VARIABLES TO BE SAVED IN ZTSAVE
28 S ZTSAVE("*")=""
29 ;
30 S ZTDESC="MENTAL HEALTH - GAF TRANSMISSION"
31 S ZTIO=""
32 D ^%ZTLOAD
33 I '$D(ZTSK) QUIT ;-->
34 W !!,"The Mental Health GAF Transmission has been Tasked, job# "
35 W ZTSK,"...",!
36 Q
37 ;
38DTRANGE ;
39 W !
40 S (YSSTD,YSSPD)=0
41 S %DT("A")="Enter the Start date: ",%DT="AEQ",%DT(0)=2971001
42 D ^%DT K %DT
43 Q:+Y<1
44 S YSSTD=+Y
45 W !
46 S %DT("A")="Enter the End date: ",%DT="AEQ"
47 D ^%DT K %DT
48 Q:+Y<1
49 S YSSPD=+Y
50 I YSSPD<YSSTD D G DTRANGE
51 .W !?5,"... Start date is after the Ending date ..."
52 .W !?5,"... Please re-enter both the Start and Ending Dates ..."
53 .H 2 W $C(7)
54 Q
55 ;
56GEN ;
57 I $D(ZTQUEUED) S ZTREQ="@" K ZTSK
58 S (YSIEN,YSTOT,YSINC,YSTRMT,YSSUBT)=0
59 F YSJ="I","O" D
60 .S (YSTOT(YSJ),YSTRMT(YSJ),YSINC(YSJ))=0
61 F S YSIEN=$O(^YSD(627.8,YSIEN)) Q:YSIEN=""!('YSIEN) D
62 .S YSGFDATE=$P($P($G(^YSD(627.8,YSIEN,0)),"^",1),".",1)
63 .S YSO=$G(^YSD(627.8,YSIEN,0))
64 .S YSPATID=$P(YSO,U,2) ; Patient ID
65 .S YSGAFDT=$P(YSO,U,3) ; Date/time of diagnosis
66 .Q:YSGAFDT=""
67 .S YSGFDATE=$P($P(YSO,U,3),".",1)
68 .I (YSGFDATE>(YSSTD-1))&(YSGFDATE<(YSSPD+1)) D
69 ..S YSTOT=YSTOT+1 ; Count total records found in this date range
70 ..S YSP=$G(^YSD(627.8,YSIEN,60)),YSPATYPE=$P(YSP,U,4)
71 ..I YSPATYPE="" D Q:YSPATYPE=""
72 ...Q:YSPATID=""
73 ...S DFN=YSPATID
74 ...D PATSTAT^YSDX3B
75 ...I '$D(DFN) D QUIT ;--->
76 ....D EN^YSGAFOBX(YSIEN)
77 ...S YSPATYPE=YSSTAT
78 ..S YSTOT(YSPATYPE)=YSTOT(YSPATYPE)+1
79 ..S YSAX5=$P(YSP,U,3),YSPROV=$P(YSO,U,4)
80 ..I YSAX5=""!(YSPROV="") D Q
81 ...S YSINC=YSINC+1
82 ...S YSINC(YSPATYPE)=YSINC(YSPATYPE)+1
83 ..S YSTRMT=YSTRMT+1
84 ..S YSTRMT(YSPATYPE)=YSTRMT(YSPATYPE)+1
85 ..D EN^YSGAFOBX(YSIEN)
86 D REPORT,MAILIT,CLNUP
87 Q
88REPORT ;
89 S YSSUBT=YSINC+YSTRMT,YSLN=0
90 S XTMP="GAF TRANSMISSION TOTALS" D YSLN,SPC
91 S XTMP="Total GAF Records:" D YSLN,SPC
92 F YSJ="I","O" D
93 .S XTMP=$J(+YSTOT(YSJ),8)_" "
94 .S XTMP=XTMP_$S(YSJ="I":"In",1:"Out")_"-patient" D YSLN
95 S XTMP=$J(YSTOT,8)_" Total GAF Records"
96 D YSLN,DSH,DSH,SPC
97 S XTMP="GAF Records Transmitted:" D YSLN,SPC
98 F YSJ="I","O" D
99 .S XTMP=$J(+YSTRMT(YSJ),8)_" "
100 .S XTMP=XTMP_$S(YSJ="I":"In",1:"Out")_"-patient" D YSLN
101 S XTMP=$J(YSTRMT,8)_" GAF Record(s) transmitted" D YSLN,SPC
102 S XTMP="GAF Records Not Transmitted:" D YSLN,SPC
103 F YSJ="I","O" D
104 .S XTMP=$J(+YSINC(YSJ),8)_" "
105 .S XTMP=XTMP_$S(YSJ="I":"In",1:"Out")_"-patient" D YSLN
106 S XTMP=$J(YSINC,8)_" GAF Record(s) not transmitted" D YSLN,DSH,SPC
107 S XTMP=$J(YSSUBT,8)_" Total GAF Records" D YSLN,DSH,DSH,SPC
108 S XTMP=$J((YSTOT-YSSUBT),8)_" Difference" D YSLN
109 Q
110SPC ;
111 S XTMP=" " D YSLN
112 Q
113DSH ;
114 S XTMP="--------" D YSLN
115 Q
116YSLN ;Store to ^TMP for MAILMAN message
117 S YSLN=YSLN+1
118 S ^TMP("YSGAFTR",$J,YSLN)=XTMP
119 Q
120MAILIT ; Mail totals
121 S DTIME=600
122 S XMSUB="GAF Transmission"
123 S XMTEXT="^TMP(""YSGAFTR"",$J,"
124 S XMY(DUZ)=""
125 S XMY("YOUNG,TIM@ISC-DALLAS.VA.GOV")=""
126 S XMY("DEVLIN,MARK@ISC-DALLAS.VA.GOV")=""
127 S XMDUZ="AUTOMATED MESSAGE"
128 D ^XMD
129 S DTIME=$$DTIME^XUP(DUZ)
130 Q
131CLNUP ;This section for clean up of variables
132 K X,Y,YSDIROUT,YSDIRUT,YSDUOUT,YSDTOUT,YSGFDATE,YSIEN,YSSPD,YSSTD
133 K YSANIMA,YSHH,YSSTAT,YSAX5,YSGAFDT,YSINC,YSLN,YSO,YSP,YSPATID
134 K YSPATYPE,YSPROV,YSSUBT,YSTOT,YSTRMT,ZTDESC,ZTIO,ZTRTN,ZTSAVE
135 K XTMP,XMDUZ,XMSUB,XMTEXT,XMSUB,XMY,XCNP,XMZ,YSYEAR,YSJ,YSI
136 K ^TMP("YSGAFTR",$J)
137 Q
Note: See TracBrowser for help on using the repository browser.