source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMA304.m@ 1259

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1SDAMA304 ;BPOIFO/ACS-Filter API Apply Filters ; 6/21/05 1:50pm
2 ;;5.3;Scheduling;**301,347,508**;13 Aug 1993
3 ;PER VHA DIRECTIVE 2004-038, DO NOT MODIFY THIS ROUTINE
4 ;
5 ;*****************************************************************
6 ; CHANGE LOG
7 ;
8 ; DATE PATCH DESCRIPTION
9 ;-------- ---------- -----------------------------------------
10 ;12/04/03 SD*5.3*301 ROUTINE COMPLETED
11 ;08/06/04 SD*5.3*347 ADDITION OF A NEW FILTER - DATE APPOINTMENT
12 ; MADE (FIELD #16) AND 2 NEW FIELDS TO RETURN:
13 ; 1) AUTO-REBOOKED APPT DATE/TIME (FIELD #24)
14 ; 2) NO-SHOW/CANCEL APPT DATE/TIME (FIELD #25)
15 ;02/22/07 SD*5.3*508 SEE SDAMA301 FOR CHANGE LIST
16 ;*****************************************************************
17 ;
18 ;*****************************************************************
19 ;
20 ; APPLY FILTERS (Extrinsic call)
21 ;
22 ;INPUT
23 ; SDFTYPE Filter Type (P-patient or C-clinic)
24 ; SDARRAY Appointment Filter array
25 ; SDFLTR Filter Flags array
26 ; SDDV Appointment Data Values array
27 ;
28 ;OUTPUT
29 ; SDMATCH -1 if no match
30 ; 1 if match
31 ;*****************************************************************
32MATCH(SDFTYPE,SDARRAY,SDFLTR,SDDV) ;
33 N SDMATCH,SDX,SDCLIEN
34 S SDMATCH=0
35 ;apply patient or clinic filters
36 I SDFTYPE="P" D PMATCH(.SDARRAY,.SDMATCH)
37 I SDFTYPE="C" D CMATCH(.SDARRAY,.SDMATCH)
38 Q SDMATCH
39PMATCH(SDARRAY,SDMATCH) ;Apply ^DPT-related filters
40 S SDMATCH=1
41 ;Clinic
42 I SDFLTR(2) D
43 . S SDDV(2)=$P($G(SDARRAY("DPT0")),"^",1)
44 . I SDDV(2)']"" S SDMATCH=0 Q
45 . ;apply filter to list or global
46 . I SDARRAY("CLNGBL")=1 D
47 .. S SDX=SDARRAY(2),SDCLIEN=SDDV(2)
48 .. I '$D(@(SDX_"SDCLIEN)")) S SDMATCH=0
49 . I SDARRAY("CLNGBL")=0 D
50 .. I ((";"_$G(SDARRAY(2))_";")'[(";"_SDDV(2)_";")) S SDMATCH=0
51 Q:'SDMATCH
52 ;Appointment Status
53 I SDFLTR(3) D
54 . N SDSTAT,SDTEMP
55 . S SDTEMP=$P($G(SDARRAY("DPT0")),"^",2)
56 . S SDSTAT=$S($G(SDTEMP)="":"R",SDTEMP="I":"I",SDTEMP="C":"CC",1:"X")
57 . I SDSTAT="X" S SDSTAT=$S(SDTEMP="CA":"CCR",SDTEMP="PC":"CP",1:"X")
58 . I SDSTAT="X" S SDSTAT=$S(SDTEMP="PCA":"CPR",SDTEMP="N":"NS",1:"X")
59 . I SDSTAT="X" S SDSTAT=$S(SDTEMP="NA":"NSR",SDTEMP="NT":"NT",1:"X")
60 . S SDDV(3)=SDSTAT
61 . I ((";"_$G(SDARRAY(3))_";")'[(";"_SDDV(3)_";")) S SDMATCH=0
62 Q:'SDMATCH
63 ;Encounter Exists (DEPRECATED 11/10/06 JFW)
64 ;I SDFLTR(12) D
65 ;.;get appointment encounter information
66 ;.S SDDV(12)=$P($G(SDARRAY("DPT0")),"^",20)
67 ;.;compare encounter information to filter value
68 ;.; Y AND NULL match or N and NOT NULL match
69 ;.I (((SDARRAY("ENCTR")["Y")&(SDDV(12)']""))!((SDARRAY("ENCTR")["N")&(SDDV(12)]""))) D
70 ;..S SDMATCH=0
71 ;Date Appointment Made
72 I SDFLTR(16) D
73 .;get date appointment made from specific appt
74 .S SDDV(16)=$P($G(SDARRAY("DPT0")),"^",19)
75 .;compare date with range of dates specified
76 .I $S(+SDDV(16)=SDARRAY("DAMFR"):0,+SDDV(16)=SDARRAY("DAMTO"):0,1:1) D
77 ..I ((+SDDV(16)'>SDARRAY("DAMFR"))!(+SDDV(16)'<SDARRAY("DAMTO"))) D
78 ...S SDMATCH=0
79 Q
80 ;
81CMATCH(SDARRAY,SDMATCH) ;Apply ^SC-related filters
82 N SDAMCLIN,SDSTOP
83 S SDMATCH=1
84 ;Primary Stop Code
85 I SDFLTR(13) D
86 . S SDAMCLIN=+$G(SDARRAY("DPT0"))
87 . I $G(SDAMCLIN)="" S SDMATCH=0 Q
88 . S SDSTOP=$P($G(^SC(SDAMCLIN,0)),"^",7)
89 . I $G(SDSTOP)="" S SDMATCH=0 Q
90 . S SDDV(13)=$P($G(^DIC(40.7,SDSTOP,0)),"^",2)
91 . I $G(SDDV(13))="" S SDMATCH=0 Q
92 . I ((";"_$G(SDARRAY(13))_";")'[(";"_SDDV(13)_";")) S SDMATCH=0
93 Q
Note: See TracBrowser for help on using the repository browser.