SDES ;ALB/KML,RRM,RRM,BWF,BLB,ANU,LAB,MGD,LAB - VISTA SCHEDULING RPCS ;FEB 13,2023
;;5.3;Scheduling;**788,790,792,794,797,799,800,801,803,804,805,807,809,813,814,815,818,819,824,825,826,836**;Aug 13, 1993;Build 20
;;Per VHA Directive 6402, this routine should not be modified
Q
; This routine documents the entry points for the new VS GUI version 3.0.
;
GETFLAGS(JSON,DFN,EAS) ; RPC: SDES GET PATIENT FLAGS
D GETFLAGS^SDESPATFLAGS(.JSON,$G(DFN),$G(EAS)) Q
DISPOSITION(RET,ARIEN,DISP,DISPBY,DISPDT,EAS,PCMT) ;RPC: SDES ARCLOSE
D DISPOSITION^SDESARCLOSE(.RET,$G(ARIEN),$G(DISP),$G(DISPBY),$G(DISPDT),$G(EAS),$G(PCMT)) Q
APPTBLOCKMOVE(RETURN,APPTIEN,SDRES,APPTDTTM,EAS) ; RPC: SDES CREATE APPT BLK AND MOVE
D APPTBLOCKMOVE^SDESBLKANDMOVE(.RETURN,$G(APPTIEN),$G(SDRES),$G(APPTDTTM),$G(EAS)) Q
APPTBYCLINIC(JSON,CLINICIEN,SDBEG,SDEND,EAS) ;SDES GET APPT BY CLINIC
D GETAPPTSBYCLINIC^SDESAPPT(.JSON,$G(CLINICIEN),$G(SDBEG),$G(SDEND),$G(EAS)) Q
APPTBYCLINICLIST(APPTLISTJSON,CLINICIENS) ;SDES GET APPTS BY CLINIC LIST
D APPTBYCLINICLIST^SDESAPPT(.APPTLISTJSON,.CLINICIENS) Q
APPTBYRESOURCE(JSON,RESIEN,SDBEG,SDEND,EAS) ;SDES GET APPT BY RESOURCE
D APPTBYRESOURCE^SDESAPPT(.JSON,$G(RESIEN),$G(SDBEG),$G(SDEND),$G(EAS)) Q
APPGETJSON(JSON,DFN,SDBEG,SDEND,EAS) ;
D APPGETJSON^SDESAPPT(.JSON,$G(DFN),$G(SDBEG),$G(SDEND),$G(EAS)) Q
APPGETONEJSON(JSON,APPTIEN,EAS) ;
D APPGETONEJSON^SDESAPPT(.JSON,$G(APPTIEN),$G(EAS)) Q
APPTBYRIENAPTYP(JSON,APTREQIEN,APTREQTYPE,SDEAS) ;
D APPTBYRIENAPTYP^SDESAPPT(.JSON,$G(APTREQIEN),$G(APTREQTYPE),$G(SDEAS)) Q
; Parameter list for APTREQCREATE and APTREQUPDATE *MUST* be kept in sync.
APTREQCREATE(JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,PATDATEPREFS,ARSTOPSEC,MODALITY) ;
S ARIEN="" ;There will never be an IEN when calling this RPC
D ARSET Q
APTREQUPDATE(JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,PATDATEPREFS,ARSTOPSEC,MODALITY) ;
S ARIEN=$G(ARIEN,"")
S:ARIEN="" ARIEN=-1 ;Flag missing ARIEN when calling the update RPC
D ARSET Q
ARSET ;Called from APTREQCREATE and APTREQUPDATE tags
S DFN=$G(DFN),EDT=$G(EDT),INST=$G(INST),TYPE=$G(TYPE),CLIN=$G(CLIN),USER=$G(USER),REQBY=$G(REQBY),PROV=$G(PROV),DAPTDT=$G(DAPTDT),COMM=$G(COMM),ENPRI=$G(ENPRI)
S MAR=$G(MAR),MAI=$G(MAI),AMRAN=$G(AMRAN),PATCONT=$G(PATCONT),SVCCON=$G(SVCCON),SVCCOP=$G(SVCCOP),MRTCDT=$G(MRTCDT),STOP=$G(STOP),APTYP=$G(APTYP),PATSTAT=$G(PATSTAT)
S MULTAPTMDE=$G(MULTAPTMDE),PARENT=$G(PARENT),NLT=$G(NLT),PRER=$G(PRER),ORDN=$G(ORDN),VAOSGUID=$G(VAOSGUID)
S EAS=$G(EAS),PCMT=$G(PCMT),INSTIEN=$G(INSTIEN),ARSTOPSEC=$G(ARSTOPSEC),MODALITY=$G(MODALITY)
I '$D(PATDATEPREFS) S PATDATEPREFS=""
; Because of an SAC limitation on the number of chars per line, addition of more parameters will require
; this to be changed over to passing an array.
D ARSET^SDESAPTREQSET(.JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,.PATDATEPREFS,ARSTOPSEC,MODALITY)
Q
; Appointment Request Create/Edit
; SD*5.3*806
APTREQ44CRT(JSON,ARIEN,DFN,ARDAPTDT,ARLEN,ARRSN,ARUSER,ARODT,PATELG,AROVB) ; Create Appointment in #44
N ARUPD
S ARUPD=0
D ARSET44
Q
APTREQ44EDIT(JSON,ARIEN,DFN,ARDAPTDT,ARLEN,ARRSN,ARUSER,ARODT,PATELG,AROVB) ; Edit Appointment in #44
N ARUPD
S ARUPD=1
D ARSET44
Q
APTREQ40984CRT(JSON,SDAPTSTDTTM,SDAPTEDTTM,SDPATDFN,SDRESOURCE,SDATYPID,SDDDTTM,SDEXTID,SDAPTREQTYP,SDPROVIEN,SDCLNID,SDNOTE,SDAPTYP,SDEESTAT,SDAPTLEN,SDEAS) ; Create Appointment in #409.84
D ARSET^SDESAPPTREQ40984(.JSON,$G(SDAPTSTDTTM),$G(SDAPTEDTTM),$G(SDPATDFN),$G(SDRESOURCE),$G(SDATYPID),$G(SDDDTTM),$G(SDEXTID),$G(SDAPTREQTYP),$G(SDPROVIEN),$G(SDCLNID),$G(SDNOTE),$G(SDAPTYP),$G(SDEESTAT),$G(SDAPTLEN),$G(SDEAS))
Q
APTREQ40984EDIT(JSON,SDECAPTID,SDECNOTE,SDECLEN) ;Edit Appointment in SDEC APPOINTMENT File #409.84 - RPC: SDES EDIT APPT #409.84
D EDITAPPT^SDESAPPTEDIT(.JSON,$G(SDECAPTID),$G(SDECNOTE),$G(SDECLEN))
Q
ARSET44 ; Create/Edit Appointment in #44
D ARSET^SDESAPTREQ44(.JSON,$G(ARUPD),$G(ARIEN),$G(DFN),$G(ARDAPTDT),$G(ARLEN),$G(ARRSN),$G(ARUSER),$G(ARODT),$G(PATELG),$G(AROVB))
Q
ARCANCEL44(RETURN,SDDFN,SDCLNIEN,SDARDTTM) ; RPC: SDES CANCEL APPT #44
D ARCANCEL44^SDESCANCELAPPT44(.RETURN,$G(SDDFN),$G(SDCLNIEN),$G(SDARDTTM)) Q
APTREQ2CRT(JSON,SDPATIENTDFN,SDCLNIEN,SDAPPTDTTM,SDLABDTTM,SDXRAYDTTM,SDEKGDTTM,SDVSTPURP,SDAPPTTYPE,SDCOLLATERAL,SDSCHREQTYPE,SDNXTAVAAPPT,SDFOLLOWUP) ; Create Appointment in #2
N SDAPPTUPD
S SDAPPTUPD=0
D ARSET2
Q
APTREQ2EDIT(JSON,SDPATIENTDFN,SDCLNIEN,SDAPPTDTTM,SDLABDTTM,SDXRAYDTTM,SDEKGDTTM,SDVSTPURP,SDAPPTTYPE,SDCOLLATERAL,SDSCHREQTYPE,SDNXTAVAAPPT,SDFOLLOWUP) ; Edit Appointment in #2
N SDAPPTUPD
S SDAPPTUPD=1
D ARSET2
Q
ARSET2 ; Create/Edit Appointment in #2
D ARSET^SDESAPPTREQ2(.JSON,$G(SDAPPTUPD),$G(SDPATIENTDFN),$G(SDCLNIEN),$G(SDAPPTDTTM),$G(SDLABDTTM),$G(SDXRAYDTTM),$G(SDEKGDTTM),$G(SDVSTPURP),$G(SDAPPTTYPE),$G(SDCOLLATERAL),$G(SDSCHREQTYPE),$G(SDNXTAVAAPPT),$G(SDFOLLOWUP))
Q
ARCANCEL2(RETURN,SDPATIENTDFN,SDCLNIEN,SDCANCELTYP,SDAPPTDTTM,SDCANCELDTTM,SDUSR,SDCANCELREASON,SDCANCELRMKS) ; RPC: SDES CANCEL APPT #2
D ARCANCEL2^SDESCANCELAPPT2(.RETURN,$G(SDPATIENTDFN),$G(SDCLNIEN),$G(SDCANCELTYP),$G(SDAPPTDTTM),$G(SDCANCELDTTM),$G(SDUSR),$G(SDCANCELREASON),$G(SDCANCELRMKS)) Q
;
CANCELAPPT(SDECY,APPTIEN,STATUS,CANREAS,USER,EAS) ;SDES CANCEL APPT - cancel appointment
D CANCELAPPT^SDESCANCELAPPT(.SDECY,$G(APPTIEN),$G(STATUS),$G(CANREAS),$G(USER),$G(EAS)) Q
;
CHECKIN(JSON,SDECAPTID,SDECCDT,SDECCC,SDECPRV) ;SDES APPT CHECKIN JSON
D CHECKIN^SDES25(.JSON,$G(SDECAPTID),$G(SDECCDT),$G(SDECCC),$G(SDECPRV)) Q
;
;The parameter list for the clinic create and set use generic parameter names to ensure we stay in SAC compliance
;with the length of a single line.
CLINICCREATE(RET,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44) ;
;CLINICCREATE(RET,CLINIEN,R1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29) ;
S CLINIEN="" ;There will never be an IEN when calling this RPC
D CLINICSET Q
CLINICSET ;Called from CLINICCREATE and CLINICUPDATE tags
S P1=$G(P1),P2=$G(P2),P3=$G(P3),P4=$G(P4),P5=$G(P5),P6=$G(P6),P7=$G(P7),P8=$G(P8),P9=$G(P9),P10=$G(P10),P11=$G(P11),P12=$G(P12),P13=$G(P13),P14=$G(P14),P15=$G(P15),P16=$G(P16),P17=$G(P17)
S P18=$G(P18),P19=$G(P19),P20=$G(P20),P21=$G(P21),P22=$G(P22),P23=$G(P23)
S P24=$G(P24),P25=$G(P25),P26=$G(P26),P27=$G(P27),P28=$G(P28),P29=$G(P29),P30=$G(P30),P31=$G(P31),P32=$G(P32),P33=$G(P33),P34=$G(P34),P35=$G(P35),P36=$G(P36),P37=$G(P37),P38=$G(P38),P39=$G(P39),P40=$G(P40)
S P41=$G(P41),P42=$G(P42),P43=$G(P43),P44=$G(P44)
D CLINICSET^SDESCLINICSET(.RET,CLINIEN,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44)
Q
;
CLINICSEARCH(SDECY,SEARCHSTRING) ;Given a search string return a clinic list that matches.
D CLINICSEARCH^SDESSEARCH(.SDECY,$G(SEARCHSTRING)) Q
CLINICRSCSEARCH(SDECY,SEARCHSTRING) ;Given a search string return a clinic list that matches.
D CLINICRSC^SDES01C(.SDECY,$G(SEARCHSTRING)) Q
CREATEAPPTWRAPPR(JSONRETURN,APPTARRAY) ; SDES CREATE APPOINTMENTS ;Create appts in Files #409.84, #44, and #2.
D CREATEAPPTS^SDESCRTAPPTWRAP(.JSONRETURN,.APPTARRAY) Q
GETREGA(SDECY,DFN,EAS) ;SDES GET REGISTRATION INFO
D GETREGA^SDESGETREGA(.SDECY,$G(DFN),$G(EAS)) Q
INSURVERIFYREQ(JSON,DFN,EAS) ;SDES GET INSRUANCE VERIFY REQ
D INSURVERIFYREQ^SDESPATRPC(.JSON,$G(DFN),$G(EAS)) Q
INSURINDICATORS(RETURN,DFNS) ;SDES GET INSURANCE VERIFY LIST
D INSURINDICATORS^SDESPATRPC(.RETURN,.DFNS) Q
SPACEBAR(SDECY,SDECDIC,SDECVAL) ;EP Update ^DISV with most recent lookup value SDECVAL from file SDECDIC
D SPACEBAR^SDES30(.SDECY,$G(SDECDIC),$G(SDECVAL)) Q
JSONINACTCLN(SDEC,CLINICIEN,EAS) ;EP RPC: SDES INACTIVATE CLINIC
D JSONINACTCLN^SDESINACTCLINIC(.SDEC,$G(CLINICIEN),$G(EAS)) Q
JSONCLNINFO(SDEC,CLINICIEN,EAS) ;EP RPC: SDES GET CLINIC INFO
D JSONCLNINFO^SDESRTVCLN(.SDEC,$G(CLINICIEN),$G(EAS)) Q
SETCLINAVAIL(RETURN,SDCLINIC,DATES,TIMES,SLOTS,SDEAS) ; RPC: SDES SET CLINIC AVAILABILITY
D SETCLINAVAIL^SDESCLNSETAVAIL(.RETURN,$G(SDCLINIC),$G(DATES),$G(TIMES),$G(SLOTS),$G(SDEAS)) Q
GETCLNAVAILABLTY(RET,CLINICIEN,SDESSTART,SDESENDDATE,EAS) ;EP RPC: SDES GET CLINIC AVAILABILITY-retrieve clinic availablity in a given timeframe
D GETCLAVAILABLTY^SDESCLINICAVAIL(.RET,$G(CLINICIEN),$G(SDESSTART),$G(SDESENDDATE),$G(EAS)) Q
CANCLNAVAILABLTY(RET,SDCLNIEN,SDESCANDATE,SDESSTRTIM,SDESENDTIM,SDCANREM,SDEAS) ;Called from RPC: SDES CANCEL CLINIC AVAILABILITY
D CANCLAVAIL^SDESCCAVAIL(.RET,$G(SDCLNIEN),$G(SDESCANDATE),$G(SDESSTRTIM),$G(SDESENDTIM),$G(SDCANREM),$G(SDEAS)) Q
GETALLAPPTS(SDECY,DFN) ; SDES GET PATIENT APPTS BY DFN #2
D GETALLAPPTS^SDESGETPATAPPT(.SDECY,$G(DFN)) Q
GETSINGLEAPPT(SDECY,DFN,DATETIME,CLINIC) ; SDES GET PATIENT APPT BY IEN #2
D GETSINGLEAPPT^SDESGETPATAPPT(.SDECY,$G(DFN),$G(DATETIME),$G(CLINIC)) Q
GETUSRDTL(RET,SDSECID,EAS) ;Called from RPC: SDES GET USER PROFILE
D GETUSRDTL^SDESGETUD(.RET,$G(SDSECID),$G(EAS)) Q
GETUSRDTLDUZ(RET,SDUSRIEN,EAS) ;Called from RPC: SDES GET USER PROFILE BY DUZ
D GETUSRDTLDUZ^SDESGETUD(.RET,$G(SDUSRIEN),$G(EAS)) Q
UPDRECALLREQ(RETN,RECALLIEN,DFN,ACCNO,SDCMT,FASTING,APPTP,RRPROVIEN,CLINIEN,APPTLEN,DATE,RECPPDT,DAPTDT,USERIEN,SECPDT,EAS) ;update recall request
D UPDRECALLREQ^SDESUPDRECREQ(.RETN,$G(RECALLIEN),$G(DFN),$G(ACCNO),$G(SDCMT),$G(FASTING),$G(APPTP),$G(RRPROVIEN),$G(CLINIEN),$G(APPTLEN),$G(DATE),$G(RECPPDT),$G(DAPTDT),$G(USERIEN),$G(SECPDT),$G(EAS)) Q
CREATERECREQ(RETN,DFN,ACCNO,SDCMT,FASTING,APPTP,RRPROVIEN,CLINIEN,APPTLEN,DATE,RECPPDT,DAPTDT,USERIEN,SECPDT,SDENTDT,EAS) ;update recall request
D CREATERECREQ^SDESUPDRECREQ(.RETN,$G(DFN),$G(ACCNO),$G(SDCMT),$G(FASTING),$G(APPTP),$G(RRPROVIEN),$G(CLINIEN),$G(APPTLEN),$G(DATE),$G(RECPPDT),$G(DAPTDT),$G(USERIEN),$G(SECPDT),$G(SDENTDT),$G(EAS)) Q
DISPRECALL(SDECY,RECALLIEN,REASON,COMMENT,EAS) ; for a PtCSch request, set disposition reason and DELETE an entry from the RECALL REMINDERS file 403.5
D DISPRECALL^SDESDISPRECALL(.SDECY,$G(RECALLIEN),$G(REASON),$G(COMMENT),$G(EAS)) Q
GETAPPOINTMENTS(SDECY,SDCLIN,SDSTDTTM,SDENDDTTM) ;get appointments for clinic out of file 44
D GETAPPOINTMENTS^SDESGETCLINAPPT(.SDECY,$G(SDCLIN),$G(SDSTDTTM),$G(SDENDDTTM)) Q
GETSTOPCODE(SDECY,SDSTCD) ;get stop code details out of file 40.7
D GETSTCDDTL^SDESGETSTOPCODE(.SDECY,$G(SDSTCD)) Q
GETPATCHNUM(SDECY) ; get latest SD patch number installed on system
D GETPATCHNUM^SDESPATCHINFO(.SDECY) Q
GETMISSIONELG(SDECY,APPTREQIEN,PID,APPTREQTYP,SDEAS,APPTDATE,CLINIEN) ;
D GETMISSIONELG^SDESMISSIONELG(.SDECY,$G(APPTREQIEN),$G(PID),$G(APPTREQTYP),$G(SDEAS),$G(APPTDATE),$G(CLINIEN)) Q
PRINTPATAPPTS(SDECY,SDDFN,SDBEGIN,SDEND,EAS) ;print patient friend appointments
S:$G(SDBEGIN)'="" SDBEGIN=$$ISOTFM^SDAMUTDT(SDBEGIN)
S:$G(SDEND)'="" SDEND=$$ISOTFM^SDAMUTDT(SDEND)
S:$G(SDBEGIN)="" SDBEGIN=$$NOW^XLFDT
S:$G(SDEND)="" SDEND=$$FMADD^XLFDT(SDBEGIN,90)
D PRINTPATAPPTS^SDESPRINTPATAPPT(.SDECY,$G(SDDFN),$G(SDBEGIN),$G(SDEND),$G(EAS)) Q
Q
;Based on Patient DFN, retrieve and return all appointments associated with a Patient IEN from SDEC APPOINTMENT File #409.84,
;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPDFN(SDECY,SDDFN,SDBEGIN,SDEND) ;Called from RPC: SDES GET APPTS BY PATIENT DFN
N SDVIEWAPPTBY
S SDVIEWAPPTBY=0
D GETAPPTS^SDESGETAPPTWRAP(.SDECY,$G(SDDFN),$G(SDBEGIN),$G(SDEND))
Q
;Based on CLINIC IEN, retrieve and return all appointments associated with a Clinic IEN from SDEC APPOINTMENT File #409.84,
;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPCLIN(SDECY,SDCLINIEN,SDBEGIN,SDEND) ;Called from RPC: SDES GET APPTS BY CLIN IEN
N SDVIEWAPPTBY
S SDVIEWAPPTBY=1
D GETAPPTS^SDESGETAPPTWRAP(.SDECY,$G(SDCLINIEN),$G(SDBEGIN),$G(SDEND))
Q
;Based on APPOINTMENT IEN, retrieve and return all appointments associated with Appointment IEN from SDEC APPOINTMENT File #409.84,
;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPIEN(SDECY,SDAPPTIEN,SDEAS) ;;Called from RPC: SDES GET APPTS BY IEN
D GETAPPTBYIEN^SDESGETAPPTWRAP2(.SDECY,$G(SDAPPTIEN),$G(SDEAS))
Q
;Based on Patient DFN, retrieve and return all appointments associated with a Patient IEN from SDEC APPOINTMENT File #409.84,
;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
;This is a clone from SDES GET APPTS BY PATIENT DFN
GETAPPTWRAPDFN2(SDECY,SDDFN,SDBEGIN,SDEND,SDEAS) ;Called from RPC: SDES GET APPTS BY PATIENT DFN2
D GETAPPTBYPATDFN^SDESGETAPPTWRAP2(.SDECY,$G(SDDFN),$G(SDBEGIN),$G(SDEND),$G(SDEAS))
Q
;Based on CLINIC IEN, retrieve and return all appointments associated with a Clinic IEN from SDEC APPOINTMENT File #409.84,
;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
;This is a clone from SDES GET APPTS BY CLIN IEN
GETAPPTWRAPCLIN2(SDECY,SDCLINIEN,SDBEGIN,SDEND,SDEAS) ;;Called from RPC: SDES GET APPTS BY CLIN IEN 2
D GETAPPTBYCLNIEN^SDESGETAPPTWRAP2(.SDECY,$G(SDCLINIEN),$G(SDBEGIN),$G(SDEND),$G(SDEAS))
Q
; get appointment request wrapper
GETREQLISTBYDFN(JSONRETURN,DFN,EAS) ; SDES GET APPT REQ LIST BY DFN
D GETREQLISTBYDFN^SDESGETREQWRAPPR(.JSONRETURN,$G(DFN),$G(EAS)) Q
GETREQBYREQIEN(JSONRETURN,REQUESTIEN,EAS) ;SDES GET APPT REQ BY IEN
D GETREQBYREQIEN^SDESGETAPPTREQ(.JSONRETURN,$G(REQUESTIEN),$G(EAS)) Q
GETREQSBYDFN(JSONRETURN,DFN,EAS) ;SDES PATIENT APPT REQ BY DFN
D GETREQSBYDFN^SDESGETAPPTREQ(.JSONRETURN,$G(DFN),$G(EAS)) Q
GETCONSULTBYIEN(JSONRETURN,CONSULTIEN,EAS) ;SDES GET CONSULTS BY IEN
D GETCONSULTBYIEN^SDESGETCONSULTS(.JSONRETURN,$G(CONSULTIEN),$G(EAS)) Q
GETCONSULTSBYDFN(JSONRETURN,DFN,EAS) ;SDES GET CONSULTS BY DFN
D GETCONSULTSBYDFN^SDESGETCONSULTS(.JSONRETURN,$G(DFN),$G(EAS)) Q
GETRECALLBYIEN(JSONRETURN,RECALLIEN,EAS) ;SDES GET RECALLS BY IEN
D GETRECALLBYIEN^SDESGETRECALL(.JSONRETURN,$G(RECALLIEN),$G(EAS)) Q
GETRECALLSBYDFN(JSONRETURN,DFN,EAS) ; SDES GET RECALLS BY DFN
D GETRECALLSBYDFN^SDESGETRECALL(.JSONRETURN,$G(DFN),$G(EAS)) Q
;GETREQBYAPPTIEN(JSONRETURN,APPTIEN,EAS) ;SDES GET APPT REQ BY APPT IEN
;D GETREQBYAPPTIEN^SDESGETAPPTREQ(.JSONRETURN,$G(APPTIEN),$G(EAS)) Q ;
;
CANCELAPPTS(JSONRETURN,APPTIEN,CLINICIEN,DFN,CANBYCLINORPAT,CANCELREASONIEN,NOTE,CANCELHASH,EAS) ;
D CANCELAPPTS^SDESCANCELAPPTS(.JSONRETURN,$G(APPTIEN),$G(CLINICIEN),$G(DFN),$G(CANBYCLINORPAT),$G(CANCELREASONIEN),$G(NOTE),$G(CANCELHASH),$G(EAS)) ;
Q
;
ADDUSR(JSONRETURN,LOCIEN,USRIEN) ;ADD PRIV USER
D UPDPRIV^SDESLOC(.JSONRETURN,1,$G(LOCIEN),$G(USRIEN)) Q
RMVUSR(JSONRETURN,LOCIEN,USRIEN) ; DELETE PRIV USER
D UPDPRIV^SDESLOC(.JSONRETURN,0,$G(LOCIEN),$G(USRIEN)) Q
RMVAUSR(JSONRETURN,LOCIEN) ; DELETE ALL USERS FROM #44
D RMVALLUSR^SDESLOC(.JSONRETURN,$G(LOCIEN)) Q
RTNAUSR(JSONRETURN,LOCIEN) ; READ ALL USERS FROM #44
D RTNALLUSR^SDESLOC(.JSONRETURN,$G(LOCIEN)) Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES 15566 printed Dec 13, 2024@02:53:10 Page 2
SDES ;ALB/KML,RRM,RRM,BWF,BLB,ANU,LAB,MGD,LAB - VISTA SCHEDULING RPCS ;FEB 13,2023
+1 ;;5.3;Scheduling;**788,790,792,794,797,799,800,801,803,804,805,807,809,813,814,815,818,819,824,825,826,836**;Aug 13, 1993;Build 20
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 QUIT
+4 ; This routine documents the entry points for the new VS GUI version 3.0.
+5 ;
GETFLAGS(JSON,DFN,EAS) ; RPC: SDES GET PATIENT FLAGS
+1 DO GETFLAGS^SDESPATFLAGS(.JSON,$GET(DFN),$GET(EAS))
QUIT
DISPOSITION(RET,ARIEN,DISP,DISPBY,DISPDT,EAS,PCMT) ;RPC: SDES ARCLOSE
+1 DO DISPOSITION^SDESARCLOSE(.RET,$GET(ARIEN),$GET(DISP),$GET(DISPBY),$GET(DISPDT),$GET(EAS),$GET(PCMT))
QUIT
APPTBLOCKMOVE(RETURN,APPTIEN,SDRES,APPTDTTM,EAS) ; RPC: SDES CREATE APPT BLK AND MOVE
+1 DO APPTBLOCKMOVE^SDESBLKANDMOVE(.RETURN,$GET(APPTIEN),$GET(SDRES),$GET(APPTDTTM),$GET(EAS))
QUIT
APPTBYCLINIC(JSON,CLINICIEN,SDBEG,SDEND,EAS) ;SDES GET APPT BY CLINIC
+1 DO GETAPPTSBYCLINIC^SDESAPPT(.JSON,$GET(CLINICIEN),$GET(SDBEG),$GET(SDEND),$GET(EAS))
QUIT
APPTBYCLINICLIST(APPTLISTJSON,CLINICIENS) ;SDES GET APPTS BY CLINIC LIST
+1 DO APPTBYCLINICLIST^SDESAPPT(.APPTLISTJSON,.CLINICIENS)
QUIT
APPTBYRESOURCE(JSON,RESIEN,SDBEG,SDEND,EAS) ;SDES GET APPT BY RESOURCE
+1 DO APPTBYRESOURCE^SDESAPPT(.JSON,$GET(RESIEN),$GET(SDBEG),$GET(SDEND),$GET(EAS))
QUIT
APPGETJSON(JSON,DFN,SDBEG,SDEND,EAS) ;
+1 DO APPGETJSON^SDESAPPT(.JSON,$GET(DFN),$GET(SDBEG),$GET(SDEND),$GET(EAS))
QUIT
APPGETONEJSON(JSON,APPTIEN,EAS) ;
+1 DO APPGETONEJSON^SDESAPPT(.JSON,$GET(APPTIEN),$GET(EAS))
QUIT
APPTBYRIENAPTYP(JSON,APTREQIEN,APTREQTYPE,SDEAS) ;
+1 DO APPTBYRIENAPTYP^SDESAPPT(.JSON,$GET(APTREQIEN),$GET(APTREQTYPE),$GET(SDEAS))
QUIT
+2 ; Parameter list for APTREQCREATE and APTREQUPDATE *MUST* be kept in sync.
APTREQCREATE(JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,PATDATEPREFS,ARSTOPSEC,MODALITY) ;
+1 ;There will never be an IEN when calling this RPC
SET ARIEN=""
+2 DO ARSET
QUIT
APTREQUPDATE(JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,PATDATEPREFS,ARSTOPSEC,MODALITY) ;
+1 SET ARIEN=$GET(ARIEN,"")
+2 ;Flag missing ARIEN when calling the update RPC
if ARIEN=""
SET ARIEN=-1
+3 DO ARSET
QUIT
ARSET ;Called from APTREQCREATE and APTREQUPDATE tags
+1 SET DFN=$GET(DFN)
SET EDT=$GET(EDT)
SET INST=$GET(INST)
SET TYPE=$GET(TYPE)
SET CLIN=$GET(CLIN)
SET USER=$GET(USER)
SET REQBY=$GET(REQBY)
SET PROV=$GET(PROV)
SET DAPTDT=$GET(DAPTDT)
SET COMM=$GET(COMM)
SET ENPRI=$GET(ENPRI)
+2 SET MAR=$GET(MAR)
SET MAI=$GET(MAI)
SET AMRAN=$GET(AMRAN)
SET PATCONT=$GET(PATCONT)
SET SVCCON=$GET(SVCCON)
SET SVCCOP=$GET(SVCCOP)
SET MRTCDT=$GET(MRTCDT)
SET STOP=$GET(STOP)
SET APTYP=$GET(APTYP)
SET PATSTAT=$GET(PATSTAT)
+3 SET MULTAPTMDE=$GET(MULTAPTMDE)
SET PARENT=$GET(PARENT)
SET NLT=$GET(NLT)
SET PRER=$GET(PRER)
SET ORDN=$GET(ORDN)
SET VAOSGUID=$GET(VAOSGUID)
+4 SET EAS=$GET(EAS)
SET PCMT=$GET(PCMT)
SET INSTIEN=$GET(INSTIEN)
SET ARSTOPSEC=$GET(ARSTOPSEC)
SET MODALITY=$GET(MODALITY)
+5 IF '$DATA(PATDATEPREFS)
SET PATDATEPREFS=""
+6 ; Because of an SAC limitation on the number of chars per line, addition of more parameters will require
+7 ; this to be changed over to passing an array.
+8 DO ARSET^SDESAPTREQSET(.JSON,ARIEN,DFN,EDT,INST,TYPE,CLIN,USER,REQBY,PROV,DAPTDT,COMM,ENPRI,MAR,MAI,AMRAN,PATCONT,SVCCON,SVCCOP,MRTCDT,STOP,APTYP,PATSTAT,MULTAPTMDE,PARENT,NLT,PRER,ORDN,VAOSGUID,EAS,PCMT,INSTIEN,.PATDATEPREFS,ARSTOPSEC,MODALITY
)
+9 QUIT
+10 ; Appointment Request Create/Edit
+11 ; SD*5.3*806
APTREQ44CRT(JSON,ARIEN,DFN,ARDAPTDT,ARLEN,ARRSN,ARUSER,ARODT,PATELG,AROVB) ; Create Appointment in #44
+1 NEW ARUPD
+2 SET ARUPD=0
+3 DO ARSET44
+4 QUIT
APTREQ44EDIT(JSON,ARIEN,DFN,ARDAPTDT,ARLEN,ARRSN,ARUSER,ARODT,PATELG,AROVB) ; Edit Appointment in #44
+1 NEW ARUPD
+2 SET ARUPD=1
+3 DO ARSET44
+4 QUIT
APTREQ40984CRT(JSON,SDAPTSTDTTM,SDAPTEDTTM,SDPATDFN,SDRESOURCE,SDATYPID,SDDDTTM,SDEXTID,SDAPTREQTYP,SDPROVIEN,SDCLNID,SDNOTE,SDAPTYP,SDEESTAT,SDAPTLEN,SDEAS) ; Create Appointment in #409.84
+1 DO ARSET^SDESAPPTREQ40984(.JSON,$GET(SDAPTSTDTTM),$GET(SDAPTEDTTM),$GET(SDPATDFN),$GET(SDRESOURCE),$GET(SDATYPID),$GET(SDDDTTM),$GET(SDEXTID),$GET(SDAPTREQTYP),$GET(SDPROVIEN),$GET(SDCLNID),...
... $GET(SDNOTE),$GET(SDAPTYP),$GET(SDEESTAT),$GET(SDAPTLEN),$GET(SDEAS))
+2 QUIT
APTREQ40984EDIT(JSON,SDECAPTID,SDECNOTE,SDECLEN) ;Edit Appointment in SDEC APPOINTMENT File #409.84 - RPC: SDES EDIT APPT #409.84
+1 DO EDITAPPT^SDESAPPTEDIT(.JSON,$GET(SDECAPTID),$GET(SDECNOTE),$GET(SDECLEN))
+2 QUIT
ARSET44 ; Create/Edit Appointment in #44
+1 DO ARSET^SDESAPTREQ44(.JSON,$GET(ARUPD),$GET(ARIEN),$GET(DFN),$GET(ARDAPTDT),$GET(ARLEN),$GET(ARRSN),$GET(ARUSER),$GET(ARODT),$GET(PATELG),$GET(AROVB))
+2 QUIT
ARCANCEL44(RETURN,SDDFN,SDCLNIEN,SDARDTTM) ; RPC: SDES CANCEL APPT #44
+1 DO ARCANCEL44^SDESCANCELAPPT44(.RETURN,$GET(SDDFN),$GET(SDCLNIEN),$GET(SDARDTTM))
QUIT
APTREQ2CRT(JSON,SDPATIENTDFN,SDCLNIEN,SDAPPTDTTM,SDLABDTTM,SDXRAYDTTM,SDEKGDTTM,SDVSTPURP,SDAPPTTYPE,SDCOLLATERAL,SDSCHREQTYPE,SDNXTAVAAPPT,SDFOLLOWUP) ; Create Appointment in #2
+1 NEW SDAPPTUPD
+2 SET SDAPPTUPD=0
+3 DO ARSET2
+4 QUIT
APTREQ2EDIT(JSON,SDPATIENTDFN,SDCLNIEN,SDAPPTDTTM,SDLABDTTM,SDXRAYDTTM,SDEKGDTTM,SDVSTPURP,SDAPPTTYPE,SDCOLLATERAL,SDSCHREQTYPE,SDNXTAVAAPPT,SDFOLLOWUP) ; Edit Appointment in #2
+1 NEW SDAPPTUPD
+2 SET SDAPPTUPD=1
+3 DO ARSET2
+4 QUIT
ARSET2 ; Create/Edit Appointment in #2
+1 DO ARSET^SDESAPPTREQ2(.JSON,$GET(SDAPPTUPD),$GET(SDPATIENTDFN),$GET(SDCLNIEN),$GET(SDAPPTDTTM),$GET(SDLABDTTM),$GET(SDXRAYDTTM),$GET(SDEKGDTTM),$GET(SDVSTPURP),$GET(SDAPPTTYPE),$GET(SDCOLLATERAL),$GET(SDSCHREQTYPE),$GET(SDNXTAVAAPPT),...
... $GET(SDFOLLOWUP))
+2 QUIT
ARCANCEL2(RETURN,SDPATIENTDFN,SDCLNIEN,SDCANCELTYP,SDAPPTDTTM,SDCANCELDTTM,SDUSR,SDCANCELREASON,SDCANCELRMKS) ; RPC: SDES CANCEL APPT #2
+1 DO ARCANCEL2^SDESCANCELAPPT2(.RETURN,$GET(SDPATIENTDFN),$GET(SDCLNIEN),$GET(SDCANCELTYP),$GET(SDAPPTDTTM),$GET(SDCANCELDTTM),$GET(SDUSR),$GET(SDCANCELREASON),$GET(SDCANCELRMKS))
QUIT
+2 ;
CANCELAPPT(SDECY,APPTIEN,STATUS,CANREAS,USER,EAS) ;SDES CANCEL APPT - cancel appointment
+1 DO CANCELAPPT^SDESCANCELAPPT(.SDECY,$GET(APPTIEN),$GET(STATUS),$GET(CANREAS),$GET(USER),$GET(EAS))
QUIT
+2 ;
CHECKIN(JSON,SDECAPTID,SDECCDT,SDECCC,SDECPRV) ;SDES APPT CHECKIN JSON
+1 DO CHECKIN^SDES25(.JSON,$GET(SDECAPTID),$GET(SDECCDT),$GET(SDECCC),$GET(SDECPRV))
QUIT
+2 ;
+3 ;The parameter list for the clinic create and set use generic parameter names to ensure we stay in SAC compliance
+4 ;with the length of a single line.
CLINICCREATE(RET,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44) ;
+1 ;CLINICCREATE(RET,CLINIEN,R1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29) ;
+2 ;There will never be an IEN when calling this RPC
SET CLINIEN=""
+3 DO CLINICSET
QUIT
CLINICSET ;Called from CLINICCREATE and CLINICUPDATE tags
+1 SET P1=$GET(P1)
SET P2=$GET(P2)
SET P3=$GET(P3)
SET P4=$GET(P4)
SET P5=$GET(P5)
SET P6=$GET(P6)
SET P7=$GET(P7)
SET P8=$GET(P8)
SET P9=$GET(P9)
SET P10=$GET(P10)
SET P11=$GET(P11)
SET P12=$GET(P12)
SET P13=$GET(P13)
SET P14=$GET(P14)
SET P15=$GET(P15)
SET P16=$GET(P16)
SET P17=$GET(P17)
+2 SET P18=$GET(P18)
SET P19=$GET(P19)
SET P20=$GET(P20)
SET P21=$GET(P21)
SET P22=$GET(P22)
SET P23=$GET(P23)
+3 SET P24=$GET(P24)
SET P25=$GET(P25)
SET P26=$GET(P26)
SET P27=$GET(P27)
SET P28=$GET(P28)
SET P29=$GET(P29)
SET P30=$GET(P30)
SET P31=$GET(P31)
SET P32=$GET(P32)
SET P33=$GET(P33)
SET P34=$GET(P34)
SET P35=$GET(P35)
SET P36=$GET(P36)
SET P37=$GET(P37)
SET P38=$GET(P38)
SET P39=$GET(P39)
SET P40=$GET(P40)
+4 SET P41=$GET(P41)
SET P42=$GET(P42)
SET P43=$GET(P43)
SET P44=$GET(P44)
+5 DO CLINICSET^SDESCLINICSET(.RET,CLINIEN,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44)
+6 QUIT
+7 ;
CLINICSEARCH(SDECY,SEARCHSTRING) ;Given a search string return a clinic list that matches.
+1 DO CLINICSEARCH^SDESSEARCH(.SDECY,$GET(SEARCHSTRING))
QUIT
CLINICRSCSEARCH(SDECY,SEARCHSTRING) ;Given a search string return a clinic list that matches.
+1 DO CLINICRSC^SDES01C(.SDECY,$GET(SEARCHSTRING))
QUIT
CREATEAPPTWRAPPR(JSONRETURN,APPTARRAY) ; SDES CREATE APPOINTMENTS ;Create appts in Files #409.84, #44, and #2.
+1 DO CREATEAPPTS^SDESCRTAPPTWRAP(.JSONRETURN,.APPTARRAY)
QUIT
GETREGA(SDECY,DFN,EAS) ;SDES GET REGISTRATION INFO
+1 DO GETREGA^SDESGETREGA(.SDECY,$GET(DFN),$GET(EAS))
QUIT
INSURVERIFYREQ(JSON,DFN,EAS) ;SDES GET INSRUANCE VERIFY REQ
+1 DO INSURVERIFYREQ^SDESPATRPC(.JSON,$GET(DFN),$GET(EAS))
QUIT
INSURINDICATORS(RETURN,DFNS) ;SDES GET INSURANCE VERIFY LIST
+1 DO INSURINDICATORS^SDESPATRPC(.RETURN,.DFNS)
QUIT
SPACEBAR(SDECY,SDECDIC,SDECVAL) ;EP Update ^DISV with most recent lookup value SDECVAL from file SDECDIC
+1 DO SPACEBAR^SDES30(.SDECY,$GET(SDECDIC),$GET(SDECVAL))
QUIT
JSONINACTCLN(SDEC,CLINICIEN,EAS) ;EP RPC: SDES INACTIVATE CLINIC
+1 DO JSONINACTCLN^SDESINACTCLINIC(.SDEC,$GET(CLINICIEN),$GET(EAS))
QUIT
JSONCLNINFO(SDEC,CLINICIEN,EAS) ;EP RPC: SDES GET CLINIC INFO
+1 DO JSONCLNINFO^SDESRTVCLN(.SDEC,$GET(CLINICIEN),$GET(EAS))
QUIT
SETCLINAVAIL(RETURN,SDCLINIC,DATES,TIMES,SLOTS,SDEAS) ; RPC: SDES SET CLINIC AVAILABILITY
+1 DO SETCLINAVAIL^SDESCLNSETAVAIL(.RETURN,$GET(SDCLINIC),$GET(DATES),$GET(TIMES),$GET(SLOTS),$GET(SDEAS))
QUIT
GETCLNAVAILABLTY(RET,CLINICIEN,SDESSTART,SDESENDDATE,EAS) ;EP RPC: SDES GET CLINIC AVAILABILITY-retrieve clinic availablity in a given timeframe
+1 DO GETCLAVAILABLTY^SDESCLINICAVAIL(.RET,$GET(CLINICIEN),$GET(SDESSTART),$GET(SDESENDDATE),$GET(EAS))
QUIT
CANCLNAVAILABLTY(RET,SDCLNIEN,SDESCANDATE,SDESSTRTIM,SDESENDTIM,SDCANREM,SDEAS) ;Called from RPC: SDES CANCEL CLINIC AVAILABILITY
+1 DO CANCLAVAIL^SDESCCAVAIL(.RET,$GET(SDCLNIEN),$GET(SDESCANDATE),$GET(SDESSTRTIM),$GET(SDESENDTIM),$GET(SDCANREM),$GET(SDEAS))
QUIT
GETALLAPPTS(SDECY,DFN) ; SDES GET PATIENT APPTS BY DFN #2
+1 DO GETALLAPPTS^SDESGETPATAPPT(.SDECY,$GET(DFN))
QUIT
GETSINGLEAPPT(SDECY,DFN,DATETIME,CLINIC) ; SDES GET PATIENT APPT BY IEN #2
+1 DO GETSINGLEAPPT^SDESGETPATAPPT(.SDECY,$GET(DFN),$GET(DATETIME),$GET(CLINIC))
QUIT
GETUSRDTL(RET,SDSECID,EAS) ;Called from RPC: SDES GET USER PROFILE
+1 DO GETUSRDTL^SDESGETUD(.RET,$GET(SDSECID),$GET(EAS))
QUIT
GETUSRDTLDUZ(RET,SDUSRIEN,EAS) ;Called from RPC: SDES GET USER PROFILE BY DUZ
+1 DO GETUSRDTLDUZ^SDESGETUD(.RET,$GET(SDUSRIEN),$GET(EAS))
QUIT
UPDRECALLREQ(RETN,RECALLIEN,DFN,ACCNO,SDCMT,FASTING,APPTP,RRPROVIEN,CLINIEN,APPTLEN,DATE,RECPPDT,DAPTDT,USERIEN,SECPDT,EAS) ;update recall request
+1 DO UPDRECALLREQ^SDESUPDRECREQ(.RETN,$GET(RECALLIEN),$GET(DFN),$GET(ACCNO),$GET(SDCMT),$GET(FASTING),$GET(APPTP),$GET(RRPROVIEN),$GET(CLINIEN),$GET(APPTLEN),$GET(DATE),$GET(RECPPDT),$GET(DAPTDT),$GET(USERIEN),$GET(SECPDT),$GET(EAS))
QUIT
CREATERECREQ(RETN,DFN,ACCNO,SDCMT,FASTING,APPTP,RRPROVIEN,CLINIEN,APPTLEN,DATE,RECPPDT,DAPTDT,USERIEN,SECPDT,SDENTDT,EAS) ;update recall request
+1 DO CREATERECREQ^SDESUPDRECREQ(.RETN,$GET(DFN),$GET(ACCNO),$GET(SDCMT),$GET(FASTING),$GET(APPTP),$GET(RRPROVIEN),$GET(CLINIEN),$GET(APPTLEN),$GET(DATE),$GET(RECPPDT),$GET(DAPTDT),$GET(USERIEN),$GET(SECPDT),$GET(SDENTDT),$GET(EAS))
QUIT
DISPRECALL(SDECY,RECALLIEN,REASON,COMMENT,EAS) ; for a PtCSch request, set disposition reason and DELETE an entry from the RECALL REMINDERS file 403.5
+1 DO DISPRECALL^SDESDISPRECALL(.SDECY,$GET(RECALLIEN),$GET(REASON),$GET(COMMENT),$GET(EAS))
QUIT
GETAPPOINTMENTS(SDECY,SDCLIN,SDSTDTTM,SDENDDTTM) ;get appointments for clinic out of file 44
+1 DO GETAPPOINTMENTS^SDESGETCLINAPPT(.SDECY,$GET(SDCLIN),$GET(SDSTDTTM),$GET(SDENDDTTM))
QUIT
GETSTOPCODE(SDECY,SDSTCD) ;get stop code details out of file 40.7
+1 DO GETSTCDDTL^SDESGETSTOPCODE(.SDECY,$GET(SDSTCD))
QUIT
GETPATCHNUM(SDECY) ; get latest SD patch number installed on system
+1 DO GETPATCHNUM^SDESPATCHINFO(.SDECY)
QUIT
GETMISSIONELG(SDECY,APPTREQIEN,PID,APPTREQTYP,SDEAS,APPTDATE,CLINIEN) ;
+1 DO GETMISSIONELG^SDESMISSIONELG(.SDECY,$GET(APPTREQIEN),$GET(PID),$GET(APPTREQTYP),$GET(SDEAS),$GET(APPTDATE),$GET(CLINIEN))
QUIT
PRINTPATAPPTS(SDECY,SDDFN,SDBEGIN,SDEND,EAS) ;print patient friend appointments
+1 if $GET(SDBEGIN)'=""
SET SDBEGIN=$$ISOTFM^SDAMUTDT(SDBEGIN)
+2 if $GET(SDEND)'=""
SET SDEND=$$ISOTFM^SDAMUTDT(SDEND)
+3 if $GET(SDBEGIN)=""
SET SDBEGIN=$$NOW^XLFDT
+4 if $GET(SDEND)=""
SET SDEND=$$FMADD^XLFDT(SDBEGIN,90)
+5 DO PRINTPATAPPTS^SDESPRINTPATAPPT(.SDECY,$GET(SDDFN),$GET(SDBEGIN),$GET(SDEND),$GET(EAS))
QUIT
+6 QUIT
+7 ;Based on Patient DFN, retrieve and return all appointments associated with a Patient IEN from SDEC APPOINTMENT File #409.84,
+8 ;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPDFN(SDECY,SDDFN,SDBEGIN,SDEND) ;Called from RPC: SDES GET APPTS BY PATIENT DFN
+1 NEW SDVIEWAPPTBY
+2 SET SDVIEWAPPTBY=0
+3 DO GETAPPTS^SDESGETAPPTWRAP(.SDECY,$GET(SDDFN),$GET(SDBEGIN),$GET(SDEND))
+4 QUIT
+5 ;Based on CLINIC IEN, retrieve and return all appointments associated with a Clinic IEN from SDEC APPOINTMENT File #409.84,
+6 ;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPCLIN(SDECY,SDCLINIEN,SDBEGIN,SDEND) ;Called from RPC: SDES GET APPTS BY CLIN IEN
+1 NEW SDVIEWAPPTBY
+2 SET SDVIEWAPPTBY=1
+3 DO GETAPPTS^SDESGETAPPTWRAP(.SDECY,$GET(SDCLINIEN),$GET(SDBEGIN),$GET(SDEND))
+4 QUIT
+5 ;Based on APPOINTMENT IEN, retrieve and return all appointments associated with Appointment IEN from SDEC APPOINTMENT File #409.84,
+6 ;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
GETAPPTWRAPIEN(SDECY,SDAPPTIEN,SDEAS) ;;Called from RPC: SDES GET APPTS BY IEN
+1 DO GETAPPTBYIEN^SDESGETAPPTWRAP2(.SDECY,$GET(SDAPPTIEN),$GET(SDEAS))
+2 QUIT
+3 ;Based on Patient DFN, retrieve and return all appointments associated with a Patient IEN from SDEC APPOINTMENT File #409.84,
+4 ;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
+5 ;This is a clone from SDES GET APPTS BY PATIENT DFN
GETAPPTWRAPDFN2(SDECY,SDDFN,SDBEGIN,SDEND,SDEAS) ;Called from RPC: SDES GET APPTS BY PATIENT DFN2
+1 DO GETAPPTBYPATDFN^SDESGETAPPTWRAP2(.SDECY,$GET(SDDFN),$GET(SDBEGIN),$GET(SDEND),$GET(SDEAS))
+2 QUIT
+3 ;Based on CLINIC IEN, retrieve and return all appointments associated with a Clinic IEN from SDEC APPOINTMENT File #409.84,
+4 ;HOSPITAL LOCATION File #44, and the Appointment Multiple Patient File #2
+5 ;This is a clone from SDES GET APPTS BY CLIN IEN
GETAPPTWRAPCLIN2(SDECY,SDCLINIEN,SDBEGIN,SDEND,SDEAS) ;;Called from RPC: SDES GET APPTS BY CLIN IEN 2
+1 DO GETAPPTBYCLNIEN^SDESGETAPPTWRAP2(.SDECY,$GET(SDCLINIEN),$GET(SDBEGIN),$GET(SDEND),$GET(SDEAS))
+2 QUIT
+3 ; get appointment request wrapper
GETREQLISTBYDFN(JSONRETURN,DFN,EAS) ; SDES GET APPT REQ LIST BY DFN
+1 DO GETREQLISTBYDFN^SDESGETREQWRAPPR(.JSONRETURN,$GET(DFN),$GET(EAS))
QUIT
GETREQBYREQIEN(JSONRETURN,REQUESTIEN,EAS) ;SDES GET APPT REQ BY IEN
+1 DO GETREQBYREQIEN^SDESGETAPPTREQ(.JSONRETURN,$GET(REQUESTIEN),$GET(EAS))
QUIT
GETREQSBYDFN(JSONRETURN,DFN,EAS) ;SDES PATIENT APPT REQ BY DFN
+1 DO GETREQSBYDFN^SDESGETAPPTREQ(.JSONRETURN,$GET(DFN),$GET(EAS))
QUIT
GETCONSULTBYIEN(JSONRETURN,CONSULTIEN,EAS) ;SDES GET CONSULTS BY IEN
+1 DO GETCONSULTBYIEN^SDESGETCONSULTS(.JSONRETURN,$GET(CONSULTIEN),$GET(EAS))
QUIT
GETCONSULTSBYDFN(JSONRETURN,DFN,EAS) ;SDES GET CONSULTS BY DFN
+1 DO GETCONSULTSBYDFN^SDESGETCONSULTS(.JSONRETURN,$GET(DFN),$GET(EAS))
QUIT
GETRECALLBYIEN(JSONRETURN,RECALLIEN,EAS) ;SDES GET RECALLS BY IEN
+1 DO GETRECALLBYIEN^SDESGETRECALL(.JSONRETURN,$GET(RECALLIEN),$GET(EAS))
QUIT
GETRECALLSBYDFN(JSONRETURN,DFN,EAS) ; SDES GET RECALLS BY DFN
+1 DO GETRECALLSBYDFN^SDESGETRECALL(.JSONRETURN,$GET(DFN),$GET(EAS))
QUIT
+2 ;GETREQBYAPPTIEN(JSONRETURN,APPTIEN,EAS) ;SDES GET APPT REQ BY APPT IEN
+3 ;D GETREQBYAPPTIEN^SDESGETAPPTREQ(.JSONRETURN,$G(APPTIEN),$G(EAS)) Q ;
+4 ;
CANCELAPPTS(JSONRETURN,APPTIEN,CLINICIEN,DFN,CANBYCLINORPAT,CANCELREASONIEN,NOTE,CANCELHASH,EAS) ;
+1 ;
DO CANCELAPPTS^SDESCANCELAPPTS(.JSONRETURN,$GET(APPTIEN),$GET(CLINICIEN),$GET(DFN),$GET(CANBYCLINORPAT),$GET(CANCELREASONIEN),$GET(NOTE),$GET(CANCELHASH),$GET(EAS))
+2 QUIT
+3 ;
ADDUSR(JSONRETURN,LOCIEN,USRIEN) ;ADD PRIV USER
+1 DO UPDPRIV^SDESLOC(.JSONRETURN,1,$GET(LOCIEN),$GET(USRIEN))
QUIT
RMVUSR(JSONRETURN,LOCIEN,USRIEN) ; DELETE PRIV USER
+1 DO UPDPRIV^SDESLOC(.JSONRETURN,0,$GET(LOCIEN),$GET(USRIEN))
QUIT
RMVAUSR(JSONRETURN,LOCIEN) ; DELETE ALL USERS FROM #44
+1 DO RMVALLUSR^SDESLOC(.JSONRETURN,$GET(LOCIEN))
QUIT
RTNAUSR(JSONRETURN,LOCIEN) ; READ ALL USERS FROM #44
+1 DO RTNALLUSR^SDESLOC(.JSONRETURN,$GET(LOCIEN))
QUIT
+2 ;