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

ACDPCCLS.m

Go to the documentation of this file.
ACDPCCLS ;IHS/ADC/EDE/KML - GEN PCC LINK/HC;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
 ; This routine generates a PCC link or prints a hardcopy from a
 ; patient's CDMIS visit.
 ;
START ;
 NEW ACDFHCP,ACDFPCC
 D INIT
 I ACDQ D EOJ Q
 D MAIN
 Q
 ;
INIT ;
 D:'$D(ACD6DIG) ^ACD
 S ACDQ=1
 S DIR(0)="SO^1:PCC LINK;2:HARDCOPY",DIR("A")="Generate PCC link or hardcopy",DIR("B")="2" K DA D ^DIR K DIR
 Q:$D(DIRUT)
 S ACDOPT=Y
 S (ACDFHCP,ACDFPCC)=0
 S:ACDOPT=1 ACDFPCC=1
 S:ACDOPT=2 ACDFHCP=1
 I ACDFPCC S X=1 D ^ACDPCCLC I '$D(X) H 3 Q
 S ACDMODE="A" ;    ***** ADD, EDIT, or DELETE *****
 S ACDQ=0
 Q
 ;
HCP ; EP-GENERATE HARDCOPY FOR SELECTED PATIENTS/VISITS
 ;//option file
 NEW ACDFHCP,ACDFPCC
 S ACDFPCC=0
 S ACDFHCP=1,ACDMODE="A",ACDQ=0
 D MAIN
 Q
 ;
MAIN ;
 F  D PATLOOP Q:ACDQ
 D EOJ
 Q
 ;
PATLOOP ; DISPLAY PATIENTS UNTIL DONE
 D GETPAT
 Q:ACDQ
 D GETVSITS^ACDDEU ;       gather all visits for patient
 Q:ACDQ
 D SELECT ;                select visit to display
 Q:ACDQ
 D GENOUTP ;               print hardcopy or gen pcc link
 Q
 ;
GETPAT ; GET PATIENT
 S ACDQ=1
 S AUPNLK("ALL")=1
 S DIC="^AUPNPAT(",DIC(0)="AEMQ",DIC("S")="I $D(^ACDVIS(""D"",Y))" D DIC^ACDFMC
 K AUPNLK("ALL")
 Q:Y<0
 S ACDDFNP=+Y,ACDDFN=$P(^DPT(ACDDFNP,0),U)
 S ACDQ=0
 Q
 ;
SELECT ; SELECT A CDMIS VISIT
 S ACDQ=1
 W !
 S ACDVIEN=0
 K ACDVLST
 I $O(^TMP("ACD",$J,"VISITS",0))="" W !,"----------",!,"No CDMIS visits!",!,"----------",! Q
 S ACDDTLOW=0,ACDDTHI=9999999
 I ACDVCNT>20 D GETDTRNG Q:ACDQ  W !
 S ACDQ=1
 W !
 S ACDLC=0
 S ACDX=ACDDTLOW S:ACDX>0 ACDX=ACDX-1
 F  S ACDX=$O(^TMP("ACD",$J,"VISITS",ACDX)) Q:ACDX=""  I ACDX'<ACDDTLOW,ACDX'>ACDDTHI S ACDY=0 F  S ACDY=$O(^TMP("ACD",$J,"VISITS",ACDX,ACDY)) Q:'ACDY  D  Q:ACDQ
 . S ACDQ=0
 . S ACDLC=ACDLC+1
 . S ACDVLST(ACDLC)=ACDY
 . S DIC="9002172.1",DA=ACDY,DR=".01;1;3;5",DIQ="ACDPDD("
 . D DIQ1^ACDFMC
 . W ACDLC,?5,ACDPDD(9002172.1,ACDY,.01),?18," - ",ACDPDD(9002172.1,ACDY,1),"/",ACDPDD(9002172.1,ACDY,5)," ",ACDPDD(9002172.1,ACDY,3),!
 . K ACDPDD
 . I '(ACDLC#20) D PAUSE^ACDDEU S:$D(DIRUT) ACDQ=1
 . Q
 S ACDQ=1
 I 'ACDLC W !,"No visits in date range",! Q
 S DIR(0)="NO^1:"_ACDLC,DIR("A")="Select one of the listed visits" K DA D ^DIR K DIR
 S:Y ACDVIEN=ACDVLST(Y)
 K ACDLC,ACDVLST
 Q:'ACDVIEN
 S ACDQ=0
 Q
 ;
GETDTRNG ; GET DATE RANGE FOR VISIT
 S ACDQ=1
 S ACDDTLOW=$O(^TMP("ACD",$J,"VISITS",0)),ACDDTHI=$O(^TMP("ACD",$J,"VISITS","Z"),-1)
 W !,"Patient has ",ACDVCNT," visits between ",$$FMTE^XLFDT(ACDDTLOW,"1")," and ",$$FMTE^XLFDT(ACDDTHI,"1"),".",!,"Enter date range of desired visit.",!
 S DIR(0)="DO^::E",DIR("A")="Enter beginning date" K DA D ^DIR K DIR
 Q:'Y
 S ACDDTLOW=Y
 S DIR(0)="D^"_Y_"::E",DIR("A")="Enter ending date",DIR("B")=X K DA D ^DIR K DIR
 Q:$D(DIRUT)
 S ACDDTHI=Y
 S ACDQ=0
 Q
 ;
GENOUTP ; EP - PRINT HARDCOPY OR GENERATE PCC LINK FOR CDMIS VISIT
 I ACDFPCC,$O(^ACDVIS(ACDVIEN,21,0)) W !!,"This visit already has an associated PCC visit!",! Q
 S X=$P(^ACDVIS(ACDVIEN,0),U,4)
 I X'="IN",X'="RE",X'="FU",X'="IR",X'="OT",X'="TD",X'="CS" W !,"INVALID TYPE CONTACT",!
 E  S ACDCONT=X D @("SET"_ACDCONT)
 I 'ACDQ S ACDPCCLS=1 D VISIT^ACDPCCL K ACDPCCLS
 Q
 ;
SETIN ; INITIAL
 D SETIIF
 Q
 ;
SETRE ; REOPEN
 D SETIIF
 Q
 ;
SETFU ; FOLLOWUP
 D SETIIF
 Q
 ;
SETIIF ; HARDCOPY FROM IIF ENTRY
 S ACDQ=1
 K ACDPCCL
 S Y=$O(^ACDIIF("C",ACDVIEN,0))
 Q:'Y
 S ACDPCCL(ACDDFNP,ACDVIEN,"IIF",Y)=""
 S ACDPCCL(ACDDFNP,ACDVIEN)=""
 S ACDQ=0
 Q
 ;
SETTD ; HARDCOPY FROM TDC ENTRY
 S ACDQ=1
 K ACDPCCL
 S Y=$O(^ACDTDC("C",ACDVIEN,0))
 Q:'Y
 S ACDPCCL(ACDDFNP,ACDVIEN,"TDC",Y)=""
 S ACDPCCL(ACDDFNP,ACDVIEN)=""
 S ACDQ=0
 Q
 ;
SETCS ; HARDCOPY OR PCC LINK FROM CLIENT SERVICES
 S ACDY=0
 F  S ACDY=$O(^ACDCS("C",ACDVIEN,ACDY)) Q:'ACDY  D
 . S ACDPCCL(ACDDFNP,ACDVIEN,"CS",ACDY)=""
 . Q
 Q
 ;
EOJ ;
 K ACDEV,ACDPCCL
 D ^ACDKILL
 Q