Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDESAPPTUTIL

SDESAPPTUTIL.m

Go to the documentation of this file.
  1. SDESAPPTUTIL ;ALB/TAW - SDED APPOINTMENT UTILITIES ;JULY 18, 2021@15:22
  1. ;;5.3;Scheduling;**790**;Aug 13, 1993;Build 11
  1. ; This rtn will hold various utilities for dealing with SDEC APPOINTMENTS File (409.84)
  1. Q
  1. MISSINGRES(APPTIEN) ;Try to get a resource from Patient / Clinic file
  1. ; This function will get the DFN and Start Time from the appointment file and look at the Appointment sub-file
  1. ; under the Patient file to try and find the
  1. ; Input:
  1. ; APTIEN - (Required) IEN from SDEC Appointment
  1. ; Return:
  1. ; The resource that shold be associated with the appointment
  1. ;
  1. N DFN,CLINICIEN,RESIEN,APPT0,APPTSTART,RESTYPE,RESLIST,RESCNT,X,REC,APPTFOUND
  1. S (APPTFOUND,X,RESIEN,RESCNT)=""
  1. I APPTIEN="" Q "0^APPOINTMENT IEN IS REQUIRED"
  1. S APPT0=$G(^SDEC(409.84,APPTIEN,0))
  1. S DFN=$P(APPT0,U,5)
  1. S APPTSTART=$P(APPT0,U,1)
  1. I DFN="" Q "0^NO DFN FOR THIS APPOINTMENT"
  1. S CLINICIEN=$$GET1^DIQ(2.98,APPTSTART_","_DFN_",",.01,"I")
  1. I CLINICIEN="" Q "0^HOSPITAL LOCATION NOT FOUND IN APPOINTMENT SUB FILE FOR PATIENT"
  1. ;
  1. ;Confirm the patient does have an active appointment at the Hosp Loc for the Appt Start Date/Time
  1. F S X=$O(^SC(CLINICIEN,"S",APPTSTART,1,X)) Q:X=""!(APPTFOUND) D
  1. .S REC=$G(^SC(CLINICIEN,"S",APPTSTART,1,X,0))
  1. .I $P(REC,"^",1)'=DFN Q
  1. .I $P(REC,"^",9)="C" Q
  1. .S APPTFOUND=1
  1. I 'APPTFOUND Q "0^PATIENT DOES NOT HAVE AN ACTIVE APPT IN THE CLINIC"
  1. ;
  1. ;Since there can be multiple resources linked to a hospital location, fine the one that is a clinic
  1. F S RESIEN=$O(^SDEC(409.831,"ALOC",CLINICIEN,RESIEN)) Q:RESIEN="" D
  1. .S RESTYPE=$P($G(^SDEC(409.831,RESIEN,0)),"^",11)
  1. .I $P(RESTYPE,";",2)'="SC(" Q ;Must be a Hospital Loc
  1. .S RESLIST($I(RESCNT))=RESIEN
  1. I 'RESCNT Q "0^NO CLINIC RESOURCES FOR THIS HOSPITAL LOCATION"
  1. ;I RESCNT>1 Q "0^MULTIPLE CLINIC RESROUCES FOR THIS HOSPITAL LOCATION"
  1. Q RESLIST(1)