BCHULV ; IHS/CMI/LAB - PTS LAST CHR VISIT ;
;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
;
;
START ;EP display patients last visit
D GETPAT
I 'BCHPAT,'BCHNRPAT D XIT Q
D GETREC
I 'BCHR D XIT Q
D FORMAT
Q:BCHTYPE=""
ZIS ;
S XBRC="COMP^BCHULV",XBRP=$S(BCHTYPE="C":"PRINT1^BCHUFPP",1:"^BCHUDSP"),XBNS="BCH",XBRX="XIT^BCHULV"
D ^XBDBQUE
D XIT
Q
XIT ;
D KILL^AUPNPAT
K BCHVDFN,BCHVDG,BCHVDSH,BCHVFU,BCHVI,BCHVIGR,BCHVL,BCHVNM,BCHX,BCHBRK,BCHTYPE,BCHDLAST,BCHR11,BCHR12,BCHRNODE,BCHRPRNM
K ZTSK,Y,BCHBD,BCHED,IO("Q"),BCH80D,BCHBTH,BCHHRCN,BCHJOB,BCHUNG,BCHPCNT,BCHPG,BCHPROV,BCHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D,BCHC
K BCHPRNM,BCHPRNT,BCHPROB,BCHPRV,BCHR,BCHRCNT,BCHRLOC,BCHSD,BCHTOT,BCHBDD,BCHBT,BCHEDD,BCHEDO,BCHBDO,BCHBT,BCHFOUND,BCHHIT,BCHID,BCHLINE,BCHP,BCHHRN,BCHODAT,BCHQUIT,BCHR0,BCHTICL,BCHTNRQ,BCHTQ,BCHTTXT
K BCHPAT
Q
GETPAT ;EP - GET PATIENT
S BCHPAT="",BCHNRPAT=""
W !!,"Please enter the Patient. You may enter a Registered Patient or",!,"a Non Registered Patient.",!
S DIR(0)="90002,8901",DIR("A")="Enter Patient Name" KILL DA D ^DIR KILL DIR
;S DIC("A")="Enter PATIENT (if known): ",DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
Q:Y<0
I Y["BCHRPAT" S BCHNRPAT=+Y Q
S BCHPAT=+Y
Q
;
GETREC ;
S BCHR=""
I BCHPAT D Q
.I '$D(^BCHR("AE",BCHPAT)) W !!,"No records on file for this patient.",! Q
.S BCHDLAST=$O(^BCHR("AE",BCHPAT,"")),BCHR=$O(^BCHR("AE",BCHPAT,BCHDLAST,""))
I BCHNRPAT D Q
.I '$D(^BCHR("ANRE",BCHNRPAT)) W !!,"No records on file for this patient.",! Q
.S BCHDLAST=$O(^BCHR("ANRE",BCHNRPAT,"")),BCHR=$O(^BCHR("ANRE",BCHNRPAT,BCHDLAST,""))
Q
FORMAT ;
S BCHTYPE=""
S DIR(0)="S^C:CHR PCC Form Format;S:Standard Display",DIR("A")="Select Print Format",DIR("B")="C" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q:$D(DIRUT)
S BCHTYPE=Y
Q
COMP ;
Q
BCHULV ; IHS/CMI/LAB - PTS LAST CHR VISIT ;
+1 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
+2 ;
+3 ;
START ;EP display patients last visit
+1 DO GETPAT
+2 IF 'BCHPAT
IF 'BCHNRPAT
DO XIT
QUIT
+3 DO GETREC
+4 IF 'BCHR
DO XIT
QUIT
+5 DO FORMAT
+6 IF BCHTYPE=""
QUIT
ZIS ;
+1 SET XBRC="COMP^BCHULV"
SET XBRP=$SELECT(BCHTYPE="C":"PRINT1^BCHUFPP",1:"^BCHUDSP")
SET XBNS="BCH"
SET XBRX="XIT^BCHULV"
+2 DO ^XBDBQUE
+3 DO XIT
+4 QUIT
XIT ;
+1 DO KILL^AUPNPAT
+2 KILL BCHVDFN,BCHVDG,BCHVDSH,BCHVFU,BCHVI,BCHVIGR,BCHVL,BCHVNM,BCHX,BCHBRK,BCHTYPE,BCHDLAST,BCHR11,BCHR12,BCHRNODE,BCHRPRNM
+3 KILL ZTSK,Y,BCHBD,BCHED,IO("Q"),BCH80D,BCHBTH,BCHHRCN,BCHJOB,BCHUNG,BCHPCNT,BCHPG,BCHPROV,BCHX,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,XBNS,XBRC,XBRP,XBTX,D,BCHC
+4 KILL BCHPRNM,BCHPRNT,BCHPROB,BCHPRV,BCHR,BCHRCNT,BCHRLOC,BCHSD,BCHTOT,BCHBDD,BCHBT,BCHEDD,BCHEDO,BCHBDO,BCHBT,BCHFOUND,BCHHIT,BCHID,BCHLINE,BCHP,BCHHRN,BCHODAT,BCHQUIT,BCHR0,BCHTICL,BCHTNRQ,BCHTQ,BCHTTXT
+5 KILL BCHPAT
+6 QUIT
GETPAT ;EP - GET PATIENT
+1 SET BCHPAT=""
SET BCHNRPAT=""
+2 WRITE !!,"Please enter the Patient. You may enter a Registered Patient or",!,"a Non Registered Patient.",!
+3 SET DIR(0)="90002,8901"
SET DIR("A")="Enter Patient Name"
KILL DA
DO ^DIR
KILL DIR
+4 ;S DIC("A")="Enter PATIENT (if known): ",DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
+5 IF Y<0
QUIT
+6 IF Y["BCHRPAT"
SET BCHNRPAT=+Y
QUIT
+7 SET BCHPAT=+Y
+8 QUIT
+9 ;
GETREC ;
+1 SET BCHR=""
+2 IF BCHPAT
Begin DoDot:1
+3 IF '$DATA(^BCHR("AE",BCHPAT))
WRITE !!,"No records on file for this patient.",!
QUIT
+4 SET BCHDLAST=$ORDER(^BCHR("AE",BCHPAT,""))
SET BCHR=$ORDER(^BCHR("AE",BCHPAT,BCHDLAST,""))
End DoDot:1
QUIT
+5 IF BCHNRPAT
Begin DoDot:1
+6 IF '$DATA(^BCHR("ANRE",BCHNRPAT))
WRITE !!,"No records on file for this patient.",!
QUIT
+7 SET BCHDLAST=$ORDER(^BCHR("ANRE",BCHNRPAT,""))
SET BCHR=$ORDER(^BCHR("ANRE",BCHNRPAT,BCHDLAST,""))
End DoDot:1
QUIT
+8 QUIT
FORMAT ;
+1 SET BCHTYPE=""
+2 SET DIR(0)="S^C:CHR PCC Form Format;S:Standard Display"
SET DIR("A")="Select Print Format"
SET DIR("B")="C"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF $DATA(DIRUT)
QUIT
+4 SET BCHTYPE=Y
+5 QUIT
COMP ;
+1 QUIT