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

ADGOASC.m

Go to the documentation of this file.
  1. ADGOASC ; IHS/ADC/PDW/ENM - CALC OUTSTANDING A SHEETS LIST ; [ 03/25/1999 11:48 AM ]
  1. ;;5.0;ADMISSION/DISCHARGE/TRANSFER;;MAR 25, 1999
  1. ;
  1. K ^TMP("DGZOAS",$J)
  1. K DGCT,DGCCT,DGCOT,DGERR,DGCTEX
  1. A ; -- driver
  1. D LP3,CNT,Q
  1. G ^ADGOASP
  1. ;
  1. LP3 ; -- loop discharges
  1. N DGDT,DFN,IFN
  1. S DGDT=$E(DGMON,1,5)_"00",DGMON2=$E(DGMON2,1,5)_"31"
  1. F S DGDT=$O(^DGPM("AMV3",DGDT)) Q:'DGDT!(DGDT>(DGMON2+.2400)) D
  1. . S DFN=0 F S DFN=$O(^DGPM("AMV3",DGDT,DFN)) Q:'DFN D
  1. .. S IFN=0 F S IFN=$O(^DGPM("AMV3",DGDT,DFN,IFN)) Q:'IFN D 1
  1. Q
  1. ;
  1. 1 ; -- discharge count
  1. N VINP,VIFN
  1. S DGM=$E(DGDT,1,5),DGCT(DGM)=$S($D(DGCT(DGM)):DGCT(DGM)+1,1:1)
  1. ;--check v hosp
  1. S VINP=$O(^AUPNVINP("AA",DFN,9999999-$E(DGDT,1,7),0))
  1. I 'VINP D ERR Q
  1. I '$D(^AUPNVINP(VINP,0)) D ERR Q
  1. S VIFN=$P(^AUPNVINP(VINP,0),U,3) I '$D(^AUPNVSIT(VIFN,0)) D ERR Q
  1. ;--count # exported
  1. I $P(^AUPNVSIT(VIFN,0),U,14)]"" S DGCTEX(DGM)=$G(DGCTEX(DGM))+1
  1. ;--check if coding complete
  1. I $P(^AUPNVINP(VINP,0),U,15)=1 D OUT Q
  1. S DGCCT(DGM)=$S($D(DGCCT(DGM)):DGCCT(DGM)+1,1:1)
  1. Q
  1. ;
  1. OUT ;--discharges not coded yet
  1. N TS
  1. S DGCOT(DGM)=$S($D(DGCOT(DGM)):DGCOT(DGM)+1,1:1)
  1. S TS=$P(^AUPNVINP(VINP,0),U,5)
  1. S ^TMP("DGZOAS",$J,"ZOUT",$E(DGDT,1,7),DFN)=TS
  1. Q
  1. ;
  1. CNT ;--store counts
  1. N X
  1. S X=0 F S X=$O(DGCT(X)) Q:'X D
  1. . S ^TMP("DGZOAS",$J,"CT",X)=DGCT(X)
  1. S X=0 F S X=$O(DGCCT(X)) Q:'X D
  1. . S ^TMP("DGZOAS",$J,"CT1",X)=DGCCT(X)
  1. S X=0 F S X=$O(DGCOT(X)) Q:'X D
  1. . S ^TMP("DGZOAS",$J,"CT2",X)=DGCOT(X)
  1. S X=0 F S X=$O(DGERR(X)) Q:'X D
  1. . S ^TMP("DGZOAS",$J,"CT3",X)=DGERR(X)
  1. S X=0 F S X=$O(DGCTEX(X)) Q:'X D
  1. . S ^TMP("DGZOAS",$J,"CT4",X)=DGCTEX(X)
  1. Q
  1. ;
  1. Q ; -- end
  1. K DGCT,DGCCT,DGCOT,DGERR,DGCTEX,DGM,DFN
  1. Q
  1. ;
  1. ERR ;--visit errors
  1. S DGERR(DGM)=$S($D(DGERR(DGM)):DGERR(DGM)+1,1:1)
  1. S ^TMP("DGZOAS",$J,"ZERR",DGDT,DFN)="" Q