source: WorldVistAEHR/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMLINS4.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: 3.8 KB
Line 
1IVMLINS4 ;ALB/SEK - IVM INSURANCE UPLOAD ACCEPT - IB CALL ; 17-APR-98
2 ;;2.0;INCOME VERIFICATION MATCH;**14**; 21-OCT-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; This routine is called by IB to update insurance segments sent
6 ; from HEC and stored in the INCOMING SEGMENT multiple of the IVM
7 ; PATIENT file (#301.5). A HL7 message is sent to HEC indicating if
8 ; the data is accepted or rejected (including reason for rejection).
9 ;
10 ; Before this call, IB code allows the user to to review the
11 ; insurance policy from HEC stored in IB's insurance module. When
12 ; the user decides to accept or reject the policy, this routine is
13 ; called. If the policy is rejected, this routine allows the user
14 ; to pick the reason for rejection.
15 ;
16UPDATE(DFN,IVMINSST,IVMID) ;
17 ;
18 ; Input: DFN -- internal entry number of PATIENT file
19 ; IVMINSST -- upload status 1-accepted 0-rejected
20 ; IVMID -- ins. co. name ^ street add[line 1] ^ group #
21 ;
22 ; Output: returns 1 if updated or 0 followed by error if not updated
23 ;
24 N IVM1INSN,IVM2SA1,IVM3GNU,IVMI,IVMIBERR,IVMJ,IVMDA,IVMDAIN,IVMFOUND,IVMREPTR
25 I '$G(DFN)!('$D(^DPT(+DFN,0))) S IVMIBERR="No patient defined" G EXIT
26 I '$D(^IVM(301.5,"B",DFN)) S IVMIBERR="Patient not in IVM PATIENT file" G EXIT
27 ;
28 I $G(IVMINSST)'=0&($G(IVMINSST)'=1) S IVMIBERR="upload status not accepted or rejected" G EXIT
29 ;
30 ; - check id fields
31 S IVM1INSN=$P(IVMID,"^")
32 S IVM2SA1=$P(IVMID,"^",2)
33 S IVM3GNU=$P(IVMID,"^",3)
34 I IVM1INSN']"" S IVMIBERR="no insurance company name from MCCR insurance module" G EXIT
35 I IVM2SA1']"" S IVMIBERR="no street address from MCCR insurance module" G EXIT
36 I IVM3GNU']"" S IVMIBERR="no group number from MCCR insurance module" G EXIT
37 ;
38 S IVMDA=0
39 F S IVMDA=$O(^IVM(301.5,"B",DFN,IVMDA)) Q:'IVMDA D FIND Q:$G(IVMFOUND)
40 G PROCESS
41 ;
42 ; - find ins. record in IVM PATIENT file
43FIND S IVMDAIN=0
44 F S IVMDAIN=$O(^IVM(301.5,IVMDA,"IN",IVMDAIN)) Q:'IVMDAIN D Q:$G(IVMFOUND)
45 .; - record missing
46 .Q:'$D(^IVM(301.5,IVMDA,"IN",IVMDAIN,0))
47 .Q:'$D(^IVM(301.5,IVMDA,"IN",IVMDAIN,"ST"))
48 .;
49 .; - if 2nd piece not null - skip record - insurance record not transferred
50 .Q:$P($G(^IVM(301.5,IVMDA,"IN",IVMDAIN,0)),"^",2)]""
51 .;
52 .; - if 4th piece not null - skip record - already uploaded or rejected
53 .Q:$P($G(^IVM(301.5,IVMDA,"IN",IVMDAIN,0)),"^",4)]""
54 .;
55 .; - check 3 fields in ^IVM(301.5,IVMDA,"IN",IVMDAIN,"ST") if not 3 matches - skip record
56 .Q:$P(^IVM(301.5,IVMDA,"IN",IVMDAIN,"ST"),"^",4)'=IVM1INSN
57 .Q:$P($P(^IVM(301.5,IVMDA,"IN",IVMDAIN,"ST"),"^",5),"~")'=IVM2SA1
58 .Q:$P(^IVM(301.5,IVMDA,"IN",IVMDAIN,"ST"),"^",8)'=IVM3GNU
59 .; - if ins record found
60 .S IVMFOUND=1
61 .Q
62 Q
63 ;
64PROCESS I 'IVMDAIN S IVMIBERR="Insurance data not found in IVM PATIENT file" G EXIT
65 ;
66 N DA,DTOUT,DUOUT,DR,DIE,Y
67 ;
68 ; - if the insurance data is accepted do
69 I IVMINSST D G DEL
70 .;
71 .; - stuff UPLOAD INSURANCE DATA(.04), UPLOADED INSURANCE DATE/TIME(.05)
72 .S DA=IVMDAIN,DA(1)=IVMDA
73 .S DIE="^IVM(301.5,"_DA(1)_",""IN"","
74 .S DR=".04////1;.05///NOW" D ^DIE
75 ;
76 ; - if the insurance data is rejected do
77 ; - ask for reason why
78 ;
79 W !!,"The 'Reject IVM Insurance Policy' action has been selected."
80 ;
81 W !,"Please select a reason for rejecting the IVM insurance information."
82 S DIC="^IVM(301.91,",DIC("A")="Select reason for rejecting: ",DIC(0)="QEAMZ"
83 D ^DIC K DIC I Y<0!($D(DTOUT))!($D(DUOUT)) S IVMIBERR="No reason selected" G EXIT
84 S IVMREPTR=+Y
85 ;
86 ; stuff UPLOAD INSURANCE DATA(.04) and REASON NOT UPLOADING INSURANCE
87 ; (.08)
88 S DA=IVMDAIN,DA(1)=IVMDA
89 S DIE="^IVM(301.5,"_DA(1)_",""IN"","
90 S DR=".04////0;.08////^S X=IVMREPTR" D ^DIE
91 ;
92DEL ; - delete incoming segments strings
93 K ^IVM(301.5,DA(1),"IN",DA,"ST"),^("ST1")
94 ;
95 ; - send HL7 message to IVM Center
96 ;
97 S IVMI=DA(1),IVMJ=DA
98 D HL7^IVMLINS2
99 ;
100EXIT Q $S($D(IVMIBERR):0,1:1)_"^"_$G(IVMIBERR)
Note: See TracBrowser for help on using the repository browser.