VPSRPC4 ;DALOI/KML,DJS - VPS Check In RPC ;Sep 6, 2022
;;1.0;VA POINT OF SERVICE (KIOSKS);**2,21,22**;Oct 21, 2011;Build 8
;;Per VHA Directive 6402, this routine should not be modified.
Q
;
CHK(VPSRES,VPSAPPT) ;
;VPS PATIENT CHECK-IN rpc - entry point
; patient can be checked-in for one to many appointments via the KIOSK
;VPSAPPTS - Input: string that represents the appt(s) to be checked in.
;Since more than one appt can be checked-in, each appt consists of the DFN, CLINIC ien, and appt date/timestamp.
;Each appt is delimited by ";" and the 3 pieces of data are separated by "-". All 3 data elements in the appt
;representation are required input.
; Syntax:
; DFN_"-"_clinic IEN_"-"_date/timestamp of scheduled appt_";"
;
; example of data string (represents 2 appts):
; "308165-1218-3120420.1215;308165-4569-3120420.1030"
;
;VPSRES - Output: single-dimensional array that represents the results for each appointment that was checked in.
;Each data element in the array represents the result of an appt check-in transaction; and the data
;in the 4-pieced string is delimited by "-".
; return value = 1 if check-in successful or '99' if appointment was not checked in
; Syntax:
; DFN_"-"_clinicIEN_"-"_date/timestamp of appt_"-"_return value_";"
; example of data output (example represents the result of 2 checked in appts):
; VPSRES(0)="308165-1218-3120420.1215-1
; VPSRES(1)="308165-4569-3120420.1030-99"
; ICR 5792 call to FIND^SDAM2
; ICR 5838 call to HDLKILL, BEFORE, HANDLE, AFTER, EVT routine in SDAMEVT
N VPSCIEN,VPSI,DFN,VPSDT,VPSCLIN,RESULT,VPSREC
I '+$G(VPSAPPT) S VPSRES(0)="---99-appt record not sent" Q
F VPSI=1:1 S VPSREC=$P(VPSAPPT,";",VPSI) Q:VPSREC']"" D
. S DFN=$P(VPSREC,"-"),VPSCLIN=$P(VPSREC,"-",2),VPSDT=$P(VPSREC,"-",3)
. I '+DFN S VPSRES(VPSI)=VPSREC_"-99-patient DFN not sent" Q
. I '+VPSDT S VPSRES(VPSI)=VPSREC_"-99-date/timestamp not sent" Q
. I '+VPSCLIN S VPSRES(VPSI)=VPSREC_"-99-clinic identifier not sent" Q
. D DT^DILF("T",VPSDT,.VPSDT)
. I $P(VPSDT,".")>DT!($P(VPSDT,".")<DT) S VPSRES(VPSI)=VPSREC_"-99-Only appointments scheduled for today's date are allowed to be checked-in" Q
. S VPSCIEN=$$FIND^SDAM2(DFN,VPSDT,VPSCLIN)
. I +VPSCIEN'>0 S VPSRES(VPSI)=VPSREC_"-99-Appt not found." Q
. D HDLKILL^SDAMEVT ;CLEAR PRE-EXISTING HANDLES
. N SDATA,SDCIHDL S SDATA=VPSCIEN_U_DFN_U_VPSDT_U_VPSCLIN,SDCIHDL=$$HANDLE^SDAMEVT(1) ;CALL TO EVENT HANDLER
. D BEFORE^SDAMEVT(.SDATA,DFN,VPSDT,VPSCLIN,VPSCIEN,SDCIHDL) ;CAPTURE CURRENT APPT DATA IN ^TMP("SDAMEVT",$J
. S RESULT=$$CHECKIN(VPSCLIN,VPSDT,VPSCIEN)
. D AFTER^SDAMEVT(.SDATA,DFN,VPSDT,VPSCLIN,VPSCIEN,SDCIHDL) ;CAPTURE CHECK-IN DATA IN ^TMP("SDAMEVT",$J
. D EVT^SDAMEVT(.SDATA,4,1,SDCIHDL) ; 4 := ci evt , 1:= computer monlogue ;CALL EVT HANDLER
. D HDLKILL^SDAMEVT ;CLEAR HANDLES
. S VPSRES(VPSI)=VPSREC_"-"_RESULT
Q
;
CHECKIN(CLIN,DTM,CIEN) ;update appropriate fields for check-in (HOSPITAL LOCATION file (#44), SDEC APPOINTMENT file (#409.84)
;DIE call to actually check patient in
; ICR 5791 - update to 44.003,309
;Input:
; CLIN - clinic ien
; DTM - DATE/TIME of appt
; CIEN - entry to update with checkin time
N VPSRET
N %,VPSNOW D NOW^%DTC S VPSNOW=%
S VPSRET=1
D UPDAPPT
Q VPSRET
;
UPDAPPT ;Find correct appointment IEN (appt. not Cancelled or NOSHOWed), update SDEC APPOINTMENT file #409.84
N SDAPPTIEN,NETNOW,SDECY,NOUPDT,SDCANCEL,SDNOSHOW
S SDAPPTIEN=""
S NOUPDT=0
F S SDAPPTIEN=$O(^SDEC(409.84,"APTDT",DFN,DTM,SDAPPTIEN)) Q:SDAPPTIEN="" D
. S (SDCANCEL,SDNOSHOW)=""
. S SDCANCEL=$$GET1^DIQ(409.84,SDAPPTIEN,.12,"I") I SDCANCEL'="" S NOUPDT=1 Q ;CHECK FOR CANCELLATION
. S SDNOSHOW=$$GET1^DIQ(409.84,SDAPPTIEN,.1,"I") I SDNOSHOW=1 S NOUPDT=1 Q ;CHECK FOR NOSHOW
. S NETNOW=$$FMTONET^SDECDATE(VPSNOW)
. D CHECKIN^SDEC25(.SDECY,SDAPPTIEN,NETNOW)
. I $P(^SDEC(409.84,SDAPPTIEN,0),"^",3,4)'="" S VPSRET=1,NOUPDT=0
I NOUPDT=1 S VPSRET=0
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVPSRPC4 4050 printed Dec 13, 2024@02:43:35 Page 2
VPSRPC4 ;DALOI/KML,DJS - VPS Check In RPC ;Sep 6, 2022
+1 ;;1.0;VA POINT OF SERVICE (KIOSKS);**2,21,22**;Oct 21, 2011;Build 8
+2 ;;Per VHA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
CHK(VPSRES,VPSAPPT) ;
+1 ;VPS PATIENT CHECK-IN rpc - entry point
+2 ; patient can be checked-in for one to many appointments via the KIOSK
+3 ;VPSAPPTS - Input: string that represents the appt(s) to be checked in.
+4 ;Since more than one appt can be checked-in, each appt consists of the DFN, CLINIC ien, and appt date/timestamp.
+5 ;Each appt is delimited by ";" and the 3 pieces of data are separated by "-". All 3 data elements in the appt
+6 ;representation are required input.
+7 ; Syntax:
+8 ; DFN_"-"_clinic IEN_"-"_date/timestamp of scheduled appt_";"
+9 ;
+10 ; example of data string (represents 2 appts):
+11 ; "308165-1218-3120420.1215;308165-4569-3120420.1030"
+12 ;
+13 ;VPSRES - Output: single-dimensional array that represents the results for each appointment that was checked in.
+14 ;Each data element in the array represents the result of an appt check-in transaction; and the data
+15 ;in the 4-pieced string is delimited by "-".
+16 ; return value = 1 if check-in successful or '99' if appointment was not checked in
+17 ; Syntax:
+18 ; DFN_"-"_clinicIEN_"-"_date/timestamp of appt_"-"_return value_";"
+19 ; example of data output (example represents the result of 2 checked in appts):
+20 ; VPSRES(0)="308165-1218-3120420.1215-1
+21 ; VPSRES(1)="308165-4569-3120420.1030-99"
+22 ; ICR 5792 call to FIND^SDAM2
+23 ; ICR 5838 call to HDLKILL, BEFORE, HANDLE, AFTER, EVT routine in SDAMEVT
+24 NEW VPSCIEN,VPSI,DFN,VPSDT,VPSCLIN,RESULT,VPSREC
+25 IF '+$GET(VPSAPPT)
SET VPSRES(0)="---99-appt record not sent"
QUIT
+26 FOR VPSI=1:1
SET VPSREC=$PIECE(VPSAPPT,";",VPSI)
if VPSREC']""
QUIT
Begin DoDot:1
+27 SET DFN=$PIECE(VPSREC,"-")
SET VPSCLIN=$PIECE(VPSREC,"-",2)
SET VPSDT=$PIECE(VPSREC,"-",3)
+28 IF '+DFN
SET VPSRES(VPSI)=VPSREC_"-99-patient DFN not sent"
QUIT
+29 IF '+VPSDT
SET VPSRES(VPSI)=VPSREC_"-99-date/timestamp not sent"
QUIT
+30 IF '+VPSCLIN
SET VPSRES(VPSI)=VPSREC_"-99-clinic identifier not sent"
QUIT
+31 DO DT^DILF("T",VPSDT,.VPSDT)
+32 IF $PIECE(VPSDT,".")>DT!($PIECE(VPSDT,".")<DT)
SET VPSRES(VPSI)=VPSREC_"-99-Only appointments scheduled for today's date are allowed to be checked-in"
QUIT
+33 SET VPSCIEN=$$FIND^SDAM2(DFN,VPSDT,VPSCLIN)
+34 IF +VPSCIEN'>0
SET VPSRES(VPSI)=VPSREC_"-99-Appt not found."
QUIT
+35 ;CLEAR PRE-EXISTING HANDLES
DO HDLKILL^SDAMEVT
+36 ;CALL TO EVENT HANDLER
NEW SDATA,SDCIHDL
SET SDATA=VPSCIEN_U_DFN_U_VPSDT_U_VPSCLIN
SET SDCIHDL=$$HANDLE^SDAMEVT(1)
+37 ;CAPTURE CURRENT APPT DATA IN ^TMP("SDAMEVT",$J
DO BEFORE^SDAMEVT(.SDATA,DFN,VPSDT,VPSCLIN,VPSCIEN,SDCIHDL)
+38 SET RESULT=$$CHECKIN(VPSCLIN,VPSDT,VPSCIEN)
+39 ;CAPTURE CHECK-IN DATA IN ^TMP("SDAMEVT",$J
DO AFTER^SDAMEVT(.SDATA,DFN,VPSDT,VPSCLIN,VPSCIEN,SDCIHDL)
+40 ; 4 := ci evt , 1:= computer monlogue ;CALL EVT HANDLER
DO EVT^SDAMEVT(.SDATA,4,1,SDCIHDL)
+41 ;CLEAR HANDLES
DO HDLKILL^SDAMEVT
+42 SET VPSRES(VPSI)=VPSREC_"-"_RESULT
End DoDot:1
+43 QUIT
+44 ;
CHECKIN(CLIN,DTM,CIEN) ;update appropriate fields for check-in (HOSPITAL LOCATION file (#44), SDEC APPOINTMENT file (#409.84)
+1 ;DIE call to actually check patient in
+2 ; ICR 5791 - update to 44.003,309
+3 ;Input:
+4 ; CLIN - clinic ien
+5 ; DTM - DATE/TIME of appt
+6 ; CIEN - entry to update with checkin time
+7 NEW VPSRET
+8 NEW %,VPSNOW
DO NOW^%DTC
SET VPSNOW=%
+9 SET VPSRET=1
+10 DO UPDAPPT
+11 QUIT VPSRET
+12 ;
UPDAPPT ;Find correct appointment IEN (appt. not Cancelled or NOSHOWed), update SDEC APPOINTMENT file #409.84
+1 NEW SDAPPTIEN,NETNOW,SDECY,NOUPDT,SDCANCEL,SDNOSHOW
+2 SET SDAPPTIEN=""
+3 SET NOUPDT=0
+4 FOR
SET SDAPPTIEN=$ORDER(^SDEC(409.84,"APTDT",DFN,DTM,SDAPPTIEN))
if SDAPPTIEN=""
QUIT
Begin DoDot:1
+5 SET (SDCANCEL,SDNOSHOW)=""
+6 ;CHECK FOR CANCELLATION
SET SDCANCEL=$$GET1^DIQ(409.84,SDAPPTIEN,.12,"I")
IF SDCANCEL'=""
SET NOUPDT=1
QUIT
+7 ;CHECK FOR NOSHOW
SET SDNOSHOW=$$GET1^DIQ(409.84,SDAPPTIEN,.1,"I")
IF SDNOSHOW=1
SET NOUPDT=1
QUIT
+8 SET NETNOW=$$FMTONET^SDECDATE(VPSNOW)
+9 DO CHECKIN^SDEC25(.SDECY,SDAPPTIEN,NETNOW)
+10 IF $PIECE(^SDEC(409.84,SDAPPTIEN,0),"^",3,4)'=""
SET VPSRET=1
SET NOUPDT=0
End DoDot:1
+11 IF NOUPDT=1
SET VPSRET=0
+12 QUIT