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

ADGDSIP.m

Go to the documentation of this file.
ADGDSIP ; IHS/ADC/PDW/ENM - DS CHART DEFICIENCY BY PROV ; [ 03/25/1999  11:48 AM ]
 ;;5.0;ADMISSION/DISCHARGE/TRANSFER;;MAR 25, 1999
 ;
 K ^TMP("DGZICPL",$J)
A ;--main
 NEW DGRNG
 D DELDT,HDH,PROV I $D(DIRUT) D Q Q
 D COPY I $D(DIRUT) D Q Q
 D SUMM I $D(DIRUT)!(Y=-1) D Q Q
 D SCRN I $D(DIRUT) D Q Q
 D DEV I POP D Q Q
 I $D(IO("Q")) D QUE,Q Q
 D:'DGPR PA D:DGPR P1 D ^ADGDSIP1,Q
 Q
 ;
DELDT ;--delinquent chart date (today-(30days+holidaydays))
 N X,Y,X1,X2 S DGRNG=$P($G(^DG(43,1,9999999.02)),U,3)
 S X1=DT,X2=-$S(DGRNG:DGRNG,1:30) D C^%DTC
 F Y=0:0 S X=$O(^HOLIDAY(X)) Q:'X!(X>DT)  S Y=Y+1
 S X1=DT,X2=-$S(DGRNG:DGRNG,1:30)-Y D C^%DTC S DGDEL=X Q
 ;
HDH ;--intro
 W !!!?23,"Chart Deficiency List By Provider",!!
 W !!?10,"Charts with a surgery date earlier than "
 W !?29,$E(DGDEL,4,5)_"/"_$E(DGDEL,6,7)_"/"_$E(DGDEL,2,3)
 W !?15,"will be considered delinquent! (",DGRNG," days)"
 Q
 ;
PROV ;--all providers or just one?
 K DIR S DIR("A")="For All Providers",DIR(0)="Y",DIR("B")="YES"
 S DIR("?",1)="Answer YES to print the list for all providers."
 S DIR("?",2)="Answer NO to select sort logic.",DIR("?")=" "
 S (DGSCN,DGOPT,DGPR)=0 D ^DIR Q:Y  Q:$D(DIRUT)
 ;--select option
 W !!,"(1) for a Service",!,"(2) for a Class",!,"(3) for a Provider"
 K DIR S DIR("A")="Which Option (number)",DIR(0)="N^1:3"
 D ^DIR S DGOPT=+Y  Q:$D(DIRUT)
 ;--class
 I DGOPT=2 D  Q
 . K DIR S DIR("A")="Which Class",DIR(0)="P^7:EQZM"
 . D ^DIR S DGSCN=+Y
 ;--specialty
 I DGOPT=1 D  Q
 . K DIR S DIR("A")="Which Specialty",DIR(0)="P^45.7:EQZM"
 . D ^DIR S DGSCN=+Y
 ;--select provider
 K DIC S DIC("A")="Which Provider:  ",DIC=200,DIC(0)="AEQZM"
 S DIC("S")="I $D(^XUSEC(""PROVIDER"",+Y))"
 D ^DIC S DGPR=+Y Q
 ;
COPY ;--number of copies
 K DIR S DIR("A")="How Many Copies",DIR(0)="N^1:10",DIR("B")=1
 D ^DIR S DGNUM=Y Q
 ;
SUMM ;--print summaries at end of each provider?
 W !!,"Include in Report:",!,"(1) Individual Provider Lists Only"
 W !,"(2) Summary Page Only",!,"(3) BOTH"
 K DIR S DIR(0)="N^1:3",DIR("A")="Choose number"
 D ^DIR S DGSUMPG=Y Q
 ;
SCRN ;--include awaiting trans deficiency?
 K DIR S DIR(0)="Y",DIR("B")="NO"
 S DIR("A")="Include 'AWAITING TRANS' deficiencies"
 D ^DIR S DGSCRN='Y Q
 ;
DEV ;--device selection
 S %ZIS="PQ" D ^%ZIS Q
 ;
QUE ;--queued output     
 K IO("Q") S ZTRTN="EN^ADGDSIP",ZTDESC="PRINT CHART DEFICIENCY LIST"
 N I F I="DGPR","DGDEL","DGNUM","DGSUMPG","DGSCRN","DGOPT","DGSCN" S ZTSAVE(I)=""
 D ^%ZTLOAD,^%ZISC K ZTSK Q
 ;
EN ;EP; --queued entry point
 D:'DGPR PA D:DGPR P1 D ^ADGDSIP1,Q Q
 ;
PA ;--all providers
 F  S DGPR=$O(^ADGDSI("AC",DGPR)) Q:'DGPR  D
 . I DGOPT=2 D:$P($G(^VA(200,+DGPR,"PS")),U,5)=DGSCN P1 Q
 . D P1
 Q
 ;
P1 ;--one provider
 N DFN,DS,PM
 S DFN=0 F  S DFN=$O(^ADGDSI("AC",DGPR,DFN)) Q:'DFN  D
 . F DS=0:0 S DS=$O(^ADGDSI("AC",DGPR,DFN,DS)) Q:'DS  D
 .. I DGOPT=1,$P($G(^ADGDSI(DFN,"DT",DS,0)),U,5)'=DGSCN Q
 .. F PM=0:0 S PM=$O(^ADGDSI("AC",DGPR,DFN,DS,PM)) Q:'PM  D 1
 Q
 ;
1 ;
 NEW NM,CHT,N,SUM,OPD,OPR,PRN,CD,DSD
 S NM=$P($G(^DPT(DFN,0)),U),CHT=$P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)
 ;discharge date ;date summary dictated ;date op report dictated
 S N=$G(^ADGDSI(DFN,"DT",DS,0)) Q:N=""
 S DSD=$P(N,U),OPD=$P(N,U,2),OPR=$P(N,U,3)
 S PRN=$P($G(^VA(200,+DGPR,0)),U)
 ;--chart deficiencies
 N X,X1 S CD="",X=0
 F  S X=$O(^ADGDSI(DFN,"DT",DS,"P",PM,"CD",X)) Q:'X  D
 . S X1=$P(^ADGDSI(DFN,"DT",DS,"P",PM,"CD",X,0),U)
 . I DGSCRN Q:^ADGCD(X1,0)["AWAITING TRANS"
 . S CD=$S(CD="":X1,1:CD_U_X1)
 ;--utility
 Q:CD=""  S ^TMP("DGZICPL",$J,PRN,DSD,NM,DFN)=CHT_U_OPD_U_OPR_U_CD Q
 ;
Q ;--cleanup
 K DGPR,DIR,POP,DGFLG,DGDEL,DGSUMPG,DGSCRN,DGNUM,DGOPT,DGSCN
 D HOME^%ZIS Q