source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RABWORD.m@ 841

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

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1RABWORD ;HOIFO/JH&MM - Radiology Billing Awareness ;12/20/04 12:55am
2 ;;5.0;Radiology/Nuclear Medicine;**41,57**;Mar 16, 1998
3 ;
4 ; Rtn invokes IA #226-C, #1300-A, #2083, #10082, #2343, #4419
5 Q
6 ;
7ASK(RADFN,RASDDT) ; Ask ICD DX & SC/EI/MST/HNC questions at time of Order.
8 ; Called from BAQUES^RAORD1
9 Q:'$D(^XUSEC("PROVIDER",DUZ)) ;user provider key check
10 Q:'$$CIDC^IBBAPI(RADFN) ;patient insurance & CIDC switch check
11 N DIC,I11,RACNT,RADUP,RAQUIT,RABCOPY,RABASEC K RAKILL S RABASEC=0
12 ;if previous order's ICD9 etc. were copied, then put them in RABWDX to file
13 I $D(^TMP("RACOPY",$J)) D
14 .I ^TMP("RACOPY",$J,"BA") S RABWDX(1)=^("BA")
15 .S RABCOPY=0,RACNT=1
16 .F S RABCOPY=$O(^TMP("RACOPY",$J,"BA",RABCOPY)) Q:'RABCOPY S RACNT=RACNT+1,RABWDX(RACNT)=^(RABCOPY)
17PRIMDX I $D(^TMP("RACOPY",$J,"BA")) D
18 .S RABCOPY(1)=^TMP("RACOPY",$J,"BA")
19 .D BADISP^RABWORD1(.RABCOPY)
20 S DIC="^ICD9(",DIC(0)="QEAMNZ"
21 S DIC("A")="Ordering ICD-9 Diagnosis: "
22 S DIC("B")="" I $D(RABWDX(1))&($P($G(RABWDX(1)),U)>0) S DIC("B")=$P(^ICD9(+RABWDX(1),0),U)
23 I $D(RABCOPY) S DIC("B")=$P(RABCOPY(1),U) K RABCOPY
24 S DIC("S")="I $P($$ICDDX^ICDCODE(Y,DT),U,10)" D ^DIC
25 S:(+Y<0) Y=0
26 S:Y="^" RAQUIT=1
27 I (+Y>0) D
28 .S RACNT=1,$P(RABWDX(RACNT),U,1)=+Y D BAQUES S Y=1
29 ; check @ deletion of previous entry
30 I X="@" K RABWDX(1)
31 Q:'$D(RABWDX)!$G(RAQUIT)
32 ;
33SECDX F I11=1:1:7 Q:($G(RAQUIT)&'$O(RABWDX(I11))) W ! D
34 .I $D(^TMP("RACOPY",$J,"BA"))&(RABASEC'="") D
35 ..S RABASEC=$O(^TMP("RACOPY",$J,"BA",RABASEC))
36 ..Q:RABASEC=""
37 ..S RABCOPY(2)=^TMP("RACOPY",$J,"BA",RABASEC)
38 ..D BADISP^RABWORD1(.RABCOPY)
39 .S DIC="^ICD9(",DIC(0)="QEAMNZ"
40 .S DIC("A")="Secondary Ordering ICD-9 Diagnosis: "
41 .S DIC("B")="" I $D(RABWDX(I11+1)) S DIC("B")=$P(^ICD9(+RABWDX(I11+1),0),U)
42 .I $D(RABCOPY(2)) S DIC("B")=$P(RABCOPY(2),U) K RABCOPY
43 .S DIC("S")="I $P($$ICDDX^ICDCODE(Y,DT),U,10)" D ^DIC
44 .; delete node RABWDX() if its secondary ICD9 was @-deleted
45 .I X="@" K RABWDX(I11+1)
46 .I +Y<1 S RAQUIT=1 Q ; No More Secondary ICD Dx to Enter.
47 .S RADUP=0 D DUPDX
48 .I RADUP W !?5,"* Cannot Enter Duplicate ICD-9 Diagnosis *" S I11=I11-1 Q
49 .S RACNT=RACNT+1,$P(RABWDX(RACNT),U,1)=+Y D BAQUES
50 K ^TMP("RACOPY",$J)
51 Q ; Quit back to RAORD1 routine.
52 ;
53BAQUES ; Ask the SC/EI/MST/HNC questions associated to each ICD Dx.
54 N RASEQ,RASEQ1,RASEQ2,RAI0,RASDCLY,RAQUES,RADEFLT,RAEXHELP
55 S RASDCLY=""
56 D CL^SDCO21(RADFN,RASDDT,"",.RASDCLY)
57 ; Current Question Sequence is: SC, CV, AO, IR, EC, MST, HNC
58 S RASEQ="3,7,1,2,4,5,6" ; Same Question Sequence as in $$SEQ^SDCO21
59 F RAI0=1:1:$L(RASEQ,",") Q:$G(RAQUIT) S RASEQ1=+$P(RASEQ,",",RAI0) I $D(RASDCLY(RASEQ1)) D
60 .S RAQUES="Was treatment related to "_$P($G(^SD(409.41,RASEQ1,0)),U,6)
61 .I RASEQ1=3 S RAQUES="Was treatment for a SC Condition"
62 .S RAEXHELP=$S(RASEQ1=3:"D DIS^DGRPDB",1:"")
63 .S RASEQ2=$S(RASEQ1=3:2,RASEQ1=1:3,RASEQ1=2:4,1:RASEQ1+1)
64 .S RADEFLT=$S($P(RABWDX(RACNT),U,RASEQ2)=1:"Yes",$P(RABWDX(RACNT),U,RASEQ2)=0:"NO",1:"")
65 .I RADEFLT=""&($D(^TMP("RACOPY",$J))) D
66 ..I $P(^TMP("RACOPY",$J,"BA"),U,1)=$P(RABWDX(RACNT),U,1) S RADEFLT=$S($P(^TMP("RACOPY",$J,"BA"),U,RASEQ2)=1:"Yes",$P(^TMP("RACOPY",$J,"BA"),U,RASEQ2)=0:"No",1:"")
67 ..I $D(^TMP("RACOPY",$J,"BA",$P(RABWDX(RACNT),U,1))) S RADEFLT=$S($P(^TMP("RACOPY",$J,"BA",$P(RABWDX(RACNT),U,1)),U,RASEQ2)=1:"Yes",$P(^TMP("RACOPY",$J,"BA",$P(RABWDX(RACNT),U,1)),U,RASEQ2)=0:"No",1:"")
68 .S $P(RABWDX(RACNT),U,RASEQ2)=$S($P(RABWDX(RACNT),U,1)>0:$$ASKYN(RAQUES,RADEFLT,RAEXHELP),1:0)
69 Q
70 ;
71ASKYN(RAQUES,RADEFLT,RAEXHELP) ; Ask Yes/No Questions
72 N DIR,DIRUT,DUOUT,DTOUT
73 I $G(RAEXHELP)'="" S DIR("??")="^"_RAEXHELP
74 S DIR("A")=" "_RAQUES,DIR(0)="YO"
75 S DIR("B")=RADEFLT D ^DIR
76 S:Y="^" RAQUIT=1
77 I $D(DIRUT)!($D(DTOUT))!($D(DUOUT)) S Y="" ; user typed @ , ^ , or timed out
78 Q Y
79 ;
80DUPDX ; Check If A Duplicate ICD Dx Has Been Entered.
81 N I
82 F I=1:1 Q:'$D(RABWDX(I)) I (I11+1)'=I,+Y=+RABWDX(I) S RADUP=1 Q
83 Q
84 ;
85PROV() ; Validate for Provider Key, Active, and non-Terminated statuses.
86 ; Original DIC("S") for Requesting Provider.
87 ; Y = ien file #200
88 S RACRE=0 ; 1 = person is Active and Credentialed; 0 = otherwise
89 ; Check PROVIDER KEY
90 I $$ACTIVE^XUSER(Y),$D(^XUSEC("PROVIDER",Y)) S RACRE=1
91 Q RACRE
92 ;
93FILEDX(RADFN,RAO) ; Store SC/EI Fields in Order file #75.1
94 ; Called from RAORD1 routine.
95 I '$D(RABWDX) G PFSS
96 N RA1,RA11,RA2,RAFDA,RAIEN,RAMSG
97 S RAFDA(75.1,RAO_",",91)=+RABWDX(1) ; Primary Ordering ICD Dx pointer.
98 F RA1=2:1:8 D
99 .S RA11=$S(RA1=8:9,1:RA1) ;Skip a field # for CV
100 .S RAFDA(75.1,RAO_",",(90+RA11))=$P(RABWDX(1),U,RA1)
101 D FILE^DIE("K","RAFDA","RAMSG") K RAFDA,RAMSG
102 S RA1=1
103 F S RA1=$O(RABWDX(RA1)) Q:RA1="" D
104 .S RAFDA(75.13,"?+2,"_RAO_",",.01)=+RABWDX(RA1)
105 .F RA2=2:1:8 D
106 ..S RAFDA(75.13,"?+2,"_RAO_",",RA2)=$P(RABWDX(RA1),U,RA2)
107 .D UPDATE^DIE("","RAFDA","RAIEN","RAMSG") K RAFDA,RAIEN,RAMSG
108 .Q
109PFSS ; RAO is the IEN of file #75.1
110 ; we need to make this call before testing for RABWDX because the GETACCT
111 ; must be done regardless of presence of the RABWDX array
112 I '$D(RACPRS) D FB^RABWIBB(RAO) ; Requirement 1
113 Q
Note: See TracBrowser for help on using the repository browser.