VistA-WorldVistAEHR/r/MEDICINE-MC/MCARPCE.m

46 lines
2.4 KiB
Mathematica

MCARPCE ;WISC/TJK-ENTER/EDIT ROUTINE FOR PACEMAKER SURVEILLANCE ;5/2/96 08:54
;;2.3;Medicine;**31**;09/13/1996
START S DIC="^MCAR(698.3,",DIC(0)="AEQLM",(MCFILE,DLAYGO,DIDEL)=698.3,DIC("DR")=".01;1//"_$G(MCPATNM)
S DIC("A")="Enter Patient Name, or Date and Time: "
S DIC("B")=$G(MCPATNM)
W @IOF,"SURVEILLANCE PROCEDURES"
I $G(DJSC) W " *** SCREEN EDIT ***"
E I $G(MCBL)=1 W " *** BRIEF EDIT ***"
W !!!
D ^DIC G EXIT:Y<0 S MCARGDA=+Y S MCARNEW="" S:$P(Y,U,3) MCARNEW=1
S (MCARNAM,DFN)=$P(^MCAR(698.3,+Y,0),U,2)
I 'MCARNAM S MCARNEW=1 D KILL G EXIT
I '$D(^MCAR(698,"C",MCARNAM)) D MSG G EXIT
; Get new default patient name
S MCX=$$VALUE^MCENDIQ1(MCFILE,+Y,1)
I MCX'="" S MCPATNM=MCX
; Get most recent procedure
F I=0:0 S I=$O(^MCAR(690,"AC",MCARNAM,I)) Q:I="" Q:$O(^(I,0))="MCAR(698"
I I="" D MSG G EXIT
S MCARGEN=$O(^MCAR(690,"AC",MCARNAM,I,"MCAR(698",0)) I 'MCARGEN D MSG G EXIT
I '$D(^MCAR(698,MCARGEN,0)) D MSG G EXIT
I $D(^MCAR(698,MCARGEN,1)),$P(^(1),U,1) D MSG G EXIT
I $P(^MCAR(698,MCARGEN,0),U,7)="" W !!,*7,"TYPE OF LEAD NOT DEFINED FOR THIS PATIENT IN GENERATOR FILE",!! R "PRESS RETURN TO CONTINUE: ",X:DTIME D KILL G EXIT
S MCARLEAD=$P(^MCAR(698,MCARGEN,0),U,7)
S DIE="^MCAR(698.3,",DR=3,DA=MCARGDA D ^DIE G EXIT:$D(Y),EXIT:$D(DTOUT)
S MCARFLG=$S($P(^MCAR(698.3,DA,0),U,4)["T":1,1:"")
G SCREEN1:$D(DJSC) S DR=$S($G(MCBL)=1:"[MCARPACSURVBRIEF]",1:"[MCARPACSURV]"),DA=MCARGDA,MCFILE=698.3 D ORDERA G EXIT:$D(DUOUT)!$D(DTOUT) D ^DIE,ORDER1,QTASK^MCPARAM
EXIT K %,%X,%Y,%Y2,C,D0,DA,DI,DJSC,DQ,DR,DZ,I,J,MCARFLG,MCARGDA,MCARGEN,MCARLEAD,MCARNAM,MCX,X,Y,DLAYGO,DIDEL,MCFILE,MCARNEW D EXIT^MCARGE Q
ORDERA S MCARGNUM=$O(^MCAR(697.2,"C","MCAR("_MCFILE,0))
ORDER D:'$D(MCOEON) ORDER^MCPARAM Q:'$D(MCOEON)
Q
ORDER1 G IM:'$D(MCOEON) Q:'$D(^MCAR(MCFILE,MCARGDA)) Q:$D(DTOUT)
IM D EN1^MCMAG Q
SCREEN K DJSC
S (DJSC,MCARGNUM)=$O(^MCAR(697.2,"BA","PACEMAKER SURVEILLANCE",0))
G EXIT:DJSC="",START
SCREEN1 S DJDN=MCARGDA,DJSC=$S($G(MCBS)=1:"MCPACSURVBR",1:"MCPACSUR"_$S(MCARFLG:"T",1:"C")_MCARLEAD)
D ORDERA G EXIT:$D(DTOUT)!$D(DUOUT) D EN^MCARD,ORDER1,QTASK^MCPARAM
;get new default patient name
S MCX=$$VALUE^MCENDIQ1(MCFILE,MCARGDA,1)
I MCX'="" S MCPATNM=MCX
G EXIT
MSG W !!,"PATIENT HAS NO CURRENT GENERATOR IMPLANT LISTED IN GENERATOR FILE",!! R "PRESS RETURN TO CONTINUE ",X:DTIME D KILL Q
KILL I MCARNEW S DIK="^MCAR(698.3,",DA=MCARGDA D ^DIK W !,*7,"Entry Deleted"
Q