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

ADEPQA.m

Go to the documentation of this file.
ADEPQA ; IHS/HQT/MJL  - QA ENGINE ;11:07 AM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;
 K ^ADEUTL("ADEPQA",$J),ADEEXT ;^ADEUTL is a transient working global
 N ADEHXO,ADEHXC,ADESTP,ADEDATE,ADEAGE,ADEPROV,ADEHYG,ADELOC,ADEJ,ADEROPT,ADETFIL,ADETNAM,ADETDFN,ADEADA,BY,FLDS,FR,TO,DIC,DHD,ZTSK
CTRL D SEARCH G:$$HAT() END ;Set up Search parameters
CTRL1 D OUTPUT^ADEPQA1B G:$$HAT() CTRL ;Select Output Format & template
EN ;EP - Enter here with above predefined
 D ASKDEV^ADEPQA1B I POP K POP G END
 ;FHL 9/9/98 I $D(ZTSK) G END
 I $D(ZTQUEUED) G END
ZTM ;EP -
 D ROLL ;$O through entries and screen accdng to criteria
 I '$D(^DIBT(ADETDFN,1)) G END ;W !,"NO MATCHES" G END ;Improve msg
 I '$D(ADEEXT) D PRINT ;Print Report
 ;
END Q:$D(ADEEXT)  ;ADEEXT means it's an external call which is
 ;  doing its own device handling
 D ^%ZISC
 I $D(ZTQUEUED) D
 . D KILL^%ZTLOAD
 . I $D(ADETNAM),ADETNAM?1"ADEQA"1.5N D DELTMP(ADETDFN)
 I '$D(ZTQUEUED) D
 . ;FHL 9/9/98 I '$D(ZTSK),$D(ADETNAM),ADETNAM?1"ADEQA"1.5N D DELTMP(ADETDFN)
 . I '$D(ZTQUEUED),$D(ADETNAM),ADETNAM?1"ADEQA"1.5N D DELTMP(ADETDFN)
 Q
 ;
PRINT ;
 N ADEDUZ,ADEY
 D EN1^DIP
 Q
 ;
 W !!,?5,"***STEP ONE: Select SEARCH PARAMETERS***"
 S ADESTP=$$STP^ADEPQA3() Q:$$HAT()
SRCH1 S ADEDATE=$$DATE^ADEPQA3() G:$$HAT() SEARCH
SRCH2 S ADEAGE=$$AGE^ADEPQA3() G:$$HAT() SRCH1
SRCH3 S ADEPROV=$$PROV^ADEPQA3() G:$$HAT() SRCH2
SRCH4 S ADEHYG=$$HYG^ADEPQA3() G:$$HAT() SRCH3
SRCH5 S ADELOC=$$LOC^ADEPQA3() G:$$HAT() SRCH4
 F ADEJ=1:1:1 S ADEADA(ADEJ)=$$ADA^ADEPQA3A()
 G:$$HAT() SRCH5
 I '$$CHK^ADEPQA4() G SEARCH ;Ask user to verify search params
 Q
 ;
ROLL ;EP - At this point, all variables needed to do the report are defined
 ;This subrtn $O's through ADEPCD using the DATE xref (or the PRO
 ;VIDER xref if it's provider-limited but not date-limited)
 ;Hits are stored in the template.
 N ADEHXC,ADEHXO
 I +ADESTP,$P(ADESTP,U,3)="9002007" D  Q
 . N ADEDFN,ADESTD
 . S ADESTD=$P(ADESTP,U,2)
 . S ADEDFN=0
 . F  S ADEDFN=$O(^DIBT(ADESTD,1,ADEDFN)) Q:'+ADEDFN  D SCREEN(ADEDFN)
 I +ADESTP,$P(ADESTP,U,3)="9000001" D  Q
 . N ADEDFN,ADESTD,ADEBEG,ADEND,ADEPAT
 . S ADESTD=$P(ADESTP,U,2)
 . S ADEPAT=0
 . S ADEND=$P(ADEDATE,U,3)
 . F  S ADEPAT=$O(^DIBT(ADESTD,1,ADEPAT)) Q:'+ADEPAT  S ADEBEG=$P(ADEDATE,U,2)-1 D
 . . F  S ADEBEG=$O(^ADEPCD("DATE",ADEPAT,ADEBEG)) Q:'+ADEBEG  Q:ADEBEG>ADEND  S ADEDFN=0 D
 . . . F  S ADEDFN=$O(^ADEPCD("DATE",ADEPAT,ADEBEG,ADEDFN)) Q:'+ADEDFN  D SCREEN(ADEDFN)
 ;
 I +ADEDATE,$P(ADEROPT,U,2)'["PATIENT" D  Q
 . N ADEBEG,ADEND,ADEDFN
 . S ADEBEG=$P(ADEDATE,U,2)-1,ADEND=$P(ADEDATE,U,3)
 . F  S ADEBEG=$O(^ADEPCD("AC",ADEBEG)) Q:ADEBEG>ADEND  Q:'+ADEBEG  S ADEDFN=0 D
 . . F  S ADEDFN=$O(^ADEPCD("AC",ADEBEG,ADEDFN)) Q:'ADEDFN  D SCREEN(ADEDFN)
 I +ADEDATE,$P(ADEROPT,U,2)["PATIENT" D  Q
 . N ADEBEG,ADEND,ADEDFN,ADEPAT
 . S ADEPAT=0
 . S ADEND=$P(ADEDATE,U,3)
 . F  S ADEPAT=$O(^ADEPCD("DATE",ADEPAT)) Q:'+ADEPAT  S ADEBEG=$P(ADEDATE,U,2)-1 D
 . . F  S ADEBEG=$O(^ADEPCD("DATE",ADEPAT,ADEBEG)) Q:ADEBEG>ADEND  Q:'+ADEBEG  S ADEDFN=0 D
 . . . F  S ADEDFN=$O(^ADEPCD("DATE",ADEPAT,ADEBEG,ADEDFN)) Q:'+ADEDFN  D SCREEN(ADEDFN)
 Q
 K ADESTD,ADETFIL,ADETNAM ;*NE
 ;------->SUB-SUBROUTINES
SCREEN(ADEDFN) ;
 ;Applies screens to ADEPCD entry ADEDFN
 N ADENOD
 S ADENOD=^ADEPCD(ADEDFN,0)
 I +ADESTP,$P(ADESTP,U,3)="9002007",'$$DATSCN^ADEPQA1C(ADENOD) Q
 I +ADEAGE,'$$AGESCN^ADEPQA1C(ADENOD) Q
 I +ADELOC,'$$LOCSCN^ADEPQA1C(ADENOD) Q
 I +ADEPROV,'$$PRVSCN^ADEPQA1C(ADENOD) Q
 I +ADEHYG,'$$HYGSCN^ADEPQA1C(ADENOD) Q
 I +ADEADA(1),'$$CODSCN^ADEPQA1D(ADEDFN) Q
 D HIT(ADEDFN)
 Q
HIT(ADEDFN) ;
 ;Adds ADEDFN to whatever template we're using
 I $P(ADEROPT,U,2)="DENTAL" S ^DIBT(ADETDFN,1,ADEDFN)=""
 E  S ^DIBT(ADETDFN,1,$P(^ADEPCD(ADEDFN,0),U))=""
 Q
 ;------->FUNCTIONS
HAT() ;EP
 I $D(DTOUT)!($D(DUOUT))!($D(DIROUT)) Q 1
 Q 0
 ;
TMPLAT(ADETNAM,ADETFIL) ;EP
 ;Creates entry in SORT TEMPLATE file attached to file # ADETFIL
 ;Returns template DFN
 N DIC,X,DD,D0,Y,DR,DO
 S DIC="^DIBT(",X=ADETNAM,DIC(0)="LZ",DIC("DR")="4///"_ADETFIL_";5///"_DUZ K DD,DO D FILE^DICN
 Q +Y
 ;
 ;
DELTMP(ADETDFN) ;EP - Deletes template ADETDFN
 N DR,DA,DIE
 S DA=ADETDFN
 S DR=".01///@",DIE="^DIBT("
 D ^DIE
 Q