SDES2BLDAPPT2 ;ALB/LAB,JAS,LAB - VISTA SCHEDULING BUILDING APPT OBJECT FROM PATIENT ;MAY 15, 2024
;;5.3;Scheduling;**871,877,880**;Aug 13, 1993;Build 5
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
GET2INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT,SDDUZ) ;
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","DateOfBirthInternal")=$$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","Eligibility")=$$GET1^DIQ(2,SDDFN_",",.361,"E")
S APPTOBJ("Appointment",RECCNT,"Patient","FugitiveFelonFlag")=$S($$GET1^DIQ(2,SDDFN_",",1100.01,"I"):"YES",1:"NO")
S APPTOBJ("Appointment",RECCNT,"Patient","Gender")=$$GET1^DIQ(2,SDDFN_",",.02,"E")
S APPTOBJ("Appointment",RECCNT,"Patient","Name")=$$GET1^DIQ(2,SDDFN_",",.01,"E")
S APPTOBJ("Appointment",RECCNT,"Patient","Street")=$$GET1^DIQ(2,SDDFN_",",.111,"E")
N SENSITIVE,NEEDSINS
D SENSITIVE^SDES2UTIL(.SENSITIVE,SDDFN,SDDUZ)
S APPTOBJ("Appointment",RECCNT,"Patient","SensitivePatientRestrictedRecord")=$S($G(SENSITIVE(1)):1,1:0)
S APPTOBJ("Appointment",RECCNT,"Patient","SensitivePatientType")=$G(SENSITIVE(1))
D NEEDVERIFY^SDESPATRPC(.NEEDSINS,SDDFN,180,90)
S APPTOBJ("Appointment",RECCNT,"Patient","NeedInsuranceVerification")=NEEDSINS
D GETREGDT(.APPTOBJ,RECCNT,SDDFN)
D NATIONALFLAG(.APPTOBJ,RECCNT,SDDFN)
D LOCALFLAGS(.APPTOBJ,RECCNT,SDDFN)
Q
;
GETREGDT(APPTOBJ,RECCNT,SDDFN) ;
N ORIGREGIEN,ORIGREGDT,LASTREGIEN,LASTREGDT,DEMODIFF
S DEMODIFF=180
I $D(^DGS(41.41,"B",SDDFN)) D
.S ORIGREGIEN=$O(^DGS(41.41,"B",SDDFN,0))
.S LASTREGIEN=$O(^DGS(41.41,"B",SDDFN,"A"),-1)
.S ORIGREGDT=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,ORIGREGIEN,1,"I"))
.S LASTREGDT=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,LASTREGIEN,1,"I"))
.S DEMODIFF=$$FMDIFF^XLFDT(DT,$$GET1^DIQ(41.41,LASTREGIEN_",",1,"I"))
S APPTOBJ("Appointment",RECCNT,"Patient","OriginalRegistrationDate")=$G(ORIGREGDT)
S APPTOBJ("Appointment",RECCNT,"Patient","LastRegistrationDate")=$G(LASTREGDT)
S APPTOBJ("Appointment",RECCNT,"Patient","DemographicsNeedUpdate")=$S(DEMODIFF>179:1,DEMODIFF<180:0)
Q
;
NATIONALFLAG(APPTOBJ,RECCNT,SDDFN) ;
N PRFDATA,DFNERROR,DFNERRORS,FN,RESNUM,PRFCNT,FIEN,FPTR,PRFARRY,NARR,FDATA
S FN=26.15
D LIST^DIC(26.15,,,"E",,,,,,,"FDATA","ERR")
S (RESNUM,PRFCNT)=0
F S RESNUM=$O(FDATA("DILIST",2,RESNUM)) Q:'RESNUM D
.S FIEN=$G(FDATA("DILIST",2,RESNUM))
.S FPTR=FIEN_";"_$P($$ROOT^DILFD(26.15),U,2)
.K PRFDATA
.D GETINF^DGPFAPIH(SDDFN,FPTR,,,"PRFDATA") Q:'$D(PRFDATA)
.S PRFCNT=PRFCNT+1
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Name")=$P($G(PRFDATA("FLAG")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Type")=$P($G(PRFDATA("FLAGTYPE")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Category")=$P($G(PRFDATA("CATEGORY")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"AssignedDate")=$$FMTISO^SDAMUTDT($P($G(PRFDATA("ASSIGNDT")),U,1))
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OwnerSiteID")=$P($G(PRFDATA("OWNER")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OwnerSiteName")=$P($G(PRFDATA("OWNER")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OriginatingSiteID")=$P($G(PRFDATA("ORIGSITE")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OriginatingSiteName")=$P($G(PRFDATA("ORIGSITE")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"ReviewDate")=$$FMTISO^SDAMUTDT($P($G(PRFDATA("REVIEWDT")),U))
.S NARR=0 F S NARR=$O(PRFDATA("NARR",NARR)) Q:'NARR D
..S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Narrative",NARR)=$G(PRFDATA("NARR",NARR,0))
I '$D(APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag")) S APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",1)=""
Q
;
LOCALFLAGS(APPTOBJ,RECCNT,SDDFN) ;
N PRFDATA,DFNERROR,DFNERRORS,FN,RESNUM,PRFCNT,FIEN,FPTR,PRFARRY,NARR,FDATA
S FN=26.11
D LIST^DIC(26.11,,,"E",,,,,,,"FDATA","ERR")
S (RESNUM,PRFCNT)=0
F S RESNUM=$O(FDATA("DILIST",2,RESNUM)) Q:'RESNUM D
.S FIEN=$G(FDATA("DILIST",2,RESNUM))
.S FPTR=FIEN_";"_$P($$ROOT^DILFD(26.11),U,2)
.K PRFDATA
.D GETINF^DGPFAPIH(SDDFN,FPTR,,,"PRFDATA") Q:'$D(PRFDATA)
.S PRFCNT=PRFCNT+1
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Name")=$P($G(PRFDATA("FLAG")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Type")=$P($G(PRFDATA("FLAGTYPE")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Category")=$P($G(PRFDATA("CATEGORY")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"AssignedDate")=$$FMTISO^SDAMUTDT($P($G(PRFDATA("ASSIGNDT")),U,1))
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OwnerSiteID")=$P($G(PRFDATA("OWNER")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OwnerSiteName")=$P($G(PRFDATA("OWNER")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OriginatingSiteID")=$P($G(PRFDATA("ORIGSITE")),U)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OriginatingSiteName")=$P($G(PRFDATA("ORIGSITE")),U,2)
.S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"ReviewDate")=$$FMTISO^SDAMUTDT($P($G(PRFDATA("REVIEWDT")),U))
.S NARR=0 F S NARR=$O(PRFDATA("NARR",NARR)) Q:'NARR D
..S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Narrative",NARR)=$G(PRFDATA("NARR",NARR,0))
I '$D(APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag")) S APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",1)=""
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"),CLINIEN)
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,"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 10947 printed Dec 13, 2024@02:53:18 Page 2
SDES2BLDAPPT2 ;ALB/LAB,JAS,LAB - VISTA SCHEDULING BUILDING APPT OBJECT FROM PATIENT ;MAY 15, 2024
+1 ;;5.3;Scheduling;**871,877,880**;Aug 13, 1993;Build 5
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
GET2INFO(APPTOBJ,APPTIEN,SDDFN,RECCNT,SDDUZ) ;
+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","DateOfBirthInternal")=$$GET1^DIQ(2,SDDFN_",",.03,"I")
+6 SET APPTOBJ("Appointment",RECCNT,"Patient","DateOfDeath")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDDFN_",",.351,"I"))
+7 SET APPTOBJ("Appointment",RECCNT,"Patient","EligibilityIEN")=$$GET1^DIQ(2,SDDFN_",",.361,"I")
+8 SET APPTOBJ("Appointment",RECCNT,"Patient","Eligibility")=$$GET1^DIQ(2,SDDFN_",",.361,"E")
+9 SET APPTOBJ("Appointment",RECCNT,"Patient","FugitiveFelonFlag")=$SELECT($$GET1^DIQ(2,SDDFN_",",1100.01,"I"):"YES",1:"NO")
+10 SET APPTOBJ("Appointment",RECCNT,"Patient","Gender")=$$GET1^DIQ(2,SDDFN_",",.02,"E")
+11 SET APPTOBJ("Appointment",RECCNT,"Patient","Name")=$$GET1^DIQ(2,SDDFN_",",.01,"E")
+12 SET APPTOBJ("Appointment",RECCNT,"Patient","Street")=$$GET1^DIQ(2,SDDFN_",",.111,"E")
+13 NEW SENSITIVE,NEEDSINS
+14 DO SENSITIVE^SDES2UTIL(.SENSITIVE,SDDFN,SDDUZ)
+15 SET APPTOBJ("Appointment",RECCNT,"Patient","SensitivePatientRestrictedRecord")=$SELECT($GET(SENSITIVE(1)):1,1:0)
+16 SET APPTOBJ("Appointment",RECCNT,"Patient","SensitivePatientType")=$GET(SENSITIVE(1))
+17 DO NEEDVERIFY^SDESPATRPC(.NEEDSINS,SDDFN,180,90)
+18 SET APPTOBJ("Appointment",RECCNT,"Patient","NeedInsuranceVerification")=NEEDSINS
+19 DO GETREGDT(.APPTOBJ,RECCNT,SDDFN)
+20 DO NATIONALFLAG(.APPTOBJ,RECCNT,SDDFN)
+21 DO LOCALFLAGS(.APPTOBJ,RECCNT,SDDFN)
+22 QUIT
+23 ;
GETREGDT(APPTOBJ,RECCNT,SDDFN) ;
+1 NEW ORIGREGIEN,ORIGREGDT,LASTREGIEN,LASTREGDT,DEMODIFF
+2 SET DEMODIFF=180
+3 IF $DATA(^DGS(41.41,"B",SDDFN))
Begin DoDot:1
+4 SET ORIGREGIEN=$ORDER(^DGS(41.41,"B",SDDFN,0))
+5 SET LASTREGIEN=$ORDER(^DGS(41.41,"B",SDDFN,"A"),-1)
+6 SET ORIGREGDT=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,ORIGREGIEN,1,"I"))
+7 SET LASTREGDT=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,LASTREGIEN,1,"I"))
+8 SET DEMODIFF=$$FMDIFF^XLFDT(DT,$$GET1^DIQ(41.41,LASTREGIEN_",",1,"I"))
End DoDot:1
+9 SET APPTOBJ("Appointment",RECCNT,"Patient","OriginalRegistrationDate")=$GET(ORIGREGDT)
+10 SET APPTOBJ("Appointment",RECCNT,"Patient","LastRegistrationDate")=$GET(LASTREGDT)
+11 SET APPTOBJ("Appointment",RECCNT,"Patient","DemographicsNeedUpdate")=$SELECT(DEMODIFF>179:1,DEMODIFF<180:0)
+12 QUIT
+13 ;
NATIONALFLAG(APPTOBJ,RECCNT,SDDFN) ;
+1 NEW PRFDATA,DFNERROR,DFNERRORS,FN,RESNUM,PRFCNT,FIEN,FPTR,PRFARRY,NARR,FDATA
+2 SET FN=26.15
+3 DO LIST^DIC(26.15,,,"E",,,,,,,"FDATA","ERR")
+4 SET (RESNUM,PRFCNT)=0
+5 FOR
SET RESNUM=$ORDER(FDATA("DILIST",2,RESNUM))
if 'RESNUM
QUIT
Begin DoDot:1
+6 SET FIEN=$GET(FDATA("DILIST",2,RESNUM))
+7 SET FPTR=FIEN_";"_$PIECE($$ROOT^DILFD(26.15),U,2)
+8 KILL PRFDATA
+9 DO GETINF^DGPFAPIH(SDDFN,FPTR,,,"PRFDATA")
if '$DATA(PRFDATA)
QUIT
+10 SET PRFCNT=PRFCNT+1
+11 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Name")=$PIECE($GET(PRFDATA("FLAG")),U,2)
+12 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Type")=$PIECE($GET(PRFDATA("FLAGTYPE")),U,2)
+13 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Category")=$PIECE($GET(PRFDATA("CATEGORY")),U)
+14 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"AssignedDate")=$$FMTISO^SDAMUTDT($PIECE($GET(PRFDATA("ASSIGNDT")),U,1))
+15 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OwnerSiteID")=$PIECE($GET(PRFDATA("OWNER")),U)
+16 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OwnerSiteName")=$PIECE($GET(PRFDATA("OWNER")),U,2)
+17 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OriginatingSiteID")=$PIECE($GET(PRFDATA("ORIGSITE")),U)
+18 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"OriginatingSiteName")=$PIECE($GET(PRFDATA("ORIGSITE")),U,2)
+19 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"ReviewDate")=$$FMTISO^SDAMUTDT($PIECE($GET(PRFDATA("REVIEWDT")),U))
+20 SET NARR=0
FOR
SET NARR=$ORDER(PRFDATA("NARR",NARR))
if 'NARR
QUIT
Begin DoDot:2
+21 SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",PRFCNT,"Narrative",NARR)=$GET(PRFDATA("NARR",NARR,0))
End DoDot:2
End DoDot:1
+22 IF '$DATA(APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag"))
SET APPTOBJ("Appointment",RECCNT,"Patient","NationalFlag",1)=""
+23 QUIT
+24 ;
LOCALFLAGS(APPTOBJ,RECCNT,SDDFN) ;
+1 NEW PRFDATA,DFNERROR,DFNERRORS,FN,RESNUM,PRFCNT,FIEN,FPTR,PRFARRY,NARR,FDATA
+2 SET FN=26.11
+3 DO LIST^DIC(26.11,,,"E",,,,,,,"FDATA","ERR")
+4 SET (RESNUM,PRFCNT)=0
+5 FOR
SET RESNUM=$ORDER(FDATA("DILIST",2,RESNUM))
if 'RESNUM
QUIT
Begin DoDot:1
+6 SET FIEN=$GET(FDATA("DILIST",2,RESNUM))
+7 SET FPTR=FIEN_";"_$PIECE($$ROOT^DILFD(26.11),U,2)
+8 KILL PRFDATA
+9 DO GETINF^DGPFAPIH(SDDFN,FPTR,,,"PRFDATA")
if '$DATA(PRFDATA)
QUIT
+10 SET PRFCNT=PRFCNT+1
+11 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Name")=$PIECE($GET(PRFDATA("FLAG")),U,2)
+12 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Type")=$PIECE($GET(PRFDATA("FLAGTYPE")),U,2)
+13 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Category")=$PIECE($GET(PRFDATA("CATEGORY")),U)
+14 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"AssignedDate")=$$FMTISO^SDAMUTDT($PIECE($GET(PRFDATA("ASSIGNDT")),U,1))
+15 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OwnerSiteID")=$PIECE($GET(PRFDATA("OWNER")),U)
+16 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OwnerSiteName")=$PIECE($GET(PRFDATA("OWNER")),U,2)
+17 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OriginatingSiteID")=$PIECE($GET(PRFDATA("ORIGSITE")),U)
+18 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"OriginatingSiteName")=$PIECE($GET(PRFDATA("ORIGSITE")),U,2)
+19 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"ReviewDate")=$$FMTISO^SDAMUTDT($PIECE($GET(PRFDATA("REVIEWDT")),U))
+20 SET NARR=0
FOR
SET NARR=$ORDER(PRFDATA("NARR",NARR))
if 'NARR
QUIT
Begin DoDot:2
+21 SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",PRFCNT,"Narrative",NARR)=$GET(PRFDATA("NARR",NARR,0))
End DoDot:2
End DoDot:1
+22 IF '$DATA(APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag"))
SET APPTOBJ("Appointment",RECCNT,"Patient","LocalFlag",1)=""
+23 QUIT
+24 ;
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"),CLINIEN)
+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,"AppointmentTypeSubCategory")=""
+3 SET APPTOBJ("Appointment",RECCNT,"AutoRebookedApptDateTime")=""
+4 SET APPTOBJ("Appointment",RECCNT,"CancellationRemarks")=""
+5 SET APPTOBJ("Appointment",RECCNT,"CollateralVisit")=""
+6 SET APPTOBJ("Appointment",RECCNT,"EkgDateTime")=""
+7 SET APPTOBJ("Appointment",RECCNT,"EncounterConversionStatus")=""
+8 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsAsAddOns")=""
+9 SET APPTOBJ("Appointment",RECCNT,"EncounterFormsPrinted")=""
+10 SET APPTOBJ("Appointment",RECCNT,"FollowUpVisit")=""
+11 SET APPTOBJ("Appointment",RECCNT,"LabDateTime")=""
+12 SET APPTOBJ("Appointment",RECCNT,"NextAvaApptIndicator")=""
+13 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelDateTime")=""
+14 SET APPTOBJ("Appointment",RECCNT,"NoShowCancelledBy")=""
+15 SET APPTOBJ("Appointment",RECCNT,"NumberOfCollateralSeen")=""
+16 SET APPTOBJ("Appointment",RECCNT,"OutpatientEncounter")=""
+17 SET APPTOBJ("Appointment",RECCNT,"PurposeOfVisit")=""
+18 SET APPTOBJ("Appointment",RECCNT,"RealAppointment")=""
+19 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrintDate")=""
+20 SET APPTOBJ("Appointment",RECCNT,"RoutingSlipPrinted")=""
+21 SET APPTOBJ("Appointment",RECCNT,"SchedulerName")=""
+22 SET APPTOBJ("Appointment",RECCNT,"SchedulingApplication")=""
+23 SET APPTOBJ("Appointment",RECCNT,"SchedulingRequestType")=""
+24 SET APPTOBJ("Appointment",RECCNT,"SpecialSurveyDisposition")=""
+25 SET APPTOBJ("Appointment",RECCNT,"XrayDateTime")=""
+26 QUIT
+27 ;
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 ;