source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAO7MFN.m@ 699

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

initial load of WorldVistAEHR

File size: 6.8 KB
Line 
1RAO7MFN ;HISC/GJC-Create MFN orderable item update msg ;6/11/97 08:47
2 ;;5.0;Radiology/Nuclear Medicine;**1,6,10,18,45**;Mar 16, 1998
3 ;Last midification by SS for P18 JUN 19, 2000
4 ;Last modification: 12.16.03 patch 45 Contrast Media by CPT gjc
5PROC(RAENALL,RAFILE,RASTAT,RAY) ; Entry point to update a single procedure.
6 ; 'RAY' <> is the same as 'Y' when passed back from DIC after
7 ; lookup on file 71 & file 71.3
8 ; 'RAENALL'<> single procedure (0) or whole file update (1) flag
9 ; 'RAFILE' <> file # of the file being edited (71 or 71.3)
10 ; 'RASTAT' <> Procedure file (71) status: 0 inactive^1 active
11 ; Com. Proc. file (71.3) Seq. # status: 0 inactive^1 active
12 ; 1st piece: status before edit, 2nd piece: status after
13 ; edit.
14 ; This entry point can be called from 2^RAMAIN2 or 13^RAMAIN2
15 ; This routine assumes that RAVAR is defined as an array or global
16 ; root in which to place the output.
17 ;
18 Q:'$D(RAY)!('$D(RAFILE))!('$D(RASTAT))!('$D(RAENALL))
19 S RAFNUM=71,RAFNAME=$P($G(^DIC(RAFNUM,0)),"^"),RAXIT=0
20 S:'$D(RATSTMP) RATSTMP=$$NOW^XLFDT()
21 S:'$D(RACNT) RACNT=0 S:'$D(RAINCR) RAINCR="S RACNT=RACNT+1"
22 S:'$D(RASUB) RASUB="""RAO7"""
23 D:'$D(RAHLFS)!('$D(RAECH)) EN1^RAO7UTL
24 I 'RAENALL,('$D(RAVAR)) D
25 . S RAVAR="^TMP("_RASUB_","_RATSTMP_","
26 . S RAVARBLE="^TMP("_RASUB_","_RATSTMP_")"
27 . Q
28 I RAFILE=71 D
29 . S RA71(0)=$G(^RAMIS(RAFILE,+RAY,0))
30 . S RA71("I")=$G(^RAMIS(RAFILE,+RAY,"I"))
31 . I $D(^RAMIS(71.3,"B",+RAY)) D
32 .. S RA713(0)=$G(^RAMIS(71.3,+$O(^RAMIS(71.3,"B",+RAY,0)),0))
33 .. Q
34 . Q
35 I RAFILE=71.3 D
36 . S RA713(0)=$G(^RAMIS(RAFILE,+RAY,0))
37 . ; if RA713(0)="" then the common procedure was deleted
38 . S RASVIEN=$S(+RA713(0)>0:+RA713(0),1:+$P(RAY,"^",2))
39 . S RA71(0)=$G(^RAMIS(71,RASVIEN,0))
40 . S RA71("I")=$G(^RAMIS(71,RASVIEN,"I"))
41 . K RASVIEN
42 . Q
43 Q:$$PROCNDE^RAO7UTL(.RA71) ; Does the Proc. have Proc-Types & I-Types
44 I RAFILE=71 D
45 .I +$P(RAY,"^",3) D
46 ..;new entry, add to master file whether active or inactive
47 ..S RAMFE="MAD"
48 ..Q
49 .I '+$P(RAY,"^",3),(+$P(RASTAT,"^",2)) D
50 ..;now active regardless of prior status, update master file
51 ..S RAMFE="MUP"
52 ..Q
53 .I '+$P(RAY,"^",3),('+$P(RASTAT,"^",2)) D
54 ..;now inactive regardless of prior status, deactivate master file
55 ..S RAMFE="MDC"
56 ..Q
57 .Q
58 ; If RAMFE is still not defined, must be an addition to common orders
59 ; 'Update' to OE since procedure is already in their master file
60 I RAFILE=71.3 S RAMFE="MUP"
61 ;
62 ; If parent with no descendents, send deactivate msg even if active
63 I $P($G(RA71(0)),"^",6)="P",'$O(^RAMIS(71,$S(RAFILE=71.3:+$P(RAY,"^",2),1:+RAY),4,0)) S RAMFE="MDC"
64 ;
65 S RACPT(0)=$$NAMCODE^RACPTMSC(+$P(RA71(0),"^",9),DT)
66 S:RAFILE=71 RAIEN71=+RAY S:RAFILE=71.3 RAIEN71=+$P(RAY,"^",2)
67 S RAXT71=$P(RA71(0),"^")
68 S RAIMGAB=$P($G(^RA(79.2,+$P(RA71(0),"^",12),0)),"^",3)
69 S RAPHYAP=$S($P(RA71(0),"^",11)="":"","Yy"[$P(RA71(0),"^",11):"Y",1:"N")
70 S RACOST=$P(RA71(0),"^",10),RAPRCTY=$P(RA71(0),"^",6)
71 S RACMNOR=$S($P($G(RA713(0)),"^",4)]"":"Y",1:"N") ;can't be an active common w/o a seq #
72 ;determine CM associations for active & inactive procedures
73 S RACMCODE=$$CMEDIA^RAO7UTL(RAIEN71,$P(RA71(0),U,6)) ;ien, proc. type
74 S RAINACT=$S(RA71("I")]"":$$HLDATE^HLFNC(RA71("I"),"DT"),1:"")
75 I 'RAENALL D
76 . X RAINCR
77 . S @(RAVAR_RACNT_")")=$$MSH^RAO7UTL("MFN^M01") X RAINCR ;P18 event type
78 . D MFI^RAO7UTL("UPD") ;P18
79 . Q
80 S @(RAVAR_RACNT_")")="MFE"_RAHLFS_RAMFE_RAHLFS_RAHLFS_RAINACT_RAHLFS
81 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_$P(RACPT(0),"^")
82 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAECH(1)
83 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_$P(RACPT(0),"^",2)
84 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAECH(1)_"CPT4"
85 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAECH(1)_RAIEN71
86 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAECH(1)_RAXT71
87 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAECH(1)_"99RAP"
88 K RAINACT X RAINCR
89 S @(RAVAR_RACNT_")")="ZRA"_RAHLFS_RAIMGAB_RAHLFS_RAPHYAP
90 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAHLFS_RACOST_RAHLFS
91 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_$G(RACMCODE)_RAHLFS
92 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RACMNOR_RAHLFS
93 S @(RAVAR_RACNT_")")=@(RAVAR_RACNT_")")_RAPRCTY_RAHLFS
94 ; Check the synonym (1), message (3) and the Education Description
95 ; "EDU" multiples for data
96 N I,J,K,RAPMSG S RAPMSG=0
97 F RAMULT="^RAMIS(71,"_RAIEN71_",1,","^RAMIS(71,"_RAIEN71_",3,","^RAMIS(71,"_RAIEN71_",""EDU""," D
98 . I RAMULT=("^RAMIS(71,"_RAIEN71_",""EDU"","),($$UP^XLFSTR($P(RA71(0),"^",17))'="Y") Q ; display Ed Descr not set to yes, quit
99 . Q:'+$O(@(RAMULT_"0)")) ; no data for 1 synonym, 3 message, "EDU" desc multiple
100 . S (I,J)=0,K=""
101 . F S J=$O(@(RAMULT_J_")")) Q:J'>0 D
102 .. S K=$G(@(RAMULT_J_",0)"))
103 .. I RAMULT=("^RAMIS(71,"_RAIEN71_",1,") D Q
104 ... X RAINCR S I=I+1
105 ... S @(RAVAR_RACNT_")")="ZSY"_RAHLFS_I_RAHLFS_$P(K,"^")
106 ... Q
107 .. I RAMULT=("^RAMIS(71,"_RAIEN71_",3,") D
108 ... X RAINCR S I=I+1,RAPMSG=1
109 ... S @(RAVAR_RACNT_")")="NTE"_RAHLFS_I_RAHLFS_RAHLFS_$P($G(^RAMIS(71.4,+K,0)),"^")
110 ... Q
111 .. I RAMULT=("^RAMIS(71,"_RAIEN71_",""EDU"",") D
112 ... I RAPMSG D
113 .... X RAINCR S I=I+1
114 .... S @(RAVAR_RACNT_")")="NTE"_RAHLFS_I_RAHLFS_RAHLFS_" "
115 .... S RAPMSG=0
116 .... Q
117 ... X RAINCR S I=I+1
118 ... S @(RAVAR_RACNT_")")="NTE"_RAHLFS_I_RAHLFS_RAHLFS_K
119 ... Q
120 .. Q
121 . Q
122 I 'RAENALL D
123 . D MSG^XQOR("RA ORDERABLE ITEM UPDATE",RAVARBLE)
124 . D PURGE^RAO7UTL
125 . Q
126 X:RAENALL RAINCR
127 Q
128ENALL ; Whole Rad/Nuc Med Procedure file update. Called only when Rad/Nuc
129 ; Med or OE/RR are being installed.
130 Q:'$D(XPDNM) ; quit if not KIDS, xists during pre/post inits
131 ; & environment check routines.
132 L +^RAMIS(71.3):300 D ^RACOMDEL L -^RAMIS(71.3)
133 L +^RAMIS(71):300
134 I '$T D Q
135 . N TXT S TXT(1)=" "
136 . S TXT(2)="Another user is editing a record in the "
137 . S TXT(2)=TXT(2)_$P($G(^DIC(71,0)),"^")
138 . S TXT(3)="file. Try again later!"
139 . S XPDQUIT=1 D MES^XPDUTL(.TXT)
140 . Q
141 N RA,RACNT,RAECH,RAENALL,RAFILE,RAFNAME,RAFNUM,RAHLFS,RAINCR,RASTAT
142 N RASUB,RATSTMP,RAVAR,RAXIT,RAY
143 S (RA,RACNT)=0,RAENALL=1,RATSTMP=$$NOW^XLFDT(),RAINCR="S RACNT=RACNT+1"
144 S RASUB="""RAO7""",RAVAR="^TMP("_RASUB_","_RATSTMP_","
145 S RAVARBLE="^TMP("_RASUB_","_RATSTMP_")"
146 D EN1^RAO7UTL ; sets up RAECH & RAHLFS
147 S (RAFILE,RAFNUM)=71,RAFNAME=$P($G(^DIC(RAFNUM,0)),"^"),RASTAT="0^1"
148 X RAINCR S @(RAVAR_RACNT_")")=$$MSH^RAO7UTL("MFN^M01") X RAINCR ;P18 event type
149 D MFI^RAO7UTL("REP")
150 F S RA=$O(^RAMIS(71,RA)) Q:RA'>0 D D PURGE1^RAO7UTL
151 . S RA(0)=$G(^RAMIS(71,RA,0)),RA("I")=$G(^RAMIS(71,RA,"I"))
152 . Q:$P(RA("I"),"^")]""&($P(RA("I"),"^")'>DT) ; inactive date present
153 . S RAY=RA_"^"_$P(RA(0),"^")_"^"_1 D PROC(RAENALL,RAFILE,RASTAT,RAY)
154 . Q
155 D EN^ORMFN(RAVARBLE) K @RAVARBLE,RAVARBLE
156 L -^RAMIS(71) ; unlock whole file
157PARM ;Send Div params for SUBMIT TO prompt and allowing BROAD procedures
158 ;to OE3 so they can populate their OE/RR Parameter Instance file
159 N DIK S DIK="^RA(79,",DIK(1)=".121^AC1" D ENALL^DIK
160 N DIK S DIK="^RA(79,",DIK(1)=".17^AC" D ENALL^DIK
161 Q
Note: See TracBrowser for help on using the repository browser.