source: cprs/branches/tmg-cprs/m_files/TMGPRPN.m@ 1133

Last change on this file since 1133 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 5.9 KB
Line 
1TMGPRPN ;TMG/kst/Print Notes Fns. ;03/25/06
2 ;;1.0;TMG-LIB;**1**;04/25/04
3
4 ;"TMG PRINT NOTES FUNCTIONS
5
6 ;"=======================================================================
7 ;" API -- Public Functions.
8 ;"=======================================================================
9 ;"CONTPRNT -- print notes for chosed patient, contigiously or divided
10 ;"CONTPRN2(PtIEN) -- print notes for specified patient
11 ;"PRPNQUIET(OPTIONS) -- print notes based on input options
12
13 ;"=======================================================================
14 ;"PRIVATE API FUNCTIONS
15 ;"=======================================================================
16
17
18 ;"=======================================================================
19 ;"=======================================================================
20
21CONTPRNT
22 ;"Purpose: To ask for patient name, and date range, and output device
23 ;" and then print notes contigously (i.e. not a separate page
24 ;" for each note), or on separate pages
25 ;"Input: none -- will ask user for values
26 ;"Output: none -- will print to chosen device based on user preference
27
28 new Options
29
30 write !,"-- PRINT NOTES FOR A PATIENT, CONTIGIOUSLY -- ",!!
31
32 set DIC=2 ;"PATIENT file
33 set DIC(0)="MAQE"
34 set DIC("A")="Enter name of Patient to print note for (^ to abort): "
35 do ^DIC
36
37 do CONTPRN2(+Y)
38RADone
39 quit
40
41
42CONTPRN2(PtIEN)
43 ;"Purpose: For specified patient, ask for date range, output device,
44 ;" and if to print notes contigously (i.e. not a separate page
45 ;" for each note) or on separate pages, and if to list avail notes.
46 ;"Input: PtIEN -- record number in file #2
47 ;"Output: none -- will print to chosen device based on user preference
48
49 new Options
50
51 write !
52
53 set Options("PATIENT")=$get(PtIEN,-1)
54 if Options("PATIENT")'>0 do goto CP2Done
55 . write !,"No patient selected. Aborting.",!
56
57 new YN,index
58 read !,"Show list of available notes? (^ to abort): YES// ",YN:$get(DTIME,3600)
59 if YN="" set YN="Y"
60 if YN="^" write "Aborting.",! goto CP2Done
61 if ($$UP^XLFSTR(YN)["Y") do
62 . write !,"Available notes",!
63 . write "---------------",!
64 . set index=$order(^TIU(8925,"C",PtIEN,""),1)
65 . for do quit:(index="")
66 . . if index="" quit ;"note index is DocIEN
67 . . new S,Date,DateS,DocTIEN,TypeName,X,Y
68 . . set Date=$piece($get(^TIU(8925,index,13)),"^",1)
69 . . set Y="D" set DateS=$$FMTE^XLFDT(Date)
70 . . set DocTIEN=$piece($get(^TIU(8925,index,0)),"^",1)
71 . . set TypeName=$piece($get(^TIU(8925.1,DocTIEN,0)),"^",1)
72 . . if TypeName="" set TypeName="(Unknown document type): "_DocTIEN
73 . . write DateS," -- ",TypeName,!
74 . . set index=$order(^TIU(8925,"C",PtIEN,index),1)
75
76 new %DT
77 set %DT="AEP"
78 set %DT("A")="Enter starting date (^ to abort): "
79 do ^%DT
80 if Y=-1 do goto CP2Done
81 . write "Invalid date. Aborting.",!
82 set Options("START")=Y
83
84 set %DT("A")="Enter ending date (^ to abort): "
85 do ^%DT
86 if Y=-1 do goto CP2Done
87 . write "Invalid date. Aborting report.",!
88 set Options("END")=Y
89
90 new ContMode
91 read !,"Print each note on a separate page? NO// ",ContMode:$get(DTIME,3600),!
92 if ContMode="" set ContMode="N"
93 set Options("CONTMODE")=($$UP^XLFSTR(ContMode)["N")
94 if ContMode="^" write "Aborting.",! goto CP2Done
95
96 set %ZIS("A")="Enter output printer or device (^ to abort): "
97 do ^%ZIS
98 if POP do goto CP2Done
99 . write !,"Error selecting output printer or device. Aborting report.",!
100
101 use IO
102 do PRPNQUIET(.Options)
103 use IO(0)
104
105 do ^%ZISC
106
107 write !,"Done. Good bye!",!!
108CP2Done
109 quit
110
111
112PRPNQUIET(OPTIONS)
113 ;"Purpose: To create a report on transcription productivity based on
114 ;" options specified in OPTIONS.
115 ;"Input: The following elements in OPTIONS should be defined
116 ;" 0PTIONS("PATIENT") ;"the IEN of the user (IEN from file 200)
117 ;" OPTIONS("START") ;"Earliest date of documents, in Fileman internal format
118 ;" OPTIONS("END") ;"Latest date of documents, in Fileman internal format
119 ;" OPTIONS("CONTMODE") ;"if 1, then notes printed contigiously
120 ;"Note: This will create a report by writing to the current device
121 ;" If the user wants output to go to a DEVICE, then they should call
122 ;" ^%ZIS prior to calling this function, then use IO,
123 ;" then when done, use IO(0) and call ^%ZISC to close
124
125 if $get(TMGDEBUG)>0 do DebugEntry^TMGDEBUG(.DBIndent,"PRPNQUIET^TMGPRPN")
126
127 new PtIEN
128 new index set index=""
129
130 set PtIEN=+$get(OPTIONS("PATIENT"))
131 if PtIEN=0 do goto PQDone
132 . write "No patient record number supplied. Aborting.",!
133 set StartDT=+$get(OPTIONS("START"))
134 if (StartDT=0) do
135 . write "No start date specified. Aborting.",!
136 set EndDT=+$get(OPTIONS("END"))
137 if (EndDT=0) do
138 . write "No end date specified. Aborting.",!
139
140 kill ^TMP("TIUPR",$J)
141 set index=$order(^TIU(8925,"C",PtIEN,""))
142 for do quit:(index="")
143 . if index="" quit ;"note index is DocIEN
144 . new S,SSN,DATE
145 . set SSN=$Piece(^DPT(PtIEN,0),"^",9)
146 . Set DATE=$piece($get(^TIU(8925,index,13)),"^",1)
147 . if (DATE'<StartDT)&(DATE'>EndDT) do
148 . . Set ^TMP("TIUPR",$Job,SSN_";"_PtIEN,DATE,index)="VistA EMR"
149 . set index=$order(^TIU(8925,"C",PtIEN,index))
150
151 do PRINT^TIUPRPN1(1,1) ;0=> Chart Copy, 1=>Contigious
152
153PQDone
154 if $get(TMGDEBUG)>0 do DebugExit^TMGDEBUG(.DBIndent,"PRPNQUIET^TMGPRPN")
155 quit
156
157
Note: See TracBrowser for help on using the repository browser.