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

DGPMGLG4.m

Go to the documentation of this file.
  1. DGPMGLG4 ;ALB/ABR - G&L GENERATION CONT.; 17 MAY 94
  1. ;;5.3;Registration;**34**;Aug.13, 1993
  1. ;
  1. ;This routine finds the division associated with a given
  1. ;Treating Specialty transaction.
  1. ;
  1. ;It finds the division of the ward where the patient is
  1. ;located at the time of the TS transaction.
  1. ;
  1. ;Variables:
  1. ; LTSDV - last treating specialty division.
  1. ; this is the division for the current treating specialty transaction.
  1. ; PTSDV - previous treating specialty division.
  1. ;
  1. TSDIV ;entry point for division search
  1. S LTSDV=$$TSDV(+MV("LWD"))
  1. ;
  1. TSDIVP ; entry point for Previous TS division only
  1. ;
  1. ;If transaction is a TS/Provider change, without an associated
  1. ;physical movement, then the previous TS division will be the same as
  1. ;the current division.
  1. I MV("TT")=6,'$P(MD,"^",24) S PTSDV=LTSDV Q
  1. S PTSDV=$$TSDV(+MV("PWD"))
  1. Q
  1. ;
  1. TSDV(X) ; This function returns the TS division
  1. N DV
  1. S DV=$P($G(^DIC(42,+X,0)),"^",11)
  1. I '$D(^DG(40.8,+DV,0)) S DV=DIV
  1. Q +DV
  1. Q
  1. ASIHR ;to find PTS, PTSDV for returns from ASIH
  1. N J1,J2,T,PMT
  1. S J1=J
  1. F S J1=$O(^DGPM("APMV",DFN,MV("CA"),J1)) Q:'J1 S J2=$O(^(J1,0)) D Q:$D(T)
  1. .S PMT=$P(^DGPM(J2,0),"^",18),PMT="^"_PMT_"^"
  1. .I '$F("^13^43^44^45^",PMT) S T=1
  1. I '$D(T) Q
  1. S MV("PWD")=$P($G(^DGPM(J2,0)),"^",6),PTSDV=$$TSDV(MV("PWD")) ; find division for previous TS
  1. S J1=$O(^DGPM("ATS",DFN,MV("CA"),9999999.9999999-MD)),J2=$O(^(J1,0)),MV("PTS")=J2 ; find previous TS
  1. Q