source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUPRPN7.m@ 1314

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1TIUPRPN7 ;SLC/MJC - Progress Notes Outpt Batch Prt ;6/26/01
2 ;;1.0;TEXT INTEGRATION UTILITIES;**45,100,121**;Jun 20, 1997
3 ;
4BATCH ;batch print outpatient progress notes sorted by terminal digit
5 ;if you wish to exlude a particular hospital location from this
6 ;print option that can be specified in the
7 ;EXCLUDE FROM BATCH PRINTING field of file 8925.93
8 ;[TIU PRINT PN BATCH INTERACTIVE]
9 ;
10 N Y,TIUQT,TIUSTART,TIUDIV,ANS,LAST,DIV
11 D SETUP^TIUPRPN3("Batch Print Outpatient Progress Notes by Terminal Digit")
12 W !!?5,"Notes will be printed in terminal digit order."
13 W !!?5,"This option may also be scheduled to run non-interactively"
14 W !?5,"in file #19.2 OPTION SCHEDULING FILE.",!!
15 ;
16 I $D(^TIU(8925.94,0))'=1 W $C(7),$C(7),!?5,"Before using this option "
17 I W "you must enter the divisions for your site in"
18 I W !?5,"file #8925.94 - TIU DIVISION PRINT PARAMETERS FILE." Q
19 ;
20 S DIC=8925.94,DIC(0)="AEQMNZ",DIC("A")="Select DIVISION: "
21 S DIC("B")=$P($G(^DG(40.8,+$G(^DISV(DUZ,"^TIU(8925.94,")),0),""),U)
22 D ^DIC K DIC Q:Y<0
23 S TIUDIV=+Y(0)_U_+Y_U_Y(0,0)
24 ;ien medical center div^ien tiu param^external division
25 S LAST=$P($G(^TIU(8925.94,+$P(TIUDIV,U,2),1)),U)
26 I LAST']"" S TIUSTART=$$DATE^TIUPRPN4() Q:TIUSTART']""
27 I LAST]"" D Q:$D(TIUQT)
28 .W !!,"Notes were last printed for '"_$P(TIUDIV,U,3)_"' "
29 .W $$FMTE^XLFDT(LAST,"1P"),!
30 .S ANS=$$READ^TIUU("YA","Print from this DATE/TIME on? ","YES","D HELP^TIUPRPN5")
31 .I $D(DIRUT) S TIUQT=1 Q
32 .I +$G(ANS) S TIUSTART=LAST Q
33 .D 3^TIUPRPN5 S TIUSTART=$$DATE^TIUPRPN4() I TIUSTART']"" S TIUQT=1 Q
34DEV S %ZIS("B")=$P($G(^%ZIS(1,+$P($G(^TIU(8925.94,$P(TIUDIV,U,2),1)),U,2),0),""),U) ;brings up default prter from 8925.94 param file
35 W ! S %ZIS="Q" D ^%ZIS I POP K POP G EXIT
36 I $E(IOST)="C" W $C(7),$C(7),!?5,"You must select a printer for this "
37 I W "option!!" G DEV
38 S TIUDIV=+$P(TIUDIV,U,2)
39 I $D(IO("Q")) K IO("Q") D G EXIT
40 .S ZTRTN="PRINT^TIUPRPN7",ZTSAVE("TIUSTART")="",ZTSAVE("TIUDIV")=""
41 .S ZTDESC="TIU BATCH PRT PNS OUTPT DIV"
42 .D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Canceled!")
43 .K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,STSAVE,%ZIS,TIUSTART,TIUDIV
44 .D HOME^%ZIS
45 U IO D PRINT,^%ZISC
46 Q
47PRINT ;entry point for non-interactive tasked job
48 ;requires TIUDIV set to the division you want notes for
49 ;if queued non-interactively, file 8925.94- field #1.02 will need
50 ;to contain the start time of the batch
51 ;[TIU PRINT PN BATCH SCHEDULED]- entry point if called from file #19.2
52 ;
53 I '$D(TIUDIV) D TROUBLE G EXIT
54 N DATE,LOC,IFN,SSN,DFN,STOP,DIV
55 K ^TMP("TIUREPLACE",$J),^TMP("TIUPR",$J),^TMP("TIULQ",$J)
56 S STOP=$$NOW^XLFDT
57 I '$D(TIUSTART) S TIUSTART=$P($G(^TIU(8925.94,TIUDIV,1)),U)
58 Q:TIUSTART']"" ;date not passed/no date in field 1.01 file #8925.94
59 S DIV=+$P($G(^TIU(8925.94,TIUDIV,0)),U)
60 S LOC=0
61 F S LOC=$O(^TIU(8925,"ALOCP",LOC)) Q:'LOC D
62 .Q:+$$LOC(LOC,DIV) S DATE=TIUSTART
63 .F S DATE=$O(^TIU(8925,"ALOCP",LOC,DATE)) Q:'DATE!(DATE>STOP) D
64 ..S IFN=0 F S IFN=$O(^TIU(8925,"ALOCP",LOC,DATE,IFN)) Q:'IFN D
65 ...D REPLACE^TIUPRPN3(IFN,DATE,1501)
66 S IFN=0 F S IFN=$O(^TMP("TIUREPLACE",$J,IFN)) Q:'IFN D
67 .S DFN=$P(^TIU(8925,IFN,0),U,2),SSN=$P(^DPT(DFN,0),U,9)
68 .S SSN=$E(SSN,8,9)_$E(SSN,6,7)_$E(SSN,4,5)_$E(SSN,1,3)
69 .S DATE=^TMP("TIUREPLACE",$J,IFN,"DT")
70 .S ^TMP("TIUPR",$J,SSN_";"_DFN,DATE,IFN)="Vice SF 509"
71 I '$D(^TMP("TIUPR",$J)) D TROUBLE G EXIT
72 D PRINT^TIUPRPN1(1,1)
73 S $P(^TIU(8925.94,TIUDIV,1),U)=STOP
74EXIT K ^TIU("TIUPR",$J),^TMP("TIULQ",$J),^TMP("TIUREPLACE",$J)
75 Q
76LOC(LOC,DIV) ;checks if this location should be batch prted
77 N IEN
78 S IEN=$O(^TIU(8925.93,"B",LOC,0))
79 Q $S($P($G(^SC(LOC,0)),U,3)="W":1,$P($G(^SC(LOC,0)),U,15)'=DIV:1,'$D(^TIU(8925.93,+IEN,0)):"",+$G(^TIU(8925.93,IEN,3)):1,1:"")
80 ;
81TROUBLE ;message to print if no output
82 W !!,"The option [TIU PRINT PN BATCH OUTPT] ran to completion at "
83 W !,$$FMTE^XLFDT($$NOW^XLFDT,"1P")," but did not find any notes."
84 W !!,"If you were expecting notes to print review the following:"
85 ;
86 W !!,"INTERACTIVE"
87 W !,"-----------"
88 W !,"1. Very little can go wrong- the required criteria is screened"
89 W !,"while the user is manually queueing the job."
90 W !!,"2. This option prints all the outpatient progress notes, in"
91 W !,"terminal digit order, for the selected date range for ALL CLINICS"
92 W !,"for the selected DIVISION. Verify that you have signed progress"
93 W !,"notes satisfying this criteria.",!
94 ;
95 W !!,"NON-INTERACTIVE (job set to run in OPTION SCHEDULING FILE (#19.2)"
96 W !,"-----------------------------------------------------------------"
97 W !,"1. DIVISION must be defined in file #8925.94 (TIU DIVISION PRINT"
98 W !,"PRINT PARAMETERS FILE)."
99 W !!,"2. The variable TIUDIV must be defined in the VARIABLE NAME "
100 W !,"multiple of the OPTION SCHEDULING FILE (#19.2). TIUDIV should"
101 W !,"be set to the IEN of an entry in the TIU DIVISION PRINT PARAMETERS"
102 W !,"FILE (#8925.94)."
103 W !!,"3. This option must find a valid date in field #1.01 of"
104 W !,"file #8925.94 to start looping on. If a valid date is not "
105 W !,"found, the option will terminate with this message."
106 W !!,"4. To assist in troubleshooting, if no notes are found, the"
107 W !,"DATE/TIME field (#1.01) of file #8925.94 will not be re-set"
108 W !,"to the new value (which is NOW) when the option begins "
109 W "calculating."
110 Q
Note: See TracBrowser for help on using the repository browser.