source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPF1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1RMPRPF1 ;HOIFO/TH,DDA - PFSS Account Creation ;8/18/05
2 ;;3.0;PROSTHETICS;**98**;Feb 09, 1996
3 ;
4 ; This routine collects PFSS Account Creation required data elements,
5 ; sends pre-cert or update message to IBB; obtains and stores a PFSS
6 ; Account Reference in file 660.
7 ;
8 ; DBIA #4664 for GETACCT^IBBAPI
9 ; DBIA #1997 for STATCHK^ICPTAPIU
10 Q
11 ;
12EN ; Entry Point
13 S OK=1
14 S RMPRSWDT=$P($$SWSTAT^IBBAPI(),"^",2)
15 ; Quit if Entry Date is before PFSS Switch on date
16 I $P(^RMPR(660,RMPRDA,0),"^")<RMPRSWDT D DELAPH Q
17EN2 ; Entry to be used if Delivery Date is greater than PFSS Switch on date
18 ; Quit if PFSS Charge ID exists
19 I $P(^RMPR(660,RMPRDA,"PFSS"),U,2)'="" D DELAPH Q
20 ; Quit if Historical Data
21 I $P(^RMPR(660,RMPRDA,0),U,13)=13 D DELAPH Q
22 ; Quit if Shipping Charge exists
23 I $P(^RMPR(660,RMPRDA,0),U,17)>0 D DELAPH Q
24 S RMPREVNT="A05" ; Pre-cert
25 ; Check if PFSS Account Ref exists
26 S OK=1
27 I $P(^RMPR(660,RMPRDA,"PFSS"),U,1)'="" D
28 . ; Quit if PSAS HCPCS did not get updated
29 . I $P(^RMPR(660,RMPRDA,1),U,4)=$P(^RMPR(660,RMPRDA,"PFSS"),U,3) D DELAPH S OK=0 Q
30 . S RMPREVNT="A08" ; Update Patient Info
31 I OK D
32 . D GETDATA
33 . D GETACCT
34 . ; If msg was sent successfully, store data and kill x-ref
35 . I RMPRARFN'=0 D
36 . . D STORE
37 . . D DELAPH
38 D EXIT
39 Q
40 ;
41GETDATA ; Get pre-cert data
42 S (RMPRDFN,RMPRARFN,RMPRAPLR)=""
43 S RMPRDFN=$P(^RMPR(660,RMPRDA,0),U,2) ; Patient ID
44 S RMPRAPLR="GETACCT;RMPRPF1"
45 I RMPREVNT="A08",($P(^RMPR(660,RMPRDA,"PFSS"),U,1)'="") D
46 . S RMPRARFN=$P(^RMPR(660,RMPRDA,"PFSS"),U,1) ; Acct Ref
47 ;
48 ; PV1
49 S RMPRPV1(2)="O" ; Patient Class
50 S RMPRSTA=$P(^RMPR(660,RMPRDA,0),U,10)
51 D GETSITE
52 S RMPRPV1(3)=RMPRHLOC ; Patient Location
53 S (RMPRORD,RMPRADDT)=""
54 S RMPRORD=$P($G(^RMPR(660,RMPRDA,10)),U,6)
55 S RMPRPV1(7)=RMPRORD ; Attending Physician
56 S RMPRADDT=$P(^RMPR(660,RMPRDA,0),U,1)
57 S RMPRPV1(44)=RMPRADDT ; Admit Date/Time
58 ;
59 ; PV2
60 S RMPRPV2(8)=RMPRADDT ; Expected Admit Date/Time
61 S RMPREXDT=""
62 S RMPREXDT=$P($G(^RMPR(660,RMPRDA,10)),U,1)
63 S RMPRPV2(46)=$P(RMPREXDT,".",1) ; Patient Status Effective Date
64 ;
65 ; PR1
66 S RMPRHCPC=$P(^RMPR(660,RMPRDA,1),U,4) ; PSAS HCPCS
67 S RMPRHCDT=RMPRADDT ;Event date
68 D PSASHCPC^RMPOPF ;CSV check; return RMPRVHC and RMPRTHC.
69 S RMPRPR1(3)=RMPRVHC ; Procedure code
70 S RMPRPR1(4)=RMPRTHC ; PSAS HCPCS text
71 ; Procedure Functional Type - I:Stock Issue; P:Purchasing
72 S RMPRPR1(6)=$S($P(^RMPR(660,RMPRDA,0),U,13)=11:"I",1:"P")
73 ;
74 ; DG1 AND ZCL
75 D DG1ZCL^RMPRPF2
76 Q
77 ;
78GETSITE ; Get Patient Location
79 ; requires RMPRSTA=file 4 pointer
80 ; return RMPRHLOC= hospital location or NULL if there is none.
81 S RMPRHLOC="",RMPRSIEN=""
82 F S RMPRSIEN=$O(^RMPR(669.9,"C",RMPRSTA,RMPRSIEN)) Q:RMPRSIEN'>0 D
83 .S RMPRHLOC=$P(^RMPR(669.9,RMPRSIEN,"PCE"),U,3)
84 .Q
85 I RMPRHLOC="" D
86 .S RMPRSIEN=0
87 .F S RMPRSIEN=$O(^RMPR(669.9,RMPRSIEN)) Q:(RMPRSIEN'>0)!(+RMPRHLOC) D
88 ..S RMPRHLOC=$P(^RMPR(669.9,RMPRSIEN,"PCE"),U,3)
89 ..Q
90 .Q
91 Q
92 ;
93GETACCT ; Call GETACCT^IBBAPI to send data and get PFSS Account Reference
94 S RMPRARFN=$$GETACCT^IBBAPI(RMPRDFN,RMPRARFN,RMPREVNT,RMPRAPLR,.RMPRPV1,.RMPRPV2,.RMPRPR1,.RMPRDG1,.RMPRZCL,"","")
95 Q
96 ;
97STORE ; Store data
98 S (RMPRQTY,RMPRTC)=""
99 S RMPRQTY=$P(^RMPR(660,RMPRDA,0),U,7) ; QTY
100 S RMPRTC=$P(^RMPR(660,RMPRDA,0),U,16) ; Total Cost
101 ;
102 L +^RMPR(660,RMPRDA)
103 ; Store 100-PFSS Account Reference; 102-latest PSAS HCPCS; 103-latest QTY; 104-latest Total Cost;
104 ; 105-latest Ordering Provider
105 S DIE="^RMPR(660,",DA=RMPRDA
106 S DR="100////^S X=RMPRARFN;102////^S X=RMPRHCPC;"
107 S DR=DR_"103////^S X=RMPRQTY;104////^S X=RMPRTC;105////^S X=RMPRORD"
108 D ^DIE
109 L -^RMPR(660,RMPRDA)
110 K DA,DIE,DR
111 Q
112 ;
113DELAPD ; Delete the "APD" Flag
114 S DIE="^RMPR(660,"
115 S DA=RMPRDA
116 S DR="107///@"
117 D ^DIE
118 K DIE,DA,DR
119 Q
120 ;
121DELAPH ; Delete the "APH" Flag
122 S DIE="^RMPR(660,"
123 S DA=RMPRDA
124 S DR="106///@"
125 D ^DIE
126 K DIE,DA,DR
127 Q
128EXIT ; Exit
129 K OK,RMPREVNT,RMPRARFN,RMPRDFN,RMPRAPLR,RMPRPR1,RMPRSTA
130 K RMPRPV1,RMPRHLOC,RMPRORD,RMPRADDT,RMPRSIEN,RMPRHCPC
131 K RMPRPV2,RMPREXDT,RMPRDG1,RMPRDIAG,RMPRRICP,RMRICPP
132 K RMPRZCL,RMPRNODE,RMPRQTY,RMPRTC,RMPRCPT,RMPRSWDT
133 Q
Note: See TracBrowser for help on using the repository browser.