source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMETCO.m@ 1006

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

revised back to 6/30/08 version

File size: 4.1 KB
Line 
1PXRMETCO ; SLC/PJH - QUERI Extract Compliance Report ;01/19/2005
2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
3 ;
4 ;
5ADHOC(IEN,PXRMSTRT,PXRMSTOP) ;Ad Hoc Conformance Report
6 D DUMMY1^PXRMRUTL
7 Q
8 ;
9 D JOB
10 Q
11 ;
12 ;BOOKMARK - cloned from PXRMETX, needs modifying to avoid patient list
13 ;update. Build ^TMP("PXRMETX",$J) for report
14 ;
15REPORT ;Initialise
16 K ^TMP("PXRMETX",$J)
17 ;Workfile node for ^TMP
18 S PXRMNODE="PXRMRULE"
19 ;Get details from parameter file
20 N DATA,DATES,LIST,NAME,PARTYPE,TEXT
21 ;N PERIOD,TEXT,YEAR
22 S DATA=$G(^PXRM(810.2,IEN,0))
23 ;
24 ;Determine Extract Name and period
25 S NAME=$P(DATA,U),PARTYPE=$P(DATA,U,2)
26 ;S YEAR=$P(NEXT,"/",2),PERIOD=$P(NEXT,"/")
27 ;Calculate report period start and end dates
28 ;D CALC^PXRMEUT(NEXT,.PXRMSTRT,.PXRMSTOP)
29 ;Determine output name for patient list and extract summary
30 S DATES=$$FMTE^XLFDT(PXRMSTRT)_" - "_$$FMTE^XLFDT(PXRMSTOP)
31 ;
32 ;Bookmark - Needs inventive patient list names
33 S LIST=NAME_" REPORT "_DATES
34 ;Process (single) Denominator rule into patient list
35 N SEQ,SUB,SUFFIX
36 S SEQ=""
37 F S SEQ=$O(^PXRM(810.2,IEN,10,"B",SEQ)) Q:'SEQ D
38 .S SUB=$O(^PXRM(810.2,IEN,10,"B",SEQ,"")) Q:'SUB
39 .S DATA=$G(^PXRM(810.2,IEN,10,SUB,0)) Q:DATA=""
40 .S PXRMRULE=$P(DATA,U,2) Q:'PXRMRULE
41 .S SUFFIX=$P(DATA,U,3)
42 .I SUFFIX="" S SUFFIX="DENOMINATOR "_SEQ
43 .;Create new patient list
44 .S PXRMLIST=$$CRLST^PXRMRULE(LIST_" "_SUFFIX) Q:'PXRMLIST
45 .D START^PXRMRULE(PXRMRULE,PXRMLIST,PXRMNODE,PXRMSTRT,PXRMSTOP,IEN,"","")
46 .;Clear ^TMP lists created for rule
47 .D CLEAR^PXRMRULE(PXRMRULE,PXRMNODE)
48 .;Process reminders
49 .D REM^PXRMETXR(SUB,PXRMLIST)
50 ;
51 ;Bookmark - Report stuff goes here
52 ;Update totals section
53 N APPL,DUE,DATA,ETYP,EVAL
54 N FAPPL,FCNT,FDATA,FDUE,FEVAL,FGNAM,FIND,FNAPPL,FNDUE,FSEQ
55 N NAPPL,NDUE,PXRMLIST,RCNT,RIEN,RSEQ,SEQ
56 S SEQ=0,CNT=1
57 F S SEQ=$O(^TMP("PXRMETX",$J,SEQ)) Q:'SEQ D
58 .S RCNT=0,RSEQ=0
59 .F S RCNT=$O(^TMP("PXRMETX",$J,SEQ,RCNT)) Q:'RCNT D
60 ..S DATA=$G(^TMP("PXRMETX",$J,SEQ,RCNT)) Q:'DATA
61 ..S RIEN=$P(DATA,U),PXRMLIST=$P(DATA,U,5)
62 ..S EVAL=$P(DATA,U,2),APPL=$P(DATA,U,3),DUE=$P(DATA,U,4)
63 ..S NAPPL=EVAL-APPL,NDUE=APPL-DUE
64 ..S CNT=CNT+1,RSEQ=RSEQ+1
65 ..;bookmark - write patient line
66 ..;For each count type
67 ..S ETYP="",FCNT=CNT
68 ..F S ETYP=$O(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP)) Q:ETYP="" D
69 ...;For each term
70 ...S FIND=0,FSEQ=0
71 ...F S FIND=$O(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP,FIND)) Q:FIND="" D
72 ....;Update finding totals
73 ....S FDATA=$G(^TMP("PXRMETX",$J,SEQ,RCNT,ETYP,FIND)),FCNT=FCNT+1
74 ....S FEVAL=$P(FDATA,U,2),FAPPL=$P(FDATA,U,3),FDUE=$P(FDATA,U,4)
75 ....S FNAPPL=FEVAL-FAPPL,FNDUE=FAPPL-FDUE
76 ....S FSEQ=FSEQ+1,FGNAM=$P(DATA,U,9)
77 ....;Bookmark - write finding line
78 ..;Update CNT
79 ..S CNT=FCNT
80 Q
81 ;
82 ;Determine whether the report should be queued.
83JOB ;
84 N %ZIS,ZTDESC,ZTSAVE,ZTRTN,ZTSK
85 S DBDUZ=DUZ
86 D SAVE^PXRMXQUE
87 S %ZIS="Q"
88 S ZTDESC="QUERI Compliance Report - print"
89 S ZTRTN="REPORT^PXRMETCO"
90 S ZTSK=1
91 S PXRMQUE=0
92 S PXRMQUE=$$DEVICE^PXRMXQUE(ZTRTN,ZTDESC,.ZTSAVE,.%ZIS,.ZTSK)
93 I PXRMQUE=1 G EXIT
94 I PXRMQUE>0 S ^XTMP(PXRMXTMP,"PRZTSK")=PXRMQUE
95 Q
96 ;
97EXIT ;Clean things up.
98 D ^%ZISC
99 D HOME^%ZIS
100 K IO("Q")
101 K DIRUT,DTOUT,DUOUT,POP,ZTREQ
102 I $D(ZTSK) D KILL^%ZTLOAD
103 K ZTSK,ZTQUEUED
104 K ^TMP("PXRMXTR",$J)
105 Q
106 ;
107SAVE ;Save the variables for queing.
108 S ZTSAVE("IEN")=""
109 S ZTSAVE("PXRMSTRT")=""
110 S ZTSAVE("PXRMSTOP")=""
111 Q
112 ;
113 ;
114QUE ;BOOKMARK - NOT USED
115 ;Queue the MST synchronization job.
116 N DIR,DTOUT,DUOUT,MINDT,SDTIME,STIME,X,Y
117 S MINDT=$$NOW^XLFDT
118 W !,"Queue the Clinical Reminders MST synchronization."
119 S DIR("A",1)="Enter the date and time you want the job to start."
120 S DIR("A")="It must be after "_$$FMTE^XLFDT(MINDT,"5Z")_" "
121 S DIR(0)="DAU"_U_MINDT_"::RSX"
122 D ^DIR
123 I $D(DTOUT)!$D(DUOUT) Q
124 S SDTIME=Y
125 K DIR
126 S DIR(0)="YA"
127 S DIR("A")="Do you want to run the MST synchronization at the same time every day? "
128 S DIR("B")="Y"
129 D ^DIR
130 I $D(DTOUT)!$D(DUOUT) Q
131 I Y S STIME="1."_$P(SDTIME,".",2)
132 E S STIME=-1
133 ;
134 ;Put the task into the queue.
135 K ZTSAVE
136 ;S ZTSAVE("START")=SDTIME
137 S ZTSAVE("STIME")=STIME
138 S ZTRTN="SYNCH^PXRMMST"
139 S ZTDESC="Clinical Reminders MST synchronization job"
140 S ZTDTH=SDTIME
141 S ZTIO=""
142 D ^%ZTLOAD
143 W !,"Task number ",ZTSK," queued."
144 Q
Note: See TracBrowser for help on using the repository browser.