source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBAPDX.m@ 1683

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1IBAPDX ;ALB/CPM - EXTRACT MEANS TEST BILLING DATA FOR PDX ; 09-APR-93
2 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5EXTR(TRAN,DFN,ARR) ; PDX Entry Point for the data extraction.
6 ; Input: TRAN -- Pointer to transaction in file #394.61
7 ; DFN -- Pointer to the patient in file #2
8 ; ARR -- Root for the output extract array
9 ; Output: 0 -- Extraction was successful, or
10 ; -1^err -- if an error was encountered during the extract.
11 ;
12 ; NOTES : If TRAN is passed
13 ; The patient pointer of the transaction will be used
14 ; Encryption will be based on the transaction
15 ; If DFN is passed
16 ; Encryption will be based on the site parameter
17 ; : Pointer to transaction takes presidence over DFN ... if
18 ; TRAN>0 the DFN will be based on the transaction
19 ;
20 S TRAN=+$G(TRAN)
21 S DFN=+$G(DFN)
22 Q:(('TRAN)&('DFN)) "-1^Did not pass pointer to transaction or patient"
23 I (TRAN) Q:('$D(^VAT(394.61,TRAN))) "-1^Did not pass valid pointer to VAQ - TRANSACTION file"
24 I (TRAN) S DFN=+$P($G(^VAT(394.61,TRAN,0)),"^",3) Q:('DFN) "-1^Transaction did not contain pointer to PATIENT file"
25 Q:('$D(^DPT(DFN))) "-1^Did not pass valid pointer to PATIENT file"
26 ;
27 N C,ERR,KEY1,KEY2,IBARR,IBATYP,IBCRYP,IBD,IBDF,IBEFDT,IBENC,IBI,IBID,IBN,IBND,IBREF,IBSEQ,STRING,Y,IBENCPT,IBSNDR,IBSTR S ERR=0
28 I $G(ARR)="" S ERR="-1^Did not pass root for the output array." G EXTRQ
29 ;
30 ; - set variables for encryption
31 D ENCR^IBAPDX0 G:ERR<0 EXTRQ
32 ;
33 ; - get Continuous Patient data
34 S IBSTR=$G(^IBE(351.1,+$O(^IBE(351.1,"B",DFN,0)),0)) I 'IBSTR S @ARR@("VALUE",351.1,.01,0)="",@ARR@("ID",351.1,.01,0)="" G CLOCK
35 S (IBENC,STRING)=$P($$PT^IBEFUNC(+IBSTR),"^") X:$$NCRPFLD^VAQUTL2(2,.01) IBCRYP
36 S (IBID,@ARR@("VALUE",351.1,.01,0),@ARR@("ID",351.1,.01,0))=IBENC
37 S (IBENC,STRING)=$$DAT1^IBOUTL($P(IBSTR,"^",2)) X:$$NCRPFLD^VAQUTL2(351.1,.02) IBCRYP
38 S @ARR@("VALUE",351.1,.02,0)=IBENC,@ARR@("ID",351.1,.02,0)=IBID
39 ;
40CLOCK ; - get active billing clock data
41 S IBSTR=$G(^IBE(351,+$O(^IBE(351,"ACT",DFN,0)),0)) I 'IBSTR S @ARR@("VALUE",351,.01,0)="",@ARR@("ID",351,.01,0)="" G EXTRQ
42 I '$D(IBID) S (IBENC,STRING)=$P($$PT^IBEFUNC(+$P(IBSTR,"^",2)),"^") X:$$NCRPFLD^VAQUTL2(2,.01) IBCRYP S IBID=IBENC
43 S IBEFDT=$P(IBSTR,"^",3),(IBENC,STRING)=+IBSTR X:$$NCRPFLD^VAQUTL2(351,.01) IBCRYP
44 S (IBREF,@ARR@("VALUE",351,.01,0))=IBENC,@ARR@("ID",351,.01,0)=IBID
45 S (IBENC,STRING)=$$DAT1^IBOUTL(IBEFDT) X:$$NCRPFLD^VAQUTL2(351,.03) IBCRYP
46 S @ARR@("VALUE",351,.03,0)=IBENC,@ARR@("ID",351,.03,0)=IBREF
47 F IBI=5:1:9 D
48 .S (IBENC,STRING)=+$P(IBSTR,"^",IBI) X:$$NCRPFLD^VAQUTL2(351,".0"_IBI) IBCRYP
49 .S @ARR@("VALUE",351,".0"_IBI,0)=IBENC,@ARR@("ID",351,".0"_IBI,0)=IBREF
50 ;
51 ; - get all charges billed within the active clock period
52 S IBD="" F S IBD=$O(^IB("AFDT",DFN,IBD)) Q:'IBD D
53 .S IBDF=0 F S IBDF=$O(^IB("AFDT",DFN,IBD,IBDF)) Q:'IBDF D
54 ..S IBN=0 F S IBN=$O(^IB("AF",IBDF,IBN)) Q:'IBN D
55 ...S IBND=$G(^IB(IBN,0)) Q:'IBND
56 ...Q:$P(IBND,"^",8)["ADMISSION"
57 ...I $P(IBND,"^",15)'<IBEFDT S IBARR(+$P(IBND,"^",14),IBN)=""
58 ;
59 ; - set all billed charges into the extract array
60 I '$D(IBARR) S @ARR@("VALUE",350,.01,0)="",@ARR@("ID",350,.01,0)="" G EXTRQ
61 D CHG^IBAPDX0
62 ;
63EXTRQ Q ERR
Note: See TracBrowser for help on using the repository browser.