source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RARTE2.m@ 623

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

initial load of WorldVistAEHR

File size: 5.5 KB
RevLine 
[613]1RARTE2 ;HISC/SWM-Edit/Delete a Report ;7/16/01 14:05
2 ;;5.0;Radiology/Nuclear Medicine;**10,31**;Mar 16, 1998
3 ; known vars-->RADFN,RACNI,RADTI,RARPT,RARPTN
4PTR ; if current ^RADPT() rec is a PRINT SET,
5 ; then for other ^RADPT() recs of the same PRINT SET,
6 ; create its corresponding subrec in ^RARPT()
7 S RAXIT=0
8 I '$D(RADFN)!'$D(RACNI)!'$D(RADTI)!'$D(RARPT)!'$D(RARPTN) D Q
9 . S RAXIT=1 Q:$G(RARIC)
10 . I '$D(RAQUIET) W !!,$C(7),"Missing data (routine RARTE2)",! S RAOUT=$$EOS^RAUTL5() Q
11 . S RAERR="Missing data needed by routine RARTE2"
12 . Q
13 N RA1,RA2,RA3,RAFDA,RAIEN,RAMSG ;RA3=exam status
14 S RA1=0
15PTR2 S RA1=$O(^RADPT(RADFN,"DT",RADTI,"P","B",RA1)) Q:RA1="" S RA2=$O(^(RA1,0)),RA3=$P(^RADPT(RADFN,"DT",RADTI,"P",RA2,0),"^",3) G:$P(^(0),"^",25)'=2 PTR2 ;skip non-combined rpt
16 G:RA2=RACNI PTR2 ;skip already processed case
17 K RAFDA,RAIEN,RAMSG
18ASK G:$G(RARIC) UPD G:$D(RAQUIET) UPD ; don't ask, if from Img pkg or Kurzweil
19 I $P(^RA(72,+RA3,0),"^",3)=0 D G:%=2 PTR2 G:%'=1 ASK
20 . W !!,"Case ",RA1," of this print set has been cancelled."
21 . W !,"Do you want to include it in the report anyway"
22 . S %=2 D YN^DICN
23 . W:%>0 "...",$S(%=2:"Ex",%=1:"In",1:""),"clude case ",RA1
24 . Q
25 ; update file #70, field REPORT TEXT
26UPD S $P(^RADPT(RADFN,"DT",RADTI,"P",RA2,0),U,17)=RARPT
27 D INSERT
28 Q:RAXIT G PTR2
29INSERT ; add subrec to file #74's subfile #74.05
30 S RAFDA(74.05,"?+2,"_RARPT_",",.01)=$P(RARPTN,"-")_"-"_RA1
31 D UPDATE^DIE("","RAFDA","RAIEN","RAMSG")
32 I $D(RAMSG) D Q
33 . S RAXIT=1 Q:$G(RARIC)
34 . I '$D(RAQUIET) W !!,$C(7),"Error encountered while setting sub-records (routine RARTE2)",! S RAOUT=$$EOS^RAUTL5() Q ;error detected
35 . S RAERR="Error encountered while setting sub-recs from RARTE2"
36 Q
37DEL17(RAIEN) ;del other print set members' pointer to #74
38 Q:'$D(RADFN)!('$D(RADTI))
39 N RA4,RA1 D EN3^RAUTL20(.RA4)
40 Q:'$O(RA4(0))
41 S RA1=""
42D18 S RA1=$O(RA4(RA1)) Q:RA1=""
43 ; kill xrefs, if any, for file #70's REPORT TEXT
44 S DA(2)=RADFN,DA(1)=RADTI,DA=RA1
45 ; if this exam's piece 17 doesn't match RAIEN, then don't remove pc17
46 I $P($G(^RADPT(RADFN,"DT",RADTI,"P",RA1,0)),"^",17)'=RAIEN G D18
47 D ENKILL^RAXREF(70.03,17,RAIEN,.DA)
48 ; set REPORT TEXT to null
49 S:$D(^RADPT(RADFN,"DT",RADTI,"P",RA1,0)) $P(^(0),"^",17)=""
50 G D18
51COPY ;copy physicians and diagnoses
52 Q:'$D(RADFN)!('$D(RADTI))!('$D(RACNI))!('$D(RAMEMARR))!('$D(RADRS))
53 W !!,"... now copying ",$S(RADRS=1:"Diagnostic Codes",1:"Staff & Resident data")," to other cases in this print set ...",!
54 N RA1,RA2,RA3
55 N RA1PR,RA1PS ;prim res/staff
56 N RA1SR,RA1SS ; sec res/staff arrays--(ien subfile #70.11)=ien file #200
57 N RA1PD,RA1SD ; prim diag, then sec diags array
58 N RAFDA,RAIEN,RAMSG
59 ;prim res, prim staff, prim diag
60 S RA1=^RADPT(RADFN,"DT",RADTI,"P",RACNI,0) S:RADRS=2 RA1PR=$P(RA1,"^",12),RA1PS=$P(RA1,"^",15) S:RADRS=1 RA1PD=$P(RA1,"^",13)
61 ;sec residents
62 I RADRS=2,$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"SRR",0)) S RA1=0 F S RA1=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"SRR",RA1)) Q:+RA1'=RA1 S RA1SR(RA1)=+^(RA1,0)
63 ;sec staff
64 I RADRS=2,$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"SSR",0)) S RA1=0 F S RA1=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"SSR",RA1)) Q:+RA1'=RA1 S RA1SS(RA1)=+^(RA1,0)
65 ;sec diagnoses
66 I RADRS=1,$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"DX",0)) S RA1=0 F S RA1=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"DX",RA1)) Q:+RA1'=RA1 S RA1SD(RA1)=+^(RA1,0)
67 ;loop thru other cases of this printset
68 S RA1=0
69COPYLOOP S RA1=$O(RAMEMARR(RA1)) G:RA1="" COPYREF G:RA1=RACNI COPYLOOP ;skip what's done already
70 ;
71 ; copy primary staff and resident via Fileman
72 I RADRS=2 D
73 . S DA(2)=RADFN,DA(1)=RADTI,DA=RA1
74 . S DIE="^RADPT("_DA(2)_",""DT"","_DA(1)_",""P"","
75 . S DR="12////"_RA1PR_";15////"_RA1PS
76 . D ^DIE K DA,DIE,DR ; no locking
77 . Q
78 ;
79 ; copy primary diagnostic code via Fileman
80 I RADRS=1 D
81 . S DA(2)=RADFN,DA(1)=RADTI,DA=RA1
82 . S DIE="^RADPT("_DA(2)_",""DT"","_DA(1)_",""P"","
83 . S DR="13////"_RA1PD
84 . D ^DIE K DA,DIE,DR ; no locking
85 . Q
86 ;
87 S RA2=RA1_","_RADTI_","_RADFN ;stem for dataserver call
88 S DA(3)=RADFN,DA(2)=RADTI,DA(1)=RA1 ;base vars for DIK call
89 I RADRS=2 S RA3=0 D KIL3 G:RAXIT Q ; sec res
90 I RADRS=2 S RA3=0 D KIL4 G:RAXIT Q ; sec staff
91 I RADRS=1 S RA3=0 D KIL5 G:RAXIT Q ; sec diag
92 G COPYLOOP
93KIL3 S RA3=$O(^RADPT(RADFN,"DT",RADTI,"P",RA1,"SRR",RA3)) G:RA3="" COPY3
94 S DA=RA3
95 S DIK="^RADPT("_DA(3)_",""DT"","_DA(2)_",""P"","_DA(1)_",""SRR"","
96 D ^DIK
97 G KIL3
98COPY3 K RAFDA,RAIEN,RAMSG S RA3=$O(RA1SR(RA3)) Q:'RA3 Q:RAXIT
99UP3 ;
100 S RAFDA(70.09,"?+2,"_RA2_",",.01)=RA1SR(RA3)
101 D UPDATE^DIE("","RAFDA","RAIEN","RAMSG") G:'$D(RAMSG) COPY3
102 S RAXIT=1 W !!,$C(7),"Error encountered while in adding rec ",RA3," to sub-file 70.09" Q
103KIL4 S RA3=$O(^RADPT(RADFN,"DT",RADTI,"P",RA1,"SSR",RA3)) G:RA3="" COPY4
104 S DA=RA3
105 S DIK="^RADPT("_DA(3)_",""DT"","_DA(2)_",""P"","_DA(1)_",""SSR"","
106 D ^DIK
107 G KIL4
108COPY4 K RAFDA,RAIEN,RAMSG S RA3=$O(RA1SS(RA3)) Q:'RA3 Q:RAXIT
109UP4 ;
110 S RAFDA(70.11,"?+2,"_RA2_",",.01)=RA1SS(RA3)
111 D UPDATE^DIE("","RAFDA","RAIEN","RAMSG") G:'$D(RAMSG) COPY4
112 S RAXIT=1 W !!,$C(7),"Error encountered while in adding rec ",RA3," to sub-file 70.11" Q
113KIL5 S RA3=$O(^RADPT(RADFN,"DT",RADTI,"P",RA1,"DX",RA3)) G:RA3="" COPY5
114 S DA=RA3
115 S DIK="^RADPT("_DA(3)_",""DT"","_DA(2)_",""P"","_DA(1)_",""DX"","
116 D ^DIK
117 G KIL5
118COPY5 K RAFDA,RAIEN,RAMSG S RA3=$O(RA1SD(RA3)) Q:'RA3 Q:RAXIT
119UP5 ;
120 S RAFDA(70.14,"?+2,"_RA2_",",.01)=RA1SD(RA3)
121 D UPDATE^DIE("","RAFDA","RAIEN","RAMSG") G:'$D(RAMSG) COPY5
122 S RAXIT=1 W !!,$C(7),"Error encountered while in adding rec ",RA3," to sub-file 70.14" Q
123COPYREF ; clear out Fileman vars and quit
124 K DA,DIK
125 Q ; don't need to re-xref again
126Q K DA Q
Note: See TracBrowser for help on using the repository browser.