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

ACDWDRV3.m

Go to the documentation of this file.
ACDWDRV3 ;IHS/ADC/EDE/KML - DRV 3 FOR CONFIDENTIAL CLIENT REPORTS;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;//[ACDR4MENU]
 ;
 F  K ACDQUIT D DIR I $D(ACDQUIT) D PRHDR^ACD G ^ACDWK
DIR ;Menu
 S ACDWDRV(3)=3
 D PRHDR^ACD
 ;S:'$D(ACD56) $P(ACD56,"*",56)="*"
 ;W !,ACD56,!,"CLIENT DETAIL REPORTS",!,"CONFIDENTIAL CLIENT INFORMATION UNDER CFR 42 PART 2",!,ACD56,!
 F I=100:1:107 W !,I,"  ",$P($T(@I),";",3) I I=107 S DIR(0)="L^100:107^S ACDRPTS=Y",DIR("A")="RUN REPORT # " W ! D ^DIR S:X["^"!($D(DTOUT)) ACDQUIT=1 Q:$D(ACDQUIT)
 I $D(ACDQUIT) K ACDWDRV Q
 ;Run for selected patient or all patients
 K ACDPT
 S DIR("A")="SELECTION",DIR(0)="S^1:DISPLAY ALL PATIENTS;2:DISPLAY SELECTED PATIENTS" D ^DIR S:X["^"!($D(DTOUT))!(X="") ACDQUIT=1
 Q:$D(ACDQUIT)
 I X=2 D
 .S DIC("A")="Inquire on patient: "
 .S AUPNLK("ALL")=1
 .F  S DIC(0)="AEQM",DIC=9000001 D ^DIC Q:Y<0  S ACDPT(1_ACD6DIG_+Y)=""
 .K AUPNLK("ALL")
 .I '$D(ACDPT) S ACDQUIT=1
 .Q
 Q:$D(ACDQUIT)
 D ^ACDWRQ I $D(ACDQUIT) K ACDQUIT Q
 D ^ACDWQ ;        call to XBDBQUE
 Q
 ;
L ;EP - FOR TASKMAN
 Q
 ;
P ;EP - PRINT REPORT
 K DIRUT
 S ACDNW(1)=ACDTO,ACDNW(2)=ACDFR,ACDNW(3)=ACDLOC,ACDNW(4)=ACDRPTS
 F ACDNW(0)=1:1:$L(ACDNW(4),",")-1 S ACDTO=ACDNW(1),ACDFR=ACDNW(2),ACDLOC=ACDNW(3),(ACDTG,ACDTGSUB)=$P(ACDNW(4),",",ACDNW(0)) D ACDV Q:$D(DIRUT)
 Q  ; ***** EDE/added this Q.  Seems reasonable not to fall thru *****
ACDV ;Order on visit date
 D @ACDTG
 Q
100 ;;INITIAL
101 ;;REOPEN
102 ;;INFO/REFERRAL
103 ;;FOLLOWUP
104 ;;CRISIS/BRIEF INT
 K ^TMP("ACD",ACDJOB,ACDBT) S ACDDO=0
 F ACD=ACDFR-.01:0 S ACD=$O(^ACDVIS("B",ACD)) Q:'ACD!(ACD>ACDTO)  S ACDV=0 F  S ACDV=$O(^ACDVIS("B",ACD,ACDV)) Q:'ACDV  S ACD1=0 F  S ACD1=$O(^ACDIIF("C",ACDV,ACD1)) Q:'ACD1  S ACDDA=ACD1 D ^ACDWIIF S ACDDA=ACDV D ^ACDWVIS I ACDOK,ACDDFNP D B
 G HED
 ;
105 ;;TRANS/DISC/CLOSE
 K ^TMP("ACD",ACDJOB,ACDBT) S ACDDO=0
 F ACD=ACDFR-.01:0 S ACD=$O(^ACDVIS("B",ACD)) Q:'ACD!(ACD>ACDTO)  S ACDV=0 F  S ACDV=$O(^ACDVIS("B",ACD,ACDV)) Q:'ACDV  S ACD1=0 F  S ACD1=$O(^ACDTDC("C",ACDV,ACD1)) Q:'ACD1  S ACDDA=ACD1 D ^ACDWTDC S ACDDA=ACDV D ^ACDWVIS I ACDOK,ACDDFNP D B
 G HED
 ;
106 ;;CLIENT SERVICE
 K ^TMP("ACD",ACDJOB,ACDBT) S ACDDO=0
 S ACDFR=$E(ACDFR,1,5)_"00" ; date string manipulation (no day) in order for the CS visit x-ref in the visit file to be picked up
 F ACD=ACDFR-.01:0 S ACD=$O(^ACDVIS("B",ACD)) Q:'ACD!(ACD>ACDTO)  S ACDV=0 F  S ACDV=$O(^ACDVIS("B",ACD,ACDV)) Q:'ACDV  S ACD1=0 F  S ACD1=$O(^ACDCS("C",ACDV,ACD1)) Q:'ACD1  S ACDDA=ACD1 D ^ACDWCS S ACDDA=ACDV D ^ACDWVIS I ACDOK,ACDDFNP D B
 G HED
 ;
107 ;;INTERVENTIONS
 K ^TMP("ACD",ACDJOB,ACDBT) S ACDDO=0
 F ACD=ACDFR-.01:0 S ACD=$O(^ACDINTV("B",ACD)) Q:'ACD!(ACD>ACDTO)  S ACD1=0 F  S ACD1=$O(^ACDINTV("B",ACD,ACD1)) Q:'ACD1  S ACDDA=ACD1 D ^ACDWCINV,MATCH^ACDWVIS I ACDOK,ACDDFNP D B
 G HED
 ;
B ;Build utility
 ;Only build data if the visit contact type meets the contact
 ;type requested by user
 I ACDCONTL'=$P($T(@ACDTG),";",3) Q
 ;
 ;
 ;Check for selected patients only.
 I $D(ACDPT),'$D(ACDPT(ACDDFNP)) Q
 S ^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDDFN,ACD1)=""
 Q
 ;
HED ;Set header variables
 I '$D(^TMP("ACD",ACDJOB,ACDBT)) D RESET^ACDWUTL
 S ACDH(0)=$P($T(@ACDTG),";",3)_U_ACDLOC,ACDWDRV(3)=3 D HV^ACDWUTL
 U IO D H S ACDTG="G"_ACDTG D @ACDTG
 Q
 ;
H ;EP
 W @IOF,!,"CONFIDENTIAL CLIENT INFORMATION UNDER CFR 42 PART 2",!,"DETAILED CLIENT REPORT #",$S(ACDTG:ACDTG,1:$E(ACDTG,2,6)),!,"CONTACT TYPE: ",$P(ACDH(0),U) S ACDH(3)=ACDH(3)+1
 I $D(ACDPT) W !,"SELECTED PATIENTS ONLY"
 I ACDH(3)>1,$D(ACDDFN) W !,"PATIENT: ",ACDDFN
 W ?68,"PG ",ACDH(3),!,ACDH(50),$P(ACDH(0),U,2),! D ASF^ACDWUTL W !,"DATA CAPTURED FOR: ",ACDH(2),!,ACDH(4),!
 I ACDTG="G106"!(ACDTG=106) W !,"DAY",?5,"SERVICE",?33,"LOCATION",?50,"HRS",?71,"PROVIDER"
 W !,ACDH(1)
 Q
G100 ;
G101 ;
G102 D ^ACDWCD80 Q
G103 D ^ACDWCD70 Q
G104 D ^ACDWCD60 Q
G105 D ^ACDWCD2 Q
G106 D ^ACDWCD3 Q
G107 D ^ACDWCD4 Q
 ;
EOJ ;EP - EOJ FOR XBDBQUE
 K ^TMP("ACD",ACDJOB,ACDBT)
 LOCK -^TMP("ACD",ACDJOB,ACDBT)
 K ACDNW,ACDQ,ACDFAC,ACDAREA,ACDSU,ACDTRB,ACDSTA
 K ACDAGE,ACDBT,ACDFOLL,ACDH,ACDHRS,ACDJOB,ACDOK,ACDOPT,ACDPLAAL,ACDPLARL,ACDPT,ACDSTAT,ACDTG,ACDTGSUB,ACDVET,ACDWDRV
 Q