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

ACDDE2.m

Go to the documentation of this file.
ACDDE2 ;IHS/ADC/EDE/KML - GATHER MAINLINE INFO;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
INIT ; EP
 S ACDQ=1,ACDDE=1
 Q:'$D(IOF)
 Q:'$G(DUZ(2))
 Q:'$D(^ACDF5PI(DUZ(2),0))  ;   should never happen
 S ACDPGM=DUZ(2)
 Q:'$D(IO)
 S Y=$O(^%ZIS(1,"C",IO,0)) I Y S Y=$P($G(^%ZIS(1,Y,"SUBTYPE")),U) I Y S X=$G(^%ZIS(2,Y,5)),ACDRVON=$P(X,U,4),ACDRVOF=$P(X,U,5)
 I $G(ACDRVON)="" S ACDRVON="""""",ACDRVOF=""""""
 S ACDDUZZ=DUZ(2)
 K ^TMP("ACD",$J),^TMP($J)
 S (ACDCOMC,ACDCOMCL,ACDCOMT,ACDCOMTL)=""
 D HDR^ACDDEU
 D GETCOMP ;              ACDQ set to 0 if all ok
 Q
 ;
GETCOMP ; EP - GET COMPONENT
 S (ACDCOMC,ACDCOMT,ACDCOMTL)=""
 D GETCOMPC
 Q:ACDQ
 D GETCOMPT
 Q
 ;
GETCOMPC ; EP - GET COMPONENT CODE
 S ACDQ=1
 S Y=$G(^DISV(DUZ,"^ACDCOMP(")) I Y,$D(^ACDCOMP(Y,0)) S DIC("B")=$P(^ACDCOMP(Y,0),U)
 S DIC="^ACDCOMP(",DIC(0)="AEMQZ",DIC("A")="COMPONENT (CODE): ",DIC("S")="S %=$P(^(0),U,2) I %'=""CLO"",%'=""DIS"""
 D DIC^ACDFMC
 Q:Y<0
 S ACDCOMC=+Y,ACDCOMCL=Y(0,0)
 S ACDIO=$P(Y(0),U,3) ;          set for INPUT TEMPLATEs
 S ACDQ=0
 Q
 ;
GETCOMPT ; EP -  GET COMPONENT TYPE
 S ACDQ=1
 S Y=+$O(^ACDVIS("A"),-1)
 I Y S DIR("B")=$P(^ACDVIS(Y,0),U,7)
 S DIR(0)="9002172.1,5",DIR("A")="COMPONENT (TYPE)" K DA D ^DIR K DIR
 Q:$D(DIRUT)
 Q:Y<0
 S ACDCOMT=Y,ACDCOMTL=Y(0)
 S ACDQ=0
 Q
 ;
GETPROV ; EP - GET PRIMARY PROVIDER
 S ACDQ=1
 I $D(^TMP("ACD",$J,"PRI PROV")) S DIC("B")=^("PRI PROV") I 1
 E  S Y=+$G(^DISV(DUZ,"^VA(200,")) I Y S X=$P($G(^VA(200,Y,0)),U) S:X'="" DIC("B")=X
 ;E  S Y=+$G(^DISV(DUZ,"^DIC(6,")) I Y D PFTV^XBPFTV(6,Y,.X) S:X'="" DIC("B")=X
 ;S DIC="^DIC(6,",DIC(0)="AEMQ",DIC("A")="PRIMARY PROVIDER: " D DIC^ACDFMC
 S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="PRIMARY PROVIDER: ",DIC("S")="I $D(^XUSEC(""PROVIDER"",+Y))" D DIC^ACDFMC
 Q:Y<0
 S ACDPROV=+Y
 S ACDPROVN=$P(Y,U,2)
 ;D PFTV^XBPFTV(6,ACDPROV,.ACDPROVN)
 S ^TMP("ACD",$J,"PRI PROV")=ACDPROVN
 S ACDQ=0
 Q
 ;
GETTC ; EP - GET TYPE CONTACT
 S ACDQ=1
 I $D(^TMP("ACD",$J,"TYPE CONTACT")) S DIR("B")=^("TYPE CONTACT") I 1
 E  S Y=+$O(^ACDVIS("A"),-1) I Y S DIR("B")=$P(^ACDVIS(Y,0),U,4)
 K:$G(ACDNODEF) DIR("B"),ACDNODEF
 S DIR(0)="9002172.1,3O",DIR("A")="TYPE CONTACT" K DA D ^DIR K DIR
 Q:$D(DIRUT)
 Q:Y<0
 S ACDCONT=Y,ACDCONTL=Y(0)
 S ^TMP("ACD",$J,"TYPE CONTACT")=ACDCONTL
 S ACDQ=0
 Q
 ;
GETVDATE ; EP - GET VISIT DATE (IF OLD LOOP UNTIL ACCEPTED OR REJECTED)
 F  D GETVDAT2 Q:ACDQ  D  Q:'ACDQ
 . S X1=$E(DT,1,5)_"01",X2=$E(ACDVDTI,1,5)_"01"
 . D ^%DTC
 . I X>90 S DIR(0)="YO",DIR("A")="VISIT DATE over 90 days ago.  Do you really want this date",DIR("B")="N" K DA D ^DIR K DIR
 . Q:Y
 . K ^TMP("ACD",$J,"VISIT DATE")
 . S ACDQ=1
 . Q
 Q
 ;
GETVDAT2 ; EP - GET SINGLE VISIT DATE
 S ACDQ=1
 ;I $D(^TMP("ACD",$J,"VISIT DATE")) S X=^("VISIT DATE") I $E(X,6,7)'="00" S Y=X D D^DIQ S X=Y,DIR("B")=X
 I $D(^TMP("ACD",$J,"VISIT DATE")) S X=^("VISIT DATE") D
 . I ACDCONT="CS",$E(X,6,7)'="00" Q
 . I ACDCONT'="CS",$E(X,6,7)="00" Q
 . S Y=X D D^DIQ S X=Y,DIR("B")=X
 . Q
 K:$G(ACDNODEF) DIR("B"),ACDNODEF
 S DIR(0)="9002172.1,.01",DIR("A")="VISIT DATE" K DA D ^DIR K DIR
 Q:$D(DIRUT)
 I ACDCONT="CS",$E(Y,6,7)'="00" D
 . S $E(Y,6,7)="00"
 . S ACDY=Y D D^DIQ S Y(0)=Y,Y=ACDY
 . W !,"CLIENT SERVICE record for month & year only.  Using ",Y(0),".",!
 . NEW Y D PAUSE^ACDDEU
 . Q
 S (ACDDOV,ACDVDTI)=Y,ACDVDTE=Y(0)
 S ^TMP("ACD",$J,"VISIT DATE")=ACDVDTI
 S ACDQ=0
 Q
 ;
HELP ; EP - HELP FOR VISIT DATE
 ;//^DIR
 Q