source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RARTE5.m@ 1608

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

initial load of WorldVistAEHR

File size: 9.3 KB
RevLine 
[613]1RARTE5 ;HISC/SWM AISC/MJK,RMO-Enter/Edit Outside Reports ;10/24/07 12:58
2 ;;5.0;Radiology/Nuclear Medicine;**56**;Mar 16, 1998;Build 3
3 ;Private IA #4793 CREATE^WVRALINK
4 ;Controlled IA #3544 ^VA(200
5 ;Supported IA #2056 GET1^DIQ
6 ;Supported IA #10013 IX1^DIK
7 ;Supported IA #10141 MES^XPDUTL
8 ; adapted from RARTE, RARTE1, RARTE4
9 F I=1:1:7 W !?3,$P($T(INTRO+I),";;",2)
10 W ! D SET^RAPSET1 I $D(XQUIT) K XQUIT Q
11 N RAXIT,RASUBY0,RA18EX,RAPRTSET,RAMEMARR,RA1,RA7003
12 S RAXIT=0
13 I $D(RANOSCRN) S X=$$DIVLOC^RAUTL7() I X D Q1 QUIT
14 ;
15 ; only require any Radiology Classification in New Person file
16 S X=0 F I="C","R","S","T" S:$D(^VA(200,"ARC",I,DUZ)) X=1
17 I 'X W !,"Your user account is missing a Radiology classification.",! D INCRPT Q
18 ;
19START K RAVER S RAVW="",RAREPORT=1 D ^RACNLU G Q1:"^"[X
20 ; RACNLU defines RADFN, RADTI, RACNI, RARPT
21 S RASUBY0=Y(0) ; save value of y(0)
22 S RANUENTR=0 ;=0 subsequent edit of report, =1 initial making of report
23 G:$P(^RA(72,+RAST,0),"^",3)>0 CONTIN
24 I $D(^XUSEC("RA MGR",DUZ)) G CONTIN
25 G:$P(RAMDV,"^",22)=1 CONTIN
26 W $C(7),!!,"The STATUS for this case is CANCELLED. You may not enter a report.",!! D INCRPT G START
27 ;
28CONTIN ; continue
29 S RAXIT=0 D DISPLAY^RARTE6
30 I RA18EX=-1 D INCRPT G START
31 ; raprtset is defined in display^rarte6
32 I RAPRTSET W !,"OUTSIDE report cannot be linked to a printset." D INCRPT G START
33 S RAPNODE="^RADPT("_RADFN_",""DT"","_RADTI_",""P"","
34 S RA7003=@(RAPNODE_RACNI_",0)")
35 S RAXIT=$$LOCK^RARTE6(RAPNODE,RACNI) I RAXIT D INCRPT G START
36 ;
37 ; Existing rpt must have field 5 = "EF" and field 18 with data
38 I $D(^RARPT(+RARPT,0)),(($P(^(0),"^",5)'="EF")!($P(^(0),"^",18)="")) W !?3,$C(7),"Only Electronicaly Filed reports can be selected!",! D UNLOCK^RAUTL12(RAPNODE,RACNI) D INCRPT G START
39 ;Create new rpt, or skip to IN to edit existing report
40 G IN:$D(^RARPT(+RARPT,0))
41 ; check Credit Method
42 S X=$P(@(RAPNODE_RACNI_",0)"),U,26)
43 I X'=2 W !!?3,"This option is for Outside work (imaged and read), so the case should ",!?3,"be 'No Credit', but this case has a credit method of '",$$GET1^DIQ(70.03,RACNI_","_RADTI_","_RADFN_",",26),"'"
44 K DIR S DIR(0)="Y",DIR("B")="NO"
45 S DIR("A")="Do you want to continue"
46 S DIR("?")="Enter YES to continue with this option"
47 W ! D ^DIR K DIR
48 I Y'=1 D INCRPT G START
49 ;
50 S RANUENTR=1 ; new report being made
51NEW1 S RARPTN=$E(RADTE,4,7)_$E(RADTE,2,3)_"-"_RACN
52 W !?3,"...report not entered for this exam...",!?10,"...will now initialize report entry..."
53 S I=+$P(^RARPT(0),"^",3)
54 ;
55LOCK ;Try to lock next avail IEN, if locked - fail, if used - increment again
56 S I=I+1 S RAXIT=$$LOCK^RARTE6("^RARPT(",I) I RAXIT D UNLOCK^RAUTL12(RAPNODE,RACNI) D INCRPT G START
57 ;don't check ^RARPT("B",RARPTN) due cloaked deleted reports
58 I $D(^RARPT(I)) D UNLOCK^RAUTL12("^RARPT(",I) G LOCK
59 S ^RARPT(I,0)=RARPTN,RARPT=I,^(0)=$P(^RARPT(0),"^",1,2)_"^"_I_"^"_($P(^(0),"^",4)+1),^DISV($S($D(DUZ)#2:DUZ,1:0),"^RARPT(")=I S:'$D(^RARPT(RARPT,"T")) ^("T")=""
60 S ^RARPT(RARPT,0)=RARPTN_"^"_RADFN_"^"_RADTE_"^"_RACN_"^EF",DIK="^RARPT(",DA=RARPT D IX1^DIK
61 K %,D,D0,DA,DI,DIC,DIE,DQ,DR,X,Y
62 S DA(2)=RADFN,DA(1)=RADTI,DA=RACNI
63 S DIE="^RADPT("_RADFN_",""DT"","_RADTI_",""P"","
64 S DR="17////"_RARPT D ^DIE
65 K %,D,D0,DA,DI,DIC,DIE,DQ,DR,RAY1,X,Y
66 W !,RAI
67 G IN0
68IN ;edit existing rpt, so lock rpt fr the 1st time
69 S RAXIT=$$LOCK^RARTE6("^RARPT(",RARPT) I RAXIT D UNLOCK^RAUTL12(RAPNODE,RACNI) G Q1
70IN0 ;skip to here if rpt created in this session and already locked
71 ; save DXs before edit
72 S RANY1=$$ANYDX^RARTE7(.RAA1) ;1=has DXs, 0=no DXs, RAA1() stores DXs
73 ; Ask if copy standard report
74 I $P(RAMDV,"^",12) D STD^RARTE1 I X="^" S RAXIT=1 G UNCASE
75 ; Ask Report Date
76 S DR="8",DA=RARPT,DIE="^RARPT(" D ^DIE K DE,DQ
77 ; y is defined if user "^" out
78 I $D(Y) K Y G UNCASE
79 ; Display Clinical History
80 D CHPRINT^RAUTL9
81 ; report status before editing
82 S RACT=$P(^RARPT(RARPT,0),U,5)
83 ; Edit Report Text and enter Diagnostic code(s)
84 D ERPT
85 ; continue to check sufficient data even if RAXIT=1 at this point
86UNCASE ;
87 D UNLOCK^RAUTL12(RAPNODE,RACNI) ;unlock case
88 ; check if sufficient data; del rpt & xrefs if no rpt txt & impression
89 S RAXIT=$$CCAN(RARPT)
90 D UNLOCK^RAUTL12("^RARPT(",RARPT) ;unlock report
91 G:RAXIT PRT
92 ;
93 ; "EF" was stuffed in LOCK+5 for new reports
94 I $P(^RARPT(RARPT,0),U,5)'="EF" D SETFF^RARTE6(74,5,RARPT,"EF")
95 W !,"Report status is stored as ""Electronically Filed""."
96 ; Stuff in initial entry date only once
97 I $P(^RARPT(RARPT,0),U,18)="" D SETFF^RARTE6(74,18,RARPT,"NOW","E")
98 ; Stuff in Activity Log subfile at all times
99 D SETALOG^RARTE6("+1,"_RARPT_",","F","")
100 ;
101 ; transmit to women's health each time this point is reached
102 ; COPY^WVRALINK will stop if the same case number is already in 790.1
103 ;
104 I $P(^RARPT(RARPT,0),U,5)="EF",$T(CREATE^WVRALINK)]"" D CREATE^WVRALINK(RADFN,RADTI,RACNI) ; women's health
105 ;
106PRT I RAXIT S RAXIT=0 D INCRPT G START
107 ;
108 ; report status after editing
109 S RACT=$P(^RARPT(RARPT,0),U,5)
110 ; ---
111 ; set RAHLTCPB to prevent broadcast ORM messages
112 N RAHLTCPB S RAHLTCPB=1
113 ; update case's exam status only if exam status isn't COMPLETE
114 D:$$GET1^DIQ(72,+$P(RA7003,U,3)_",",3)'=9 UP1^RAUTL1
115 S RANY2=$$ANYDX^RARTE7(.RAA2) ;RAA2() store DXs after edit
116 ; always check alert if new/changed diagnostic codes, send alert if nec.
117 D ALERT^RARTE7
118 K RAAB
119PRT1 R !!,"Do you wish to print this report? No// ",X:DTIME S:'$T!(X["^") X="N" S:X="" X="N" ;030497
120 I "Nn"[$E(X) D INCRPT G START
121 I "Yy"'[$E(X) W:X'["?" $C(7) W !!?3,"Enter 'YES' to print this report, or 'NO' not to." G PRT1
122 S ION=$P(RAMLC,"^",10),IOP=$S(ION]"":"Q;"_ION,1:"Q")
123 S RAMES="W !!?3,""Report has been queued for printing on device "",ION,""."""
124 D Q^RARTR D INCRPT G START ; queue rpt, cleanup, startover
125 ;
126Q1 K %,%DT,%W,%Y,%Y1,C,D0,D1,DA,DIC,DIE,DR,OREND,RABTCH,RABTCHN,RACN,RACNI,RACOPY,RACS,RACT,RADATE,RADFN,RADTE,RADTI,RADUZ,RAELESIG,RAFIN,RAHEAD,RAI,RAJ1
127 K RALI,RALR,RANME,RANUM,RAOR,RAORDIFN,RAPNODE,RAPRC,RAPRIT,RAQUIT,RAREPORT,RARES,RARPDT,RARPT,RARPTN,RARPTZ,RARTPN,RASET,RASI,RASIG,RASN,RASSN,RAST,RAST1,RASTI,RASTFF,RAVW,XQUIT,W,X,Y
128 K D,D2,DDER,DI,DIPGM,DLAYGO,J,RAEND,RAF5,RAFL,RAFST,RAIX,RAPOP,RAY1
129 K ^TMP($J,"RAEX")
130 K POP,DUOUT,RAFDA,RATEXT,RADIR0,RAXIT
131 D INCRPT
132 Q
133INCRPT ; Kill extraneous variables to avoid collisions.
134 ; Incomplete report information, select another case #.
135 K DA,DIE,DR,RATXT
136 K %,%DT,D,D0,D1,D2,DI,DIC,DIWT,DN,I,J,RACN,RACNI,RACT,RADATE,RADTE
137 K RADTI,RAFIN,RAI,RALI,RALR,RANME,RAPRC,RARPT,RARPTN,RASSN,RAST,RAVW,X
138 K RANUENTR
139 Q
140CCAN(IEN74) ;Check canned report for Outside Reporting
141 ; adapted from EN3^RAUTL15
142 ; outputs: 0 if report is kept
143 ; 1 if report is deleted due to no canned text entered
144 ;
145 ; keep report if it is linked to images
146 I $O(^RARPT(IEN74,2005,0))>0 Q 0
147 ;
148 ;del canned report if missing both REPORT TEXT and IMPRESSION TEXT
149 I '$O(^RARPT(IEN74,"I",0)),'$O(^RARPT(IEN74,"R",0)) D Q 1
150 .; no printsets in outside rpt'g, so no pointer to file 74 from 70.04
151 .;
152 .; exec field's xrefs' KILL logic
153 .S DA(2)=RADFN,DA(1)=RADTI,DA=RACNI
154 .D ENKILL^RAXREF(70.03,17,IEN74,.DA)
155 .;
156 .;del piece 17 from case record
157 .S $P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",17)="" K DA,X
158 .;
159 .; Del report ptr from batch and distribution files
160 .D UPDTPNT^RAUTL9(IEN74)
161 .;
162 .; Del entry from Report file
163 .K RATXT
164 .S DA=IEN74,DIK="^RARPT(" D ^DIK
165 .S RATXT(1)=" "
166 .S RATXT(2)=" Outside canned report not complete. Must Delete......deletion complete!"
167 .S RATXT(3)=$C(7) D MES^XPDUTL(.RATXT)
168 .Q
169 Q 0
170ERPT ; Edit report text, impression, and enter/edit diagnostic codes
171 S $P(RATXT,"+",52)=""
172 W !!?5,RATXT,!?8,"Required: REPORT TEXT and/or IMPRESSION TEXT",!?5,RATXT
173 S RAXIT=0
174 S DA=RARPT,DIE="^RARPT("
175 S DR="200;I X=""^"" S Y=""@8"";300;I X'=""^"" S Y=""@9"";@8;S RAXIT=1;@9"
176 D ^DIE
177 ; Report Text and Impression Text cannot both be empty
178 I '$O(^RARPT(RARPT,"I",0)),'$O(^RARPT(RARPT,"R",0)) G ERPT
179 I RAXIT=1 Q
180 ; Diagnostic codes
181 ; (code taken from routine RARTE1)
182 S RAIMGTYI=$P($G(^RADPT(RADFN,"DT",RADTI,0)),U,2),RAIMGTYJ=$P($G(^RA(79.2,+RAIMGTYI,0)),U)
183 S X=+$O(^RA(72,"AA",RAIMGTYJ,9,0)),DA(2)=RADFN,DA(1)=RADTI,DA=RACNI,DIE="^RADPT("_DA(2)_",""DT"","_DA(1)_",""P""," K RAIMGTYI,RAIMGTYJ
184 ; ask Prim. Diag, required if site require diag, don't ck abnormal here
185 S DR=13_$S('$D(^RA(72,X,.1)):"",$P(^(.1),"^",5)'="Y":"",1:"R")
186 S RAXIT=$$LOCK^RARTE6(DIE,.DA)
187 ; allow user to "^" exit
188 I 'RAXIT D ^DIE D UNLOCK^RAUTL12(DIE,.DA) K DA,DE,DQ,DIE,DR
189 I RAXIT!($P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),U,13)="")!($D(Y)) S RAXIT=0 G PACS
190 S DR="50///"_RACN
191 S DR(2,70.03)=13.1
192 S DR(3,70.14)=.01 ; don't ck abnormal here
193 S DA(1)=RADFN,DA=RADTI,DIE="^RADPT("_DA(1)_",""DT"","
194 S RAXIT=$$LOCK^RARTE6("^RADPT("_RADFN_",""DT"","_RADTI_",""P"",",.RACNI) ;lock at P level
195 I 'RAXIT D ^DIE D UNLOCK^RAUTL12("^RADPT("_RADFN_",""DT"","_RADTI_",""P"",",.RACNI) K DA,DE,DQ,DIE,DR ;unlock at P level
196 I $D(Y) K Y S RAXIT=1 ;$D(Y) means user "^" out
197PACS ; do not broadcast ORU message
198 ;
199 ; move WV outside of this in case rpt is deleted due insufficient data
200 Q
201 ;
202INTRO ;
203 ;;+--------------------------------------------------------+
204 ;;| |
205 ;;| This option is for entering canned text for |
206 ;;| outside work: interpreted report done outside, |
207 ;;| and images made outside this facility. |
208 ;;| |
209 ;;+--------------------------------------------------------+
Note: See TracBrowser for help on using the repository browser.