SDES2BLDAPPT2 ;ALB/LAB - VISTA SCHEDULING BUILDING APPT OBJECT FROM PATIENT ;JAN 15, 2024
;;5.3;Scheduling;**871**;Aug 13, 1993;Build 13
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
GET2INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT) ;
S APPTOBJ("Appointment",RECCNT,"Patient","DFN")=SDDFN
S APPTOBJ("Appointment",RECCNT,"Patient","ICN")=$$GETPATICN^SDESINPUTVALUTL(SDDFN)
S APPTOBJ("Appointment",RECCNT,"Patient","SSN")=$$LAST4SSN^SDESINPUTVALUTL(SDDFN)
S APPTOBJ("Appointment",RECCNT,"Patient","DateOfBirth")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDDFN_",",.03,"I"))
S APPTOBJ("Appointment",RECCNT,"Patient","DateOfDeath")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDDFN_",",.351,"I"))
S APPTOBJ("Appointment",RECCNT,"Patient","EligibilityIEN")=$$GET1^DIQ(2,SDDFN_",",.361,"I")
S APPTOBJ("Appointment",RECCNT,"Patient","Name")=$$GET1^DIQ(2,SDDFN_",",.01,"E")
S APPTOBJ("Appointment",RECCNT,"Patient","Street")=$$GET1^DIQ(2,SDDFN_",",.111,"E")
Q
;
GET298INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT,CLINIEN) ;
N INCLUDEPAT,PATIENS,ARRAY298,ERR
D CHECKSTATUS(.INCLUDEPAT,SDDFN,APPTIEN,APPTOBJ("Appointment",RECCNT,"StartTimeFM")) ;need to know whether to include PatientAppointment information
S APPTOBJ("Appointment",RECCNT,"OverLaidAppointmentData")=$S(INCLUDEPAT=1:"NO",1:"YES")
I INCLUDEPAT=0 D BLANK298(.APPTOBJ) Q
S PATIENS=APPTOBJ("Appointment",RECCNT,"StartTimeFM")_","_SDDFN_","
D GETS^DIQ(2.98,PATIENS,"**","IE","ARRAY298","ERR")
S APPTOBJ("Appointment",RECCNT,"AppointmentTypeSubCategory")=$G(ARRAY298(2.98,PATIENS,24,"E"))
S APPTOBJ("Appointment",RECCNT,"AutoRebookedApptDateTime")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,12,"I")))
S APPTOBJ("Appointment",RECCNT,"CancellationRemarks")=$G(ARRAY298(2.98,PATIENS,17,"E"))
S APPTOBJ("Appointment",RECCNT,"CollateralVisit")=$G(ARRAY298(2.98,PATIENS,13,"E"))
S APPTOBJ("Appointment",RECCNT,"EkgDateTime")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,7,"I")),CLINIEN)
S APPTOBJ("Appointment",RECCNT,"EncounterConversionStatus")=$G(ARRAY298(2.98,PATIENS,23.1,"E"))
S APPTOBJ("Appointment",RECCNT,"EncounterFormsAsAddOns")=$G(ARRAY298(2.98,PATIENS,23,"E"))
S APPTOBJ("Appointment",RECCNT,"EncounterFormsPrinted")=$G(ARRAY298(2.98,PATIENS,22,"E"))
S APPTOBJ("Appointment",RECCNT,"FollowUpVisit")=$G(ARRAY298(2.98,PATIENS,28,"E"))
S APPTOBJ("Appointment",RECCNT,"LabDateTime")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,5,"I")),CLINIEN)
S APPTOBJ("Appointment",RECCNT,"NextAvaApptIndicator")=$G(ARRAY298(2.98,PATIENS,26,"E"))
S APPTOBJ("Appointment",RECCNT,"NoShowCancelDateTime")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,15,"I")))
S APPTOBJ("Appointment",RECCNT,"NoShowCancelledBy")=$G(ARRAY298(2.98,PATIENS,14,"E"))
S APPTOBJ("Appointment",RECCNT,"NumberOfCollateralSeen")=$G(ARRAY298(2.98,PATIENS,11,"E"))
S APPTOBJ("Appointment",RECCNT,"OutpatientEncounter")=$$FMTISO^SDAMUTDT($$GET1^DIQ(409.68,$G(ARRAY298(2.98,PATIENS,21,"I")),.01,"I"))
S APPTOBJ("Appointment",RECCNT,"PurposeOfVisit")=$G(ARRAY298(2.98,PATIENS,9,"E"))
S APPTOBJ("Appointment",RECCNT,"RealAppointment")=$G(ARRAY298(2.98,PATIENS,4,"E"))
S APPTOBJ("Appointment",RECCNT,"RoutingSlipPrintDate")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,8.5,"I")))
S APPTOBJ("Appointment",RECCNT,"RoutingSlipPrinted")=$G(ARRAY298(2.98,PATIENS,8,"E"))
S APPTOBJ("Appointment",RECCNT,"SchedulerName")=$G(ARRAY298(2.98,PATIENS,30,"E"))
S APPTOBJ("Appointment",RECCNT,"SchedulingApplication")=$G(ARRAY298(2.98,PATIENS,29,"I"))
S APPTOBJ("Appointment",RECCNT,"SchedulingRequestType")=$G(ARRAY298(2.98,PATIENS,25,"E"))
S APPTOBJ("Appointment",RECCNT,"SpecialSurveyDisposition")=$G(ARRAY298(2.98,PATIENS,10,"E"))
S:APPTOBJ("Appointment",RECCNT,"Status")="" APPTOBJ("Appointment",RECCNT,"Status")=APPTOBJ("Appointment",RECCNT,"CurrentStatus")
S APPTOBJ("Appointment",RECCNT,"InpatientFlag")=$S($G(ARRAY298(2.98,PATIENS,3,"I"))="I":1,1:0)
S APPTOBJ("Appointment",RECCNT,"XrayDateTime")=$$FMTISO^SDAMUTDT($G(ARRAY298(2.98,PATIENS,6,"I")),CLINIEN)
Q
;
BLANK298(APPTOBJ) ;if overlaid appointment, send empty fields
S APPTOBJ("Appointment",RECCNT,"InpatientFlag")=""
S APPTOBJ("Appointment",RECCNT,"AppointmentType")=""
S APPTOBJ("Appointment",RECCNT,"AppointmentTypeSubCategory")=""
S APPTOBJ("Appointment",RECCNT,"AutoRebookedApptDateTime")=""
S APPTOBJ("Appointment",RECCNT,"CancellationRemarks")=""
S APPTOBJ("Appointment",RECCNT,"CollateralVisit")=""
S APPTOBJ("Appointment",RECCNT,"EkgDateTime")=""
S APPTOBJ("Appointment",RECCNT,"EncounterConversionStatus")=""
S APPTOBJ("Appointment",RECCNT,"EncounterFormsAsAddOns")=""
S APPTOBJ("Appointment",RECCNT,"EncounterFormsPrinted")=""
S APPTOBJ("Appointment",RECCNT,"FollowUpVisit")=""
S APPTOBJ("Appointment",RECCNT,"LabDateTime")=""
S APPTOBJ("Appointment",RECCNT,"NextAvaApptIndicator")=""
S APPTOBJ("Appointment",RECCNT,"NoShowCancelDateTime")=""
S APPTOBJ("Appointment",RECCNT,"NoShowCancelledBy")=""
S APPTOBJ("Appointment",RECCNT,"NumberOfCollateralSeen")=""
S APPTOBJ("Appointment",RECCNT,"OutpatientEncounter")=""
S APPTOBJ("Appointment",RECCNT,"PurposeOfVisit")=""
S APPTOBJ("Appointment",RECCNT,"RealAppointment")=""
S APPTOBJ("Appointment",RECCNT,"RoutingSlipPrintDate")=""
S APPTOBJ("Appointment",RECCNT,"RoutingSlipPrinted")=""
S APPTOBJ("Appointment",RECCNT,"SchedulerName")=""
S APPTOBJ("Appointment",RECCNT,"SchedulingApplication")=""
S APPTOBJ("Appointment",RECCNT,"SchedulingRequestType")=""
S APPTOBJ("Appointment",RECCNT,"SpecialSurveyDisposition")=""
S APPTOBJ("Appointment",RECCNT,"XrayDateTime")=""
Q
;
CHECKSTATUS(INCLUDEPAT,SDDFN,APPTIEN,APPTDTTM) ;
S INCLUDEPAT=$O(^SDEC(409.84,"APTDT",SDDFN,APPTDTTM,APPTIEN))
S:INCLUDEPAT'="" INCLUDEPAT=0 ;Patient appointment was overlaid with new appointment
S:INCLUDEPAT="" INCLUDEPAT=1
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2BLDAPPT2 5852 printed Apr 09, 2024@21:40:47 Page 2
SDES2BLDAPPT2 ;ALB/LAB - VISTA SCHEDULING BUILDING APPT OBJECT FROM PATIENT ;JAN 15, 2024
+1 ;;5.3;Scheduling;**871**;Aug 13, 1993;Build 13
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
GET2INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT) ;
+1 SET APPTOBJ("Appointment",RECCNT,"Patient","DFN")=SDDFN
+2 SET APPTOBJ("Appointment",RECCNT,"Patient","ICN")=$$GETPATICN^SDESINPUTVALUTL(SDDFN)
+3 SET APPTOBJ("Appointment",RECCNT,"Patient","SSN")=$$LAST4SSN^SDESINPUTVALUTL(SDDFN)
+4 SET APPTOBJ("Appointment",RECCNT,"Patient","DateOfBirth")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDDFN_",",.03,"I"))
+5 SET APPTOBJ("Appointment",RECCNT,"Patient","DateOfDeath")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDDFN_",",.351,"I"))
+6 SET APPTOBJ("Appointment",RECCNT,"Patient","EligibilityIEN")=$$GET1^DIQ(2,SDDFN_",",.361,"I")
+7 SET APPTOBJ("Appointment",RECCNT,"Patient","Name")=$$GET1^DIQ(2,SDDFN_",",.01,"E")
+8 SET APPTOBJ("Appointment",RECCNT,"Patient","Street")=$$GET1^DIQ(2,SDDFN_",",.111,"E")
+9 QUIT
+10 ;
GET298INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT,CLINIEN) ;
+1 NEW INCLUDEPAT,PATIENS,ARRAY298,ERR
+2 ;need to know whether to include PatientAppointment information
DO CHECKSTATUS(.INCLUDEPAT,SDDFN,APPTIEN,APPTOBJ("Appointment",RECCNT,"StartTimeFM"))
+3 SET APPTOBJ("Appointment",RECCNT,"OverLaidAppointmentData")=$SELECT(INCLUDEPAT=1:"NO",1:"YES")
+4 IF INCLUDEPAT=0
DO BLANK298(.APPTOBJ)
QUIT
+5 SET PATIENS=APPTOBJ("Appointment",RECCNT,"StartTimeFM")_","_SDDFN_","
+6 DO GETS^DIQ(2.98,PATIENS,"**","IE","ARRAY298","ERR")
+7 SET APPTOBJ("Appointment",RECCNT,"AppointmentTypeSubCategory")=$GET(ARRAY298(2.98,PATIENS,24,"E"))
+8 SET APPTOBJ("Appointment",RECCNT,"AutoRebookedApptDateTime")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,12,"I")))
+9 SET APPTOBJ("Appointment",RECCNT,"CancellationRemarks")=$GET(ARRAY298(2.98,PATIENS,17,"E"))
+10 SET APPTOBJ("Appointment",RECCNT,"CollateralVisit")=$GET(ARRAY298(2.98,PATIENS,13,"E"))
+11 SET APPTOBJ("Appointment",RECCNT,"EkgDateTime")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,7,"I")),CLINIEN)
+12 SET APPTOBJ("Appointment",RECCNT,"EncounterConversionStatus")=$GET(ARRAY298(2.98,PATIENS,23.1,"E"))
+13 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsAsAddOns")=$GET(ARRAY298(2.98,PATIENS,23,"E"))
+14 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsPrinted")=$GET(ARRAY298(2.98,PATIENS,22,"E"))
+15 SET APPTOBJ("Appointment",RECCNT,"FollowUpVisit")=$GET(ARRAY298(2.98,PATIENS,28,"E"))
+16 SET APPTOBJ("Appointment",RECCNT,"LabDateTime")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,5,"I")),CLINIEN)
+17 SET APPTOBJ("Appointment",RECCNT,"NextAvaApptIndicator")=$GET(ARRAY298(2.98,PATIENS,26,"E"))
+18 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelDateTime")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,15,"I")))
+19 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelledBy")=$GET(ARRAY298(2.98,PATIENS,14,"E"))
+20 SET APPTOBJ("Appointment",RECCNT,"NumberOfCollateralSeen")=$GET(ARRAY298(2.98,PATIENS,11,"E"))
+21 SET APPTOBJ("Appointment",RECCNT,"OutpatientEncounter")=$$FMTISO^SDAMUTDT($$GET1^DIQ(409.68,$GET(ARRAY298(2.98,PATIENS,21,"I")),.01,"I"))
+22 SET APPTOBJ("Appointment",RECCNT,"PurposeOfVisit")=$GET(ARRAY298(2.98,PATIENS,9,"E"))
+23 SET APPTOBJ("Appointment",RECCNT,"RealAppointment")=$GET(ARRAY298(2.98,PATIENS,4,"E"))
+24 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrintDate")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,8.5,"I")))
+25 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrinted")=$GET(ARRAY298(2.98,PATIENS,8,"E"))
+26 SET APPTOBJ("Appointment",RECCNT,"SchedulerName")=$GET(ARRAY298(2.98,PATIENS,30,"E"))
+27 SET APPTOBJ("Appointment",RECCNT,"SchedulingApplication")=$GET(ARRAY298(2.98,PATIENS,29,"I"))
+28 SET APPTOBJ("Appointment",RECCNT,"SchedulingRequestType")=$GET(ARRAY298(2.98,PATIENS,25,"E"))
+29 SET APPTOBJ("Appointment",RECCNT,"SpecialSurveyDisposition")=$GET(ARRAY298(2.98,PATIENS,10,"E"))
+30 if APPTOBJ("Appointment",RECCNT,"Status")=""
SET APPTOBJ("Appointment",RECCNT,"Status")=APPTOBJ("Appointment",RECCNT,"CurrentStatus")
+31 SET APPTOBJ("Appointment",RECCNT,"InpatientFlag")=$SELECT($GET(ARRAY298(2.98,PATIENS,3,"I"))="I":1,1:0)
+32 SET APPTOBJ("Appointment",RECCNT,"XrayDateTime")=$$FMTISO^SDAMUTDT($GET(ARRAY298(2.98,PATIENS,6,"I")),CLINIEN)
+33 QUIT
+34 ;
BLANK298(APPTOBJ) ;if overlaid appointment, send empty fields
+1 SET APPTOBJ("Appointment",RECCNT,"InpatientFlag")=""
+2 SET APPTOBJ("Appointment",RECCNT,"AppointmentType")=""
+3 SET APPTOBJ("Appointment",RECCNT,"AppointmentTypeSubCategory")=""
+4 SET APPTOBJ("Appointment",RECCNT,"AutoRebookedApptDateTime")=""
+5 SET APPTOBJ("Appointment",RECCNT,"CancellationRemarks")=""
+6 SET APPTOBJ("Appointment",RECCNT,"CollateralVisit")=""
+7 SET APPTOBJ("Appointment",RECCNT,"EkgDateTime")=""
+8 SET APPTOBJ("Appointment",RECCNT,"EncounterConversionStatus")=""
+9 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsAsAddOns")=""
+10 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsPrinted")=""
+11 SET APPTOBJ("Appointment",RECCNT,"FollowUpVisit")=""
+12 SET APPTOBJ("Appointment",RECCNT,"LabDateTime")=""
+13 SET APPTOBJ("Appointment",RECCNT,"NextAvaApptIndicator")=""
+14 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelDateTime")=""
+15 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelledBy")=""
+16 SET APPTOBJ("Appointment",RECCNT,"NumberOfCollateralSeen")=""
+17 SET APPTOBJ("Appointment",RECCNT,"OutpatientEncounter")=""
+18 SET APPTOBJ("Appointment",RECCNT,"PurposeOfVisit")=""
+19 SET APPTOBJ("Appointment",RECCNT,"RealAppointment")=""
+20 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrintDate")=""
+21 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrinted")=""
+22 SET APPTOBJ("Appointment",RECCNT,"SchedulerName")=""
+23 SET APPTOBJ("Appointment",RECCNT,"SchedulingApplication")=""
+24 SET APPTOBJ("Appointment",RECCNT,"SchedulingRequestType")=""
+25 SET APPTOBJ("Appointment",RECCNT,"SpecialSurveyDisposition")=""
+26 SET APPTOBJ("Appointment",RECCNT,"XrayDateTime")=""
+27 QUIT
+28 ;
CHECKSTATUS(INCLUDEPAT,SDDFN,APPTIEN,APPTDTTM) ;
+1 SET INCLUDEPAT=$ORDER(^SDEC(409.84,"APTDT",SDDFN,APPTDTTM,APPTIEN))
+2 ;Patient appointment was overlaid with new appointment
if INCLUDEPAT'=""
SET INCLUDEPAT=0
+3 if INCLUDEPAT=""
SET INCLUDEPAT=1
+4 QUIT
+5 ;