source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBTRE3.m@ 1742

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1IBTRE3 ;ALB/AAS - CLAIMS TRACKING EDIT DIAGNOSIS ;1-SEP-93
2 ;;2.0;INTEGRATED BILLING;**10,60,210,266**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5% G ^IBTRE
6 ;
7EN(IBTRN) ; -- entry point for protocols
8 ; must do own rebuild actions
9 ; -- Input - point to 356
10 ;
11 N IBETYP,IBTRND,IBXY,IBCNT,IBDGPM
12 D FULL^VALM1
13 S VALMBCK=""
14 S IBTRND=$G(^IBT(356,+IBTRN,0)),IBDGPM=$P(IBTRND,"^",5)
15 ;
16 S IBETYP=$$TRTP^IBTRE1(IBTRN)
17 I IBETYP>2 W !!,"Clinical Information comes from the parent package." D PAUSE^VALM1 G ENQ
18 ;
19 ; -- outpatient diagnosis
20 I IBETYP=2 D G ENQ
21 .I $P(IBTRND,"^",4) D ASK^IBTUTL4(IBTRN,2)
22 .I '$P(IBTRND,"^",4) W !!,"Can not add diagnosis to outpatient visits prior to Check-out.",! D PAUSE^VALM1
23 .S VALMBCK="R"
24 ;
25 ; -- Inpatient diagnosis
26 I IBETYP=1 D
27 .Q:'IBDGPM
28 .;
29 .; -- ask admitting diagnosis if not already there
30 .I '$O(^IBT(356.9,"ADG",+IBDGPM,0)) D ADIAG(IBTRN,IBETYP)
31 .I $G(IBSEL)="^" Q
32 .;
33 .; -- edit other diagnosis
34 .D DIAG(IBTRN,IBETYP)
35 .S VALMBCK="R"
36 ;
37ENQ ;
38 Q
39ADIAG(IBTRN,IBETYP) ; -- add admitting diagnosis
40 ;
41 N IBADG,DA,DR,DIC,DIE,DD,DO,IOINHI,IOINORM,IBDATE
42 S IBADG=""
43 ;
44 S IBDATE=$$TRNDATE^IBACSV(IBTRN) ; Service date for CSV
45 ;
46 ;S IBDGPM=$P(^IBT(356,+IBTRN,0),"^",5)
47 I IBETYP'=1!('IBDGPM) W !!,"You can only enter an admitting diagnosis for an admission",! D PAUSE^VALM1 G ADGQ
48 ;
49 S X="IOINHI;IOINORM" D ENDR^%ZISS
50 S IBADG=$O(^IBT(356.9,"ADG",IBDGPM,0)) I IBADG S IBDA=$O(^IBT(356.9,"ADG",IBDGPM,IBADG,0))
51 W !!,"--- ",IOINHI,"Admitting Diagnosis",IOINORM," --- "
52 I 'IBADG W "Unspecified"
53 E D
54 . N IBDX
55 . S IBDX=$$ICD9^IBACSV(+IBADG,IBDATE)
56 . W $P(IBDX,U)_" -"_$P(IBDX,U,3)
57 I +IBADG D EDT(IBDA,".01;") W !
58 I '$O(^IBT(356.9,"ADG",+IBDGPM,0)) D ADD(IBTRN,3)
59 ;
60 W !
61ADGQ Q
62 ;
63DIAG(IBTRN,IBETYP) ; -- add/edit diagnosis
64 Q:'IBTRN
65 I $G(IBETYP)'=1 Q
66 N DA,DR,DIC,DIE
67 S IBDGPM=$P(^IBT(356,+IBTRN,0),"^",5)
68 I IBETYP'=1!('IBDGPM) W !!,"You can only enter a diagnosis for an admission",! D PAUSE^VALM1 G ADGQ
69 ;
70 S X="IOINHI;IOINORM" D ENDR^%ZISS
71 W !!,"--- ",IOINHI,"Diagnosis",IOINORM," --- "
72 S IBSEL="Add"
73 D SET(IBTRN) I $D(IBXY) D LIST(.IBXY) S IBSEL=$$ASK^IBTRE4(IBCNT,"A")
74 I IBSEL["^"!(IBSEL["Return") S:IBSEL["^" IBQUIT=1 G DIAGQ
75 I IBSEL="Add" D ADD(IBTRN)
76 D:IBSEL EDT(+$G(IBXY(+IBSEL)),".01;.03;.04")
77DIAGQ Q
78 ;
79ADD(IBTRN,TYPE) ; -- Add a new diagnosis
80 ;
81 N DTOUT,DUOUT,X,Y,DIC,IBDATE,ICDVDT
82 S IBCNT=0
83 ;Service date (for CSV)
84 S IBDATE=$$TRNDATE^IBACSV(IBTRN) S:'IBDATE IBDATE=DT
85 S ICDVDT=IBDATE ; for DD ID (versioned text)
86 ;
87 I '$G(TYPE) S TYPE=""
88NXT S DIC("A")=$S(TYPE=3:"Admitting Diagnosis: ",IBCNT<1:"Select Diagnosis: ",1:"Next Diagnosis: ")
89 ;All DX codes are visible - no screen ;S DIC("S")="I '$P(^(0),U,9)"
90 S DIC="^ICD9(",DIC(0)="AEMQ",X=""
91 W:$G(IBCNT) ! D ^DIC K DIC G ADDQ:Y<0
92 I Y,'$$ICD9ACT^IBACSV(+Y,IBDATE) W !!,*7,$P(Y,U,2)," is not active for the service date ("_$$DAT3^IBOUTL(IBDATE),").",! G NXT
93 I $D(^IBT(356.9,"ADGPM",$$DGPM(IBTRN),+Y)) W !!,*7,$P(Y,"^",2)," is already a diagnosis.",! G NXT
94 S IBCNT=IBCNT+1
95 S IBADG=$$NEW(+Y,IBTRN,TYPE)
96 I IBADG,TYPE'=3 D EDT(IBADG) G NXT
97ADDQ I $D(DTOUT)!($D(DUOUT)) S IBSEL="^"
98 Q
99 ;
100DGPM(IBTRN) ; -- return admission pointer
101 Q $P(^IBT(356,+IBTRN,0),"^",5)
102 ;
103 ;
104NEW(ICDI,IBTRN,TYPE) ; -- file new entry
105 ;
106 N DA,DD,DO,DIC,DIK,DINUM,DLAYGO,X,Y,I,J
107 S X=ICDI,(DIC,DIK)="^IBT(356.9,",DIC(0)="L",DLAYGO=356.9
108 D FILE^DICN S IBADG=+Y
109 I IBADG>0 L +^IBT(356.9,IBADG) S $P(^IBT(356.9,IBADG,0),"^",2,4)=$$DGPM(IBTRN)_"^"_$P($P(^IBT(356,IBTRN,0),"^",6),".")_"^"_$G(TYPE),DA=IBADG D IX1^DIK L -^IBT(356.9,IBADG)
110NEWQ Q IBADG
111 ;
112EDT(IBADG,IBDR) ; -- edit entry
113 ;
114 N DR,DIE,DA,DIDEL
115 S DR=$G(IBDR),DIDEL=356.9 I DR="" S DR=".03;.04"
116 S DA=IBADG,DIE="^IBT(356.9,"
117 Q:'$G(^IBT(356.9,DA,0))
118 L +^IBT(356.9,+IBADG):5 I '$T D LOCKED^IBTRCD1 G EDTQ
119 D ^DIE
120 L -^IBT(356.9,+IBADG)
121EDTQ Q
122 ;
123SET(IBTRN) ; -- set array
124 N IBDGPM,IBICD,IBDA
125 S IBDGPM=$$DGPM(IBTRN)
126 S (IBICD,IBCNT)=0
127 F S IBICD=$O(^IBT(356.9,"ADGPM",IBDGPM,IBICD)) Q:'IBICD S IBDA=0 F S IBDA=$O(^IBT(356.9,"ADGPM",IBDGPM,IBICD,IBDA)) Q:'IBDA D
128 .Q:'$D(^IBT(356.9,+IBDA,0))
129 .S IBCNT=IBCNT+1
130 .S IBXY(IBCNT)=IBDA_"^"_IBICD
131SETQ Q
132 ;
133LIST(IBXY) ;List Diagnosis Array
134 ; Input -- IBXY Diagnosis Array Subscripted by a Number
135 ; Output -- List Diagnosis Array
136 N I,IBXD,IBDATE
137 W !
138 S I=0 F S I=$O(IBXY(I)) Q:'I D
139 . S IBTNOD=$G(^IBT(356.9,+IBXY(I),0))
140 . S IBDATE=$P($P(IBTNOD,U,3),".")
141 . S IBXD=$$ICD9^IBACSV(+$P(IBXY(I),U,2),IBDATE)
142 . W !?2,I," ",$P(IBXD,U),?15,$E($P(IBXD,U,3),1,30),?48,$$DAT1^IBOUTL(IBDATE),?60,$$EXPAND^IBTRE(356.9,.04,$P(IBTNOD,U,4))
143 Q
Note: See TracBrowser for help on using the repository browser.