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

DGPMOBS.m

Go to the documentation of this file.
  1. DGPMOBS ;ALB/MM - Observation API;11/25/98
  1. ;;5.3;Registration;**212,831**;Aug 13 1993;Build 10
  1. ;
  1. ;This routine provides 3 entry points to obtain observation statuses.
  1. ;Line labels MVT, PT, and SPEC document required input variables and
  1. ;output values.
  1. ;
  1. MVT(IFN) ;This entry point returns the observation status based on
  1. ;a specified Patient Movement (#405) file entry
  1. ;
  1. ;Input:
  1. ; Patient Movement (#405) file IFN (Required)
  1. ;
  1. ;Output:
  1. ; If an observation treating specialty return:
  1. ; 1^Facility Treating Specialty (#45.7)file IFN^Facility
  1. ; Treating Specialty (#45.7) file name^Specialty (#42.4)
  1. ; file IFN^Specialty (#42.4) file name
  1. ;
  1. ; If not an observation treating specialty return:
  1. ; 0^Facility Treating Specialty (#45.7) file IFN^Facility
  1. ; Treating Specialty (#45.7) file name^Specialty (#42.4)
  1. ; file IFN^Specialty (#42.4) file name
  1. ;
  1. ; If Patient (#2) file DFN, Patient Movement (#405) IFN, or
  1. ; Specialty (#42.4) file IFN not defined or invalid return:
  1. ; -1^Error condition
  1. ;
  1. N DFN,OBS,SPIFN,VAIP
  1. S OBS=0
  1. I '$D(IFN) S OBS="-1^Patient Movement (#405) file IFN undefined" Q OBS
  1. I '$G(^DGPM(+IFN,0)) S OBS="-1^No Patient Movement (#405) file entry" Q OBS
  1. S DFN=+$P($G(^DGPM(+IFN,0)),U,3)
  1. I 'DFN S OBS="-1^Patient (#2) file DFN not defined" Q OBS
  1. ;VAIP("E") contains the Patient Movement (#405) file IFN
  1. S VAIP("E")=+IFN
  1. D INP
  1. Q OBS
  1. PT(DFN,MVTDT) ;This entry point returns observation status for a patient
  1. ;based on the treating specialty associated for a designated date/time.
  1. ;If not defined, defaults to status for the current date/time.
  1. ;
  1. ;Input:
  1. ; DFN from Patient (#2) file
  1. ; MVTDT (optional) if not defined defaults to current date/time
  1. ;
  1. ;Output:
  1. ; Same as output documented for MVT entry point
  1. ;
  1. N OBS,SPIFN,VAIP
  1. S OBS=0
  1. ;If date not defined, defaults to current date/time
  1. S:'$D(MVTDT) MVTDT=$$NOW^XLFDT
  1. ;MVTDT must contain a time
  1. I $P(MVTDT,".",2)']"" S OBS="-1^Time required" Q OBS
  1. I '$D(DFN) S OBS="-1^Patient (#2) file DFN not defined" Q OBS
  1. I '$D(^DPT(+DFN,0)) S OBS="-1^No Patient (#2) file entry" Q OBS
  1. S VAIP("D")=MVTDT
  1. D INP
  1. Q OBS
  1. INP ;Get inpatient data based on criteria from MVT and PT entry points
  1. D IN5^VADPT
  1. ;VAIP(8) returned by IN5^VADPT call is the treating specialty from
  1. ;the Facility Treating Specialty (#45.7) file in internal^external
  1. ;format
  1. ;SPIFN is a pointer to the SPECIALTY (#42.4) file from the SPECIALTY
  1. ;(#1) field
  1. S SPIFN=$P($G(^DIC(45.7,+VAIP(8),0)),U,2)
  1. S OBS=$$SPEC(SPIFN)
  1. I +OBS'=-1 S OBS=OBS_U_VAIP(8)_U_SPIFN_U_$P($G(^DIC(42.4,+SPIFN,0)),U)
  1. Q
  1. SPEC(SPIFN) ;This entry point determines if the Specialty file (#42.4)
  1. ;is an observation specialty.
  1. ;
  1. ;Observation specialties from the Specialty (#42.4) file are:
  1. ;
  1. ; 18 - Neurology Observation
  1. ; 23 - Spinal Cord Injury Observation
  1. ; 24 - Medical Observation
  1. ; 36 - Blind Rehab Observation
  1. ; 41 - Rehab Medicine Observation
  1. ; 65 - Surgical Observation
  1. ; 94 - Psychiatric Observation
  1. ; 108 - ED Observation
  1. ;
  1. ;Input:
  1. ; SPIFN - Specialty (#42.4) IFN
  1. ;
  1. ;Output:
  1. ; 1 observation treating specialty
  1. ; 0 not an observation specialty
  1. ; -1 no treating specialty IFN defined or
  1. ; IFN not found in Specialty (#42.4) file
  1. ;
  1. N SPEC,TX
  1. S TX=0
  1. I '$D(SPIFN) S TX="-1^Specialty (#42.4) IFN not defined" Q TX
  1. I '$D(^DIC(42.4,+SPIFN,0)) S TX="-1^No Specialty (#42.4) file entry" Q TX
  1. ;SPEC=observation treating specialty IFNs
  1. F SPEC=18,23,24,36,41,65,94,108 I SPEC=SPIFN S TX=1 Q
  1. Q TX