1 | SDRPA20 ;BPOI/ESW - Determine Admission Type for PAIT ;
|
---|
2 | ;;5.3;Scheduling;**446**;Aug 13, 1993;Build 77
|
---|
3 | ;
|
---|
4 | ; This routine returns element Admission Type for appointment sent
|
---|
5 | ; with PAIT - see TABLE SD009 - Purpose of Visit & Appointment Type
|
---|
6 | ; SEQUENCE PV1.4. The same table is used with ACRP HL7 transmission.
|
---|
7 | ;
|
---|
8 | ;
|
---|
9 | POV(DFN,SDATE,CLINIC,CRDATE) ; - Determine Purpose of Visit for encounter
|
---|
10 | ;
|
---|
11 | ; Input: DFN = Patient IEN
|
---|
12 | ; SDATE = Appointment Date/Time
|
---|
13 | ; CLINIC = Clinic
|
---|
14 | ; CRDATE = Creation date
|
---|
15 | ;
|
---|
16 | ; Identified from the Outpatient Encounter of the Appointment
|
---|
17 | ; subfile (# 2.98)
|
---|
18 | ;
|
---|
19 | ; APTYP = Appointment Type
|
---|
20 | ;
|
---|
21 | ; Output: Purpose of Visit value (combination of Purpose of Visit
|
---|
22 | ; and Appointment Type)
|
---|
23 | ;
|
---|
24 | ;
|
---|
25 | N SDARRAY,SCDXPOV,SDAPPT,POV,APTYP,SDENC
|
---|
26 | S SDARRAY(1)=SDATE_";"_SDATE
|
---|
27 | S SDARRAY(4)=DFN
|
---|
28 | S SDARRAY("FLDS")="2;10;12;16;18"
|
---|
29 | ; fields: 2- clinic
|
---|
30 | ; 10- appointment type
|
---|
31 | ; 12- outpatient encounter
|
---|
32 | ; 16 - date appt made
|
---|
33 | N SDCOUNT S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY)
|
---|
34 | I '$D(^TMP($J,"SDAMA301",DFN,CLINIC,SDATE)) Q $G(SCDXPOV)
|
---|
35 | S SDAPPT=^TMP($J,"SDAMA301",DFN,CLINIC,SDATE)
|
---|
36 | N SDCRC S SDCRC=+$P(SDAPPT,U,16) I SDCRC'=CRDATE Q $G(SCDXPOV)
|
---|
37 | N POV,SCDXPOV
|
---|
38 | S POV=+$P(SDAPPT,U,18),POV=$S($L(POV)=1:"0"_POV,1:POV)
|
---|
39 | S APTYP=+$P(SDAPPT,U,10) S SDENC=+$P(SDAPPT,U,12) I +SDENC>0 D I 'APTYP Q $G(SCDXPOV)
|
---|
40 | .S APTYP=$P($G(^SCE(SDENC,0)),U,10)
|
---|
41 | S APTYP=$S($L(APTYP)=1:"0"_APTYP,1:APTYP)
|
---|
42 | S SCDXPOV=POV_APTYP
|
---|
43 | POVQ Q $G(SCDXPOV)
|
---|
44 | ;
|
---|