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

AQAQPR31.m

Go to the documentation of this file.
  1. AQAQPR31 ;IHS/ANMC/LJF - DISCHARGES BY PROVIDER & DX; [ 05/27/92 11:21 AM ]
  1. ;;2.2;STAFF CREDENTIALS;;01 OCT 1992
  1. ;
  1. ;>>> initialize variables <<<
  1. S X="ERR^AQAQPR3",@^%ZOSF("TRAP") X ^%ZOSF("BRK") ;allow break
  1. K ^UTILITY("AQAQPR3",$J)
  1. S AQAQDT=AQAQBDT-.0001,AQAQEND=AQAQEDT+.2400
  1. ;
  1. ;>>> loop thru visit file by date and screen visit
  1. LOOP F S AQAQDT=$O(^AUPNVINP("B",AQAQDT)) Q:AQAQDT="" Q:AQAQDT>AQAQEND D
  1. .S AQAQHDFN=0
  1. .F S AQAQHDFN=$O(^AUPNVINP("B",AQAQDT,AQAQHDFN)) Q:AQAQHDFN="" D
  1. ..Q:'$D(^AUPNVINP(AQAQHDFN,0)) S AQAQH=^(0)
  1. ..S AQAQVDFN=$P(AQAQH,U,3) Q:AQAQVDFN="" ;visit dfn
  1. ..S AQAQV=^AUPNVSIT(AQAQVDFN,0) ;visit node
  1. ..Q:$P(AQAQV,U,11)=1 ;deleted visit
  1. ..Q:$P(AQAQV,U,9)<3 ;must have prov,pov, & proc entries
  1. ..Q:$P(AQAQV,U,7)'="H" ;service category
  1. ..Q:$P(AQAQV,U,6)'=DUZ(2) ;location of encounter
  1. ..D FINDPROV ;get primary provider
  1. ..Q:AQAQPRV=0 Q:AQAQPRV="" ;bad visit-no primary provider
  1. ..I AQAQTYP=1,AQAQSRT'="" Q:+AQAQSRT'=AQAQPRV ;not provider asked for
  1. ..S AQAQCLS=$P(^DIC(6,AQAQPRV,0),U,4) ;provider class
  1. ..I AQAQTYP=2 Q:+AQAQSRT'=AQAQCLS ;not class asked for
  1. ..S AQAQCAT=$P($G(^AQAQC(AQAQPRV,0)),U,2) ;staff category
  1. ..I AQAQTYP=3 Q:AQAQSRT'=AQAQCAT ;not category asked for
  1. ..S:AQAQCLS'="" AQAQCLS=$P(^DIC(7,AQAQCLS,0),U) ;class name
  1. ..S AQAQPRV=$P(^DIC(16,AQAQPRV,0),U)_" ("_AQAQCLS_")"
  1. ..D FINDDX ;get diagnoses for this visit
  1. ..Q ;get next visit
  1. ;
  1. NEXT ;>>> go to print rtn <<<
  1. G ^AQAQPR32
  1. ;
  1. ;>>> end of main rtn <<<
  1. ;
  1. FINDDX ;***> SUBRTN to get diagnoses for visits that passed screens
  1. S (AQAQPDFN)=0
  1. F S AQAQPDFN=$O(^AUPNVPOV("AD",AQAQVDFN,AQAQPDFN)) Q:AQAQPDFN="" D
  1. .Q:'$D(^AUPNVPOV(AQAQPDFN,0)) S AQAQP=^(0)
  1. .I AQAQCDX=1 Q:$P(AQAQP,U,12)'="P" ;check for primary vs sec
  1. .S AQAQICD=$P(^ICD9($P(AQAQP,U),0),U) ;icd code number
  1. .;
  1. .S AQAQSTR=AQAQPDFN_U_AQAQHDFN ;set string into ^utility
  1. .I AQAQICD'?1"V".E S AQAQICD=+AQAQICD ;to coallate numbers correctly
  1. .S ^UTILITY("AQAQPR3",$J,AQAQPRV,AQAQICD,AQAQDT,AQAQVDFN)=AQAQSTR Q
  1. Q ;return to main rtn loop
  1. ;
  1. ;
  1. FINDPROV ;***> SUBRTN to find primary provider for ambulatory visits
  1. S AQAQRDFN=0
  1. F S AQAQRDFN=$O(^AUPNVPRV("AD",AQAQVDFN,AQAQRDFN)) Q:AQAQRDFN="" D
  1. .Q:'$D(^AUPNVPRV(AQAQRDFN,0)) S AQAQR=^(0)
  1. .Q:$P(AQAQR,U,4)'="P" ;find another if not primary provider
  1. .S AQAQPRV=$P(AQAQR,U) ;get provider pointer
  1. Q ;return to procedure subrtn