source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMA308.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: 4.0 KB
RevLine 
[613]1SDAMA308 ;BPOIFO/JFW-Filter API Appointment Statuses; 5/10/04 8:13am [5/17/04 10:14am]
2 ;;5.3;Scheduling;**301,406**;13 Aug 1993
3 ;
4 ;** GET APPOINTMENT STATUS **
5 ; - Replaces $$STATUS^SDAM1 -
6 ;*****************************************************************
7 ; CHANGE LOG
8 ;
9 ; DATE PATCH DESCRIPTION
10 ;-------- ---------- -----------------------------------------
11 ;12/04/03 SD*5.3*301 ROUTINE COMPLETED
12 ;10/11/06 SD*5.3*406 PRINT STATUS TEXT UPDATED
13 ;
14 ;*****************************************************************
15 ;
16STATUS(DFN,SDT,SDCL,SDSTS,SDCHKIN,SDCHKOUT,SDEIFN) ;Retrieve Appointment Status
17 ;
18 ; Input: DFN := IFN of Patient
19 ; SDT := Appointment Date/Time (FM Format)
20 ; SDCL := IFN of Clinic
21 ; SDSTS := Current VistA Appointment Status (Optional)
22 ; SDCHKIN := Appointment Check-In Date/Time (Optional)
23 ; SDCHKOUT := Appointment Check-Out Date/Time (Optional)
24 ; SDEIFN := Outpatient Encounter IFN for Appointment (Optional)
25 ; Output: Appoinment Status IFN ; Status Name ; Print Status ;
26 ; Check In Date/Time ; Check Out Date/Time ;
27 ; Admission Movement IFN
28 ; -1 if errors with DFN,SDT or SDCL
29 ;
30 ; Initialize Global Variables
31 N SDI,SDQUIT,SDCODE,SDSTSD,SDPSTS,SDINDCTR,SDAMVT,VADMVT,VAINDT
32 S SDQUIT=0
33 ;Validate parameters
34 F SDI="VDFN","FMDATE","VCLIN" Q:SDQUIT D @SDI
35 Q:SDQUIT -1
36 ; Set initial Status value, if no value set to NULL
37 S SDSTSD=$S($G(SDSTS)]"":$P($T(@SDSTS),";;",3),1:"")
38 ; No R appt status in original VistA code
39 S:$G(SDSTS)="R" SDSTSD=""
40 ; If Status is null check for non-count clinic
41 I $G(SDSTSD)="" S SDCODE=$$GETSTOP^SDAMA305($G(SDCL)) S:$P($G(SDCODE),"^",3)="Y" SDSTSD="NON-COUNT"
42 ;Get admission movement ifn
43 S VAINDT=$G(SDT) D ADM^VADPT2
44 ;Inpatient? (Check Status, Admission IFN?, Domicillary Ward?, Ward Location = "D"?)
45 I SDSTSD["INPATIENT",$S('+VADMVT:1,'$P(^DG(43,1,0),"^",21):0,1:$P($G(^DIC(42,+$P($G(^DGPM(VADMVT,0)),"^",6),0)),"^",3)="D") S SDSTSD=""
46 ; Determine Checked In/Out Indicator
47 S SDINDCTR=$S(+$G(SDCHKOUT):"CHECKED OUT",+$G(SDCHKIN):"CHECKED IN",SDSTSD]"":"",$G(SDT)>(DT+.2359):"FUTURE",1:"NO ACTION TAKEN") S:SDSTSD="" SDSTSD=SDINDCTR
48 I SDSTSD="NO ACTION TAKEN",$P($G(SDT),".")=DT,SDINDCTR'["CHECKED" S SDINDCTR="TODAY"
49 I SDSTSD="CHECKED OUT"!(SDSTSD="CHECKED IN"),SDT'<$$REQDT^SDM1A,'$P($G(^SCE(+$G(SDEIFN),0)),"^",7) S SDSTSD="NO ACTION TAKEN"
50 ; Determine PRINT STATUS
51 S SDPSTS=$S(SDSTSD=SDINDCTR!(SDINDCTR=""):SDSTSD,1:"")
52 I SDPSTS="" D
53 .I SDSTSD["INPATIENT",$P($G(^SC(SDCL,0)),U,17)'="Y",$P($G(^SCE(+$G(SDEIFN),0)),U,7)="" S SDPSTS=$P(SDSTSD," ")_"/ACT REQ" Q
54 .I SDSTSD="NO ACTION TAKEN",SDINDCTR="CHECKED OUT"!(SDINDCTR="CHECKED IN") S SDPSTS="ACT REQ/"_SDINDCTR Q
55 .S SDPSTS=$S(SDSTSD="NO ACTION TAKEN":SDSTSD,1:$P(SDSTSD," "))_"/"_SDINDCTR
56 I SDSTSD["INPATIENT",SDINDCTR="" D
57 .I SDT>(DT+.2359) S SDPSTS=$P(SDSTSD," ")_"/FUTURE" Q
58 .S SDPSTS=$P(SDSTSD," ")_"/NO ACT TAKN"
59 ;Get Appointment Status IFN
60 S SDAMVT=+$O(^SD(409.63,"AC",SDSTSD,0))
61 Q SDAMVT_";"_SDSTSD_";"_SDPSTS_";"_$G(SDCHKIN)_";"_$G(SDCHKOUT)_";"_+VADMVT
62VDFN ; Verify for valid patient dfn
63 I $G(DFN)="" S SDQUIT=1
64 E I '$D(^DPT(DFN)) S SDQUIT=1
65 Q
66VCLIN ; Verify for valid clinic dfn
67 I $G(SDCL)="" S SDQUIT=1
68 E I '$D(^SC(SDCL,0)) S SDQUIT=1
69 Q
70FMDATE ;
71 ; Appointment Date must be a valid internal FileMan Format
72 N X,Y,%H,%T,%Y
73 S Y=$G(SDT) D DD^%DT I Y=-1 S SDQUIT=1
74 ; Appointment Date cannot be imprecise
75 I 'SDQUIT S X=$G(SDT) D H^%DTC I %H=0 S SDQUIT=1
76 Q
77 ;
78 ;LIST OF VISTA STATUS CODES /NEW DESCRIPTIONS /OLD DESCRIPTIONS
79CC ;;CANCELLED BY CLINIC;;CANCELLED BY CLINIC
80CCR ;;CANCELLED BY CLINIC & RESCHEDULED;;CANCELLED BY CLINIC & AUTO RE-BOOK
81CP ;;CANCELLED BY PATIENT;;CANCELLED BY PATIENT
82CPR ;;CANCELLED BY PATIENT & RESCHEDULED;;CANCELLED BY PATIENT & AUTO-REBOOK
83R ;;SCHEDULED/KEPT;;
84I ;;INPATIENT;;INPATIENT APPOINTMENT
85NS ;;NO-SHOW;;NO-SHOW
86NSR ;;NO-SHOW & RESCHEDULED;;NO-SHOW & AUTO RE-BOOK
87NT ;;NO ACTION TAKEN;;NO ACTION TAKEN
Note: See TracBrowser for help on using the repository browser.