SDESCLINICDATA ;ALB/TAW,MGD,RRM,CGP,ANU,BWF - VISTA Clinic data getter ;June 27, 2023@10:00
;;5.3;Scheduling;**788,823,825,828,831,844,847,860,871**;Aug 13, 1993;Build 13
;;Per VHA Directive 6402, this routine should not be modified
; Reference to INSTITUTION in ICR #10090
Q
;
; The intention of this routine is to return a unique set of data from the HOSPITAL
;LOCATION (#44) for a specific IEN.
;
; It is assumed by getting here all business logic and validation has been performed.
;
; This routine should only be used for retrieving data from the HOSPITAL LOCATION file.
Q
APPTCLINIC(RETURN,IEN) ;
; Return clinic data related to an appointment
;
; Input
; IEN - Specific clinic IEN
; Return
; RETURN - Array of field names and the data for the field based on the IEN
;
N CLINICARY,SDMSG,IENS,DIV,INST,TIMEZONEIEN,TIMEZONE,TZEXECPTION
N TZLOOP,TZCNT,TZIENS,TIMEFRAME,OFFSET,TZCODE,TZDATA,STOPIEN,CRSTOPIEN
K RETURN
S IENS=IEN_","
;ANU
D GETS^DIQ(44,IEN,".01;3.5;8;10;20;21;60;62;99;99.1;200;2503","IE","CLINICARY","SDMSG")
S CLINICARY(44,IENS,99,"E")=$$TELEPHONE^SDESUTIL($G(CLINICARY(44,IENS,99,"E")))
S CLINICARY(44,IENS,99.1,"E")=$$EXT^SDESUTIL($G(CLINICARY(44,IENS,99.1,"E")))
; 831 - add timezone information
S DIV=$G(CLINICARY(44,IENS,3.5,"I"))
S INST=$$GET1^DIQ(40.8,DIV,.07,"I")
S TIMEZONEIEN=$$GET1^DIQ(4,INST,800,"I")
S TIMEZONE=$$GET1^DIQ(4,INST,800,"E")
S TZEXECPTION=$$GET1^DIQ(4,INST,802,"E")
S RETURN("Name")=$G(CLINICARY(44,IENS,.01,"E"))
S RETURN("PhysicalLocation")=$G(CLINICARY(44,IENS,10,"E"))
S RETURN("PatientFriendlyName")=$G(CLINICARY(44,IENS,60,"E"))
S RETURN("PbspID")=$G(CLINICARY(44,IENS,200,"E"))
;ANU
S RETURN("DisplayClinicAppt")=$G(CLINICARY(44,IENS,62,"E"))
S STOPIEN=$G(CLINICARY(44,IENS,8,"I"))
S CRSTOPIEN=$G(CLINICARY(44,IENS,2503,"I"))
S RETURN("StopCodeAMIS")=$$GET1^DIQ(40.7,STOPIEN,1,"I")
S RETURN("StopCodeName")=$G(CLINICARY(44,IENS,8,"E"))
S RETURN("CreditStopCodeAMIS")=$$GET1^DIQ(40.7,CRSTOPIEN,1,"I")
S RETURN("CreditStopCodeName")=$G(CLINICARY(44,IENS,2503,"E"))
;
;847
S RETURN("ECheckinAllowed")=$G(CLINICARY(44,IENS,20,"E"))
S RETURN("PreCheckinAllowed")=$G(CLINICARY(44,IENS,21,"E"))
;
S RETURN("Telephone")=$G(CLINICARY(44,IENS,99,"E"))
S RETURN("TelephoneExtension")=$G(CLINICARY(44,IENS,99.1,"E"))
S RETURN("Division")=$G(CLINICARY(44,IENS,3.5,"E"))
S RETURN("StationNumber")=$$STATIONNUMBER^SDESUTIL($G(IEN)) ;SD,825-Clinic station number
S RETURN("ClinicIEN")=$G(IEN) ;CP,828-Clinic IEN
S RETURN("TimeZone")=$G(TIMEZONE)
S RETURN("TimeZoneException")=TZEXECPTION
I 'TIMEZONEIEN Q
S (TZLOOP,TZCNT)=0 F S TZLOOP=$O(^DIT(1.71,TIMEZONEIEN,1,TZLOOP)) Q:'TZLOOP D
.S TZIENS=TZLOOP_","_TIMEZONEIEN_","
.D GETS^DIQ(1.711,TZIENS,"**","IE","TZDATA")
.S TIMEFRAME=$G(TZDATA(1.711,TZIENS,.01,"E"))
.S OFFSET=$G(TZDATA(1.711,TZIENS,.02,"E"))
.S TZCODE=$G(TZDATA(1.711,TZIENS,.03,"E"))
.S TZCNT=TZCNT+1
.S RETURN("TimeZoneDetails",TZCNT,"TimeFrame")=TIMEFRAME
.S RETURN("TimeZoneDetails",TZCNT,"Offset")=OFFSET
.S RETURN("TimeZoneDetails",TZCNT,"TimeZoneCode")=TZCODE
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESCLINICDATA 3162 printed Dec 13, 2024@02:56:11 Page 2
SDESCLINICDATA ;ALB/TAW,MGD,RRM,CGP,ANU,BWF - VISTA Clinic data getter ;June 27, 2023@10:00
+1 ;;5.3;Scheduling;**788,823,825,828,831,844,847,860,871**;Aug 13, 1993;Build 13
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ; Reference to INSTITUTION in ICR #10090
+4 QUIT
+5 ;
+6 ; The intention of this routine is to return a unique set of data from the HOSPITAL
+7 ;LOCATION (#44) for a specific IEN.
+8 ;
+9 ; It is assumed by getting here all business logic and validation has been performed.
+10 ;
+11 ; This routine should only be used for retrieving data from the HOSPITAL LOCATION file.
+12 QUIT
APPTCLINIC(RETURN,IEN) ;
+1 ; Return clinic data related to an appointment
+2 ;
+3 ; Input
+4 ; IEN - Specific clinic IEN
+5 ; Return
+6 ; RETURN - Array of field names and the data for the field based on the IEN
+7 ;
+8 NEW CLINICARY,SDMSG,IENS,DIV,INST,TIMEZONEIEN,TIMEZONE,TZEXECPTION
+9 NEW TZLOOP,TZCNT,TZIENS,TIMEFRAME,OFFSET,TZCODE,TZDATA,STOPIEN,CRSTOPIEN
+10 KILL RETURN
+11 SET IENS=IEN_","
+12 ;ANU
+13 DO GETS^DIQ(44,IEN,".01;3.5;8;10;20;21;60;62;99;99.1;200;2503","IE","CLINICARY","SDMSG")
+14 SET CLINICARY(44,IENS,99,"E")=$$TELEPHONE^SDESUTIL($GET(CLINICARY(44,IENS,99,"E")))
+15 SET CLINICARY(44,IENS,99.1,"E")=$$EXT^SDESUTIL($GET(CLINICARY(44,IENS,99.1,"E")))
+16 ; 831 - add timezone information
+17 SET DIV=$GET(CLINICARY(44,IENS,3.5,"I"))
+18 SET INST=$$GET1^DIQ(40.8,DIV,.07,"I")
+19 SET TIMEZONEIEN=$$GET1^DIQ(4,INST,800,"I")
+20 SET TIMEZONE=$$GET1^DIQ(4,INST,800,"E")
+21 SET TZEXECPTION=$$GET1^DIQ(4,INST,802,"E")
+22 SET RETURN("Name")=$GET(CLINICARY(44,IENS,.01,"E"))
+23 SET RETURN("PhysicalLocation")=$GET(CLINICARY(44,IENS,10,"E"))
+24 SET RETURN("PatientFriendlyName")=$GET(CLINICARY(44,IENS,60,"E"))
+25 SET RETURN("PbspID")=$GET(CLINICARY(44,IENS,200,"E"))
+26 ;ANU
+27 SET RETURN("DisplayClinicAppt")=$GET(CLINICARY(44,IENS,62,"E"))
+28 SET STOPIEN=$GET(CLINICARY(44,IENS,8,"I"))
+29 SET CRSTOPIEN=$GET(CLINICARY(44,IENS,2503,"I"))
+30 SET RETURN("StopCodeAMIS")=$$GET1^DIQ(40.7,STOPIEN,1,"I")
+31 SET RETURN("StopCodeName")=$GET(CLINICARY(44,IENS,8,"E"))
+32 SET RETURN("CreditStopCodeAMIS")=$$GET1^DIQ(40.7,CRSTOPIEN,1,"I")
+33 SET RETURN("CreditStopCodeName")=$GET(CLINICARY(44,IENS,2503,"E"))
+34 ;
+35 ;847
+36 SET RETURN("ECheckinAllowed")=$GET(CLINICARY(44,IENS,20,"E"))
+37 SET RETURN("PreCheckinAllowed")=$GET(CLINICARY(44,IENS,21,"E"))
+38 ;
+39 SET RETURN("Telephone")=$GET(CLINICARY(44,IENS,99,"E"))
+40 SET RETURN("TelephoneExtension")=$GET(CLINICARY(44,IENS,99.1,"E"))
+41 SET RETURN("Division")=$GET(CLINICARY(44,IENS,3.5,"E"))
+42 ;SD,825-Clinic station number
SET RETURN("StationNumber")=$$STATIONNUMBER^SDESUTIL($GET(IEN))
+43 ;CP,828-Clinic IEN
SET RETURN("ClinicIEN")=$GET(IEN)
+44 SET RETURN("TimeZone")=$GET(TIMEZONE)
+45 SET RETURN("TimeZoneException")=TZEXECPTION
+46 IF 'TIMEZONEIEN
QUIT
+47 SET (TZLOOP,TZCNT)=0
FOR
SET TZLOOP=$ORDER(^DIT(1.71,TIMEZONEIEN,1,TZLOOP))
if 'TZLOOP
QUIT
Begin DoDot:1
+48 SET TZIENS=TZLOOP_","_TIMEZONEIEN_","
+49 DO GETS^DIQ(1.711,TZIENS,"**","IE","TZDATA")
+50 SET TIMEFRAME=$GET(TZDATA(1.711,TZIENS,.01,"E"))
+51 SET OFFSET=$GET(TZDATA(1.711,TZIENS,.02,"E"))
+52 SET TZCODE=$GET(TZDATA(1.711,TZIENS,.03,"E"))
+53 SET TZCNT=TZCNT+1
+54 SET RETURN("TimeZoneDetails",TZCNT,"TimeFrame")=TIMEFRAME
+55 SET RETURN("TimeZoneDetails",TZCNT,"Offset")=OFFSET
+56 SET RETURN("TimeZoneDetails",TZCNT,"TimeZoneCode")=TZCODE
End DoDot:1
+57 QUIT