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

ADGPTLC1.m

Go to the documentation of this file.
ADGPTLC1 ; IHS/ADC/PDW/ENM - CALCULATE DAY SURGERY LIST ; [ 03/25/1999  11:48 AM ]
 ;;5.0;ADMISSION/DISCHARGE/TRANSFER;;MAR 25, 1999
 ;
 ;***> find all day surgery patients on inpatient wards
 S DGW=0
A1 S DGW=$O(^ADGDS("CN",DGW)) G NEXT:DGW=""
 I DGWST,(DGW'=DGWST) G A1
 S DFN=0
A2 S DFN=$O(^ADGDS("CN",DGW,DFN)) G A1:DFN="" S DGDS=0
A3 S DGDS=$O(^ADGDS("CN",DGW,DFN,DGDS)) G A2:DGDS=""
 ;
 S (DGNM,DGWD,DGBED,DGRM,DGAD,DGDX,DGSER,DGPRV,DGCOM)=""
 I $D(^ADGDS(DFN,"DS",DGDS,2)),$P(^(2),U)'="" G A3
 G A3:'$D(^ADGDS(DFN,"DS",DGDS,0)) S DGSTR=^(0)
 S DGNM=$P($G(^DPT(DFN,0)),U)
 S DGWD=DGW,DGBED=$P(DGSTR,U,4),DGRM=DGWD_"-"_DGBED
 S DGSER=$P(DGSTR,U,5),DGPRV=$P(DGSTR,U,6)
 S DGCOM=$P($G(^AUPNPAT(DFN,11)),U,18)
 S DGAD=$P(DGSTR,U,1) I DGO=1!(DGO=4) S DGDX=$P(DGSTR,U,2)
 S:DGO=2 DGDX=DGSER
 I DGO=3 S ^TMP("DGZPTL",$J,"A",DGNM,DFN)=DGRM_U_DGAD_U_DGSER_U_DGPRV_U_DGCOM_"^DS" G A2
 I $P(DGRM,"-",2)="" S ^TMP("DGZPTL",$J,"WD",DGRM,DFN)=DFN_U_DGNM_U_DGAD_U_DGDX_U_DGPRV_U_DGCOM_"^DS" G A2
 S ^TMP("DGZPTL",$J,"WD",DGRM)=DFN_U_DGNM_U_DGAD_U_DGDX_U_DGPRV_U_DGCOM_"^DS" G A2
 ;
 ;
NEXT ; -- now look at surgery file for observation patients
 G END:'$D(^SRF("AIHS1","OB"))
 S DGDS=0 F  S DGDS=$O(^SRF("AIHS1","OB",DGDS)) Q:'DGDS  D
 . S DR=".01;.011;.04;.09;.14;.22;10;32:34;9999999.04;9999999.05"
 . K DGRR D ENP^XBDIQ1(130,DGDS,DR,"DGRR(","I")
 . I DGWST,DGRR(9999999.04,"I")'=DGWST Q
 . S DGNM=DGRR(.01),DFN=DGRR(.01,"I"),DGAD=$$SDT,DGPRV=DGRR(.14,"I")
 . S DGSER=DGRR(.04),DGRM=DGRR(9999999.04)_"-"_DGRR(9999999.05)
 . S DGCOM=$$VAL^XBDIQ1(9000001,DFN,1118),DGDX=$$DX,DGST=DGRR(.011,"I")
 . S:DGO=2 DGDX=DGSER
 . I DGO=3 S ^TMP("DGZPTL",$J,"A",DGNM,DFN)=DGRM_U_DGAD_U_DGSER_U_DGPRV_U_DGCOM_U_DGST Q
 . I $P(DGRM,"-",2)="" S ^TMP("DGZPTL",$J,"WD",DGRM,DFN)=DFN_U_DGNM_U_DGAD_U_DGDX_U_DGPRV_U_DGCOM_U_DGST Q
 . S ^TMP("DGZPTL",$J,"WD",DGRM)=DFN_U_DGNM_U_DGAD_U_DGDX_U_DGPRV_U_DGCOM_U_DGST Q
 ;
 ;
END K DGDS,DGW,DGWD,DGNM,DGBED,DGRM,DGAD,DGDX,DGSER,DGPRV,DGCOM Q
 ;
SDT() ; -- returns most current surgery date/time
 I DGRR(.22)]"" Q DGRR(.22,"I")
 I DGRR(10)]"" Q DGRR(10,"I")
 Q DGRR(.09,"I")
 ;
DX() ; -- returns most current dx
 I DGRR(34)]"" Q DGRR(34)
 I DGRR(32)]"" Q DGRR(32)
 Q DGRR(33)