source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWPFSS4.m@ 1195

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1ORWPFSS4 ;SLC-GDU CPRS HL7 PROCESSING FOR RAD PRE-CERT;[08/29/05];
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**228**;Dec 17, 1997
3 ;Determine if the order is to have an PFSS Account Reference
4 ;associated with it. This is for orders that are not event delayed
5 ;
6 ;DBIA References for external calls
7 ; $$GETS^DIQ - DBIA 2056
8 ; $$GETS1^DIQ - DBIA 2056
9 ; $$PKGTYP^ORWPFSS - Internal to CPRS PFSS
10 ; PFSSACTV^ORWPFSS - Internal to CPRS PFSS
11 ; $$ACCTREF^ORWPFSS1 - Internal to CPRS PFSS
12 ; $$GETARN^SDPFSS2 - DBIA 4668
13 ; INP^VADPT - DBIA 10061
14 ; ^VSIT - DBIA 1900-A
15 ;
16EN(ORIEN) ;Primary entry point of this routine
17 ;Input Variable
18 ; ORIEN The Order Internal Entry Number
19 ;Local Variables
20 ; ORAR Order Account Reference (PFSS AR)
21 ; ORDFN Order Patient's DFN (IEN)
22 ; ORPFSS Order PFSS Active Indicator
23 ; ORUPDT Order Update Indicator from record update
24 ; ORVS Order Visit String
25 ;
26 N ORAR,ORDFN,ORPFSS,ORUPDT,ORVS,X,Y
27 S (ORAR,ORPFSS)=""
28 ;If PFSS is inactive goto exit
29 D PFSSACTV^ORWPFSS(.ORPFSS) I ORPFSS=0 G EXIT
30 ;If Order already has PFSS Account Reference goto exit
31 S ORAR=$$GET1^DIQ(100,ORIEN,97) I ORAR'="" G EXIT
32 ;If Order package is not one of the currently supported goto exit
33 I $$PKGTYP^ORWPFSS(ORIEN)=0 G EXIT
34 ;If Visit String not found goto EXIT.
35 S ORVS=$$GETVS(ORIEN) I ORVS="" G EXIT
36 ;Get Patient's DFN from the Order
37 S ORDFN=+$$GET1^DIQ(100,ORIEN,.02,"I")
38 ;If Historical set PFSS Account Reference to null and goto Save
39 I $P(ORVS,";",3)="E" S ORAR="" G SAVE
40 ;If Scheduled Appointment get PFSS Account Reference and goto Save
41 I $P(ORVS,";",3)="A" S ORAR=$$SAAR(ORVS,ORDFN) I ORAR'="" G SAVE
42 ;If Hospital Admission get PFSS Account Reference and goto Save
43 I $P(ORVS,";",3)="H" S ORAR=$$HAAR(ORDFN) I ORAR'="" G SAVE
44 ;Check PCE for PFSS Account Reference
45 S ORAR=$$PCEAR(ORVS,ORDFN)
46SAVE ;Save PFSS Account Reference or null value to the Order record
47 S ORUPDT=$$ACCTREF^ORWPFSS1(ORIEN,ORAR)
48EXIT ;Exit point for this routine
49 Q
50GETVS(X1) ;Get Order Visit String
51 ;Get the data from the Order's Responses multi-valued field.
52 ;Look for Prompt text of OR GTX VISITSTR
53 ;If Prompt text found get the Visit String
54 ;If Prompt text not found return a null value
55 ;Input variable required, if missing this will return a null value
56 ;Input Variable for this function
57 ; X1 The Order IEN
58 ;Return Variable for this function
59 ; VS The Order Visit String
60 ;Local Variable for this function
61 ; IENS Index variable for REC array
62 ; PT Prompt Text being searched for
63 ; REC Output variable for GETS^DIQ that will contain the Order
64 ; Responses data.
65 N IENS,PT,REC,VS
66 I X1="" S VS="" Q VS
67 S (IENS,VS)=""
68 S PT=$P($T(VSPT),";",3)
69 D GETS^DIQ(100,X1,"4.5*","E","REC")
70 F S IENS=$O(REC(100.045,IENS)) Q:IENS="" D
71 . I $G(REC(100.045,IENS,.02,"E"))=PT S VS=$G(REC(100.045,IENS,1,"E"))
72 Q VS
73VSPT ;Visit String Prompt Text;OR GTX VISITSTR
74 ;
75SAAR(X1,X2) ;Scheduled Appointment Account Reference for PFSS
76 ;Get the PFSS Account Reference for scheduled appointments
77 ;All inputs required, any missing this will return a null value
78 ;Input Variables
79 ; X1 The Visit String from the Order
80 ; X2 The Patient's IEN
81 ;Output Variable
82 ; AR PFSS Account Reference returned by $$GETARN^SDPFSS2
83 ; Set to null in any input is missing
84 ;
85 N AR
86 I X1=""!(X2="") S AR="" Q AR
87 ;Get the PFSS Account Reference from Scheduling
88 S AR=+$$GETARN^SDPFSS2($P(X1,";",2),X2,$P(X1,";"))
89 I AR>0 Q AR ;If found return Account Reference
90 S AR="" Q AR ;If not found return null for Account Reference
91 ;
92HAAR(X1) ;Hospital Admission Account Reference for PFSS
93 ;Returns the PFSS Account Reference for the Hospital Admission
94 ;Input is required. If missing null value returned.
95 ;Returns PFSS Account Reference returned if found.
96 ;Returns null if PFSS Account Reference not found null.
97 ;Input Variable for this function
98 ; X1 The Patient's DFN
99 ;Output Variables for this function
100 ; ER Set to null and returned if missing input
101 ; VAIN("NR") The node of VAIN that contains the PFSS Account Reference
102 ;Internal Variables for this function
103 ; DFN VADPT input variable, Patient's record number
104 ; VAHOW VADPT input variable, sends output to array variable VAIN
105 ; VAIN Output array variable with results of INP^VAIN
106 ;
107 N ER,DFN,VAHOW,VAIN
108 I X1="" S ER="" Q ER
109 S DFN=X1
110 S VAHOW=1
111 D INP^VADPT
112 Q $G(VAIN("NR"))
113 ;
114PCEAR(X1,X2) ;PCE Account Reference for PFSS
115 ;Returns the PFSS Account Reference from PCE
116 ;All input required, if any missing this will a null.
117 ;Returns PFSS Account Reference returned if found.
118 ;Returns null if PFSS Account Reference not found null.
119 ;Input Variable for this function
120 ; X1 The Visit String from the Order
121 ; X2 The Patient's IEN
122 ; VSIT The input and output array variable for ^VSIT
123 ;Output Variables for this function
124 ; ER Set to null and returned if missing input
125 ; VSIT("ACT") The node of array variable VSIT that contains
126 ; the PFSS Account Reference returned by ^VSIT
127 ;Local Variable for this function
128 ; VSIT The input and output array variable for ^VSIT
129 ;
130 N ER,VSIT
131 I X1=""!(X2="") S ER="" Q ER
132 S VSIT(0)="D0EM"
133 S VSIT("VDT")=$P(X1,";",2)
134 S VSIT("LOC")=$P(X1,";")
135 S VSIT("PKG")="OR"
136 S VSIT("PAT")=X2
137 D ^VSIT
138 I $G(VSIT("IEN"))<0 S ER="" Q ER
139 Q $G(VSIT("ACT"))
Note: See TracBrowser for help on using the repository browser.