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

AMHLEE.m

Go to the documentation of this file.
AMHLEE ; IHS/CMI/LAB - MENTAL HLTH ROUTINE  ;
 ;;4.0;IHS BEHAVIORAL HEALTH;**1,2,4,8**;JUN 02, 2010;Build 7
 ;
EDITR ;EP -protocol
 I AMHRCNT=0 W !,"There are no visits in the list to edit." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Edit Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
 I $P(^AMHREC(AMHR,0),U,34) W !!,"This is a group encounter.  You must edit this group visit through the Group",!,"Form Data Entry menu option.",! D PAUSE^AMHLEA,XIT Q
 I $$EHR^AMHUTIL(AMHR) D EHRE^AMHEHR D PAUSE^AMHLEA,XIT Q
DGSECE ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITR9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITR9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to edit this record",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITR9 ;
 I $P($G(^AMHREC(AMHR,11)),U,12)]"",$O(^AMHREC(AMHR,31,0)) D
 .W !!,"The progress note has been electronically signed.  You will not be able to edit the note.",!,"You will be able to edit the other visit items when you press enter to continue.",! D PAUSE^AMHLEA
 W:$D(IOF) @IOF W !,"You are editing the following record:",!!,VALMHDR(4),!,AMHDASH,! W ^TMP("AMHVRECS",$J,AMHR1,0),!!!
 D FULL^VALM1
EDIT ;EP
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 S AMHVTYPE=$P(^AMHREC(AMHR,0),U,33)
 I AMHVTYPE="" S AMHVTYPE="R"
 S AMHACTN=2
 S DIADD=1,DIE="^AMHREC(",DA=AMHR,DR="5100///NOW",DR(2,9002011.5101)=".02////^S X=DUZ" D ^DIE K DIE,DA,DR K DIADD
EDIT1 ;
 I $G(AMHDET)="S" D
 .I $P($G(^AMHREC(AMHR,11)),U,12)]"",$O(^AMHREC(AMHR,31,0)) S DR="[AMHSV EDIT RECORD]"
 .I $P($G(^AMHREC(AMHR,11)),U,12)]"",'$O(^AMHREC(AMHR,31,0)) S DR="[AMH EDIT RECORD]"
 .I $P($G(^AMHREC(AMHR,11)),U,12)="" S DR=$S(AMHPAT:"[AMH EDIT RECORD]",1:"[AMH ADD NON-PAT RECORD]")
 .S DA=AMHR,DDSFILE=9002011 D ^DDS D
 ..I $D(DIMSG) W !!,"ERROR IN SCREENMAN FORM!!  ** NOTIFY PROGRAMMER **" S AMHQUIT=1 K DIMSG Q
 ..I $P(^AMHREC(AMHR,0),U,22)'="A" S DA=AMHR,DIE="^AMHREC(",DR=".22///M" D ^DIE K DA,DIE,DR
 ..I $D(^AMHRCDST("B",AMHR)) D CDST^AMHLEA
 ..I $D(^AMHREC(AMHR,0)),$P(^AMHREC(AMHR,0),U,33)="S"!($P(^AMHREC(AMHR,0),U,33)="U") S AMHPAT=$P(^AMHREC(AMHR,0),U,8) I AMHPAT D EP1^AMHLESAN(AMHPAT,AMHR)
 S DIE="^AMHREC(",DA=AMHR,DR="1117////"_$$HL^AMHUTIL2($$VALI^XBDIQ1(9002011,AMHR,.02)) D ^DIE K DIE,DA,DR ;IHS/CMI/LAB PATCH 8 HOSP LOC
 D CHECK^AMHLEA
 I $P(^AMHREC(AMHR,0),U,8)]"" D REGULAR^AMHLEP2
 I $P(^AMHREC(AMHR,0),U,8)]"" D SUIC^AMHLEA,OTHER^AMHLEA
 I AMHZED=1 G EDIT1
 D PCCLINK^AMHLEA
 D:'$G(AMHPATCE) XIT
 Q
EDITSP ;EP 
 I AMHRCNT=0 W !,"There are no visits in the list to edit." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Edit Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
 I $$EHR^AMHUTIL(AMHR) D EHRE^AMHEHR D PAUSE^AMHLEA,XIT Q
 I $P(^AMHREC(AMHR,0),U,34) W !!,"This is a group encounter.  You must edit this group visit through the Group",!,"Form Data Entry menu option.",! D PAUSE^AMHLEA,XIT Q
 I $P($G(^AMHREC(AMHR,11)),U,12)]"",$O(^AMHREC(AMHR,31,0)) W !!,"You cannot edit this note, it has been electronically signed." D PAUSE^AMHLEA,XIT Q
DGSECES ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITSP9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITSP9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to edit the SOAP note",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITSP9 ;
 W:$D(IOF) @IOF W !,"You are editing the following record:",!!,VALMHDR(4),!,AMHDASH,! W ^TMP("AMHVRECS",$J,AMHR1,0),!!!
 D FULL^VALM1
EDITSP1 ;
 I 'AMHPAT W !!,$C(7),$C(7),"This is not a patient visit!!" H 5 D XIT Q
 S AMHACTN=2
 S DA=AMHR,DR="[AMH EDIT SOAP/CC]",DIE="^AMHREC(" D CALLDIE^AMHLEIN
 D OTHER^AMHLEA
 D PCCLINK^AMHLEA
 D XIT
 Q
EDITEHRR ;EP - protocol
 I AMHRCNT=0 W !,"There are no visits in the list to edit." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Edit Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
 I '$P($G(^AMHREC(AMHR,11)),U,10) W !!,"This visit was NOT created through EHR, please edit this visit with Edit Visit.",! D PAUSE^AMHLEA,XIT Q
DGSECEH ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITH9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITH9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to edit this record",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITH9 ;
 W:$D(IOF) @IOF W !,"You are editing the following record:",!!,VALMHDR(4),!,AMHDASH,! W ^TMP("AMHVRECS",$J,AMHR1,0),!!!
 D FULL^VALM1
EDITEHR ;EP
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 S AMHVTYPE=$P(^AMHREC(AMHR,0),U,33)
 I AMHVTYPE="" S AMHVTYPE="R"
 S AMHACTN=2
 S DIADD=1,DIE="^AMHREC(",DA=AMHR,DR="5100///NOW",DR(2,9002011.5101)=".02////^S X=DUZ" D ^DIE K DIE,DA,DR K DIADD
 S DR=$S($$DSMCS^AMHUTIL1(DUZ(2),$P($P(^AMHREC(AMHR,0),U),"."))=4:"[AMH EHR EDIT RECORD]",1:"[AMHEH EHR EDIT RECORD"),DA=AMHR,DDSFILE=9002011 D ^DDS D
 .I $D(DIMSG) W !!,"ERROR IN SCREENMAN FORM!!  ** NOTIFY PROGRAMMER **" S AMHQUIT=1 K DIMSG Q
 I $P(^AMHREC(AMHR,0),U,8)]"" D REGULAR^AMHLEP2
 I $P(^AMHREC(AMHR,0),U,8)]"" D SUIC^AMHLEA,OTHER^AMHLEA
 S AMHERROR=0 D RECCHECK^AMHLE2 I AMHERROR D PAUSE^AMHLEA
 D:'$G(AMHPATCE) XIT
 Q
SW ;EP -dates
 S DIR(0)="D^::EP",DIR("A")="Enter Date" KILL DA D ^DIR KILL DIR
 Q:$D(DIRUT)
 S AMHDATE=Y
 D FULL^VALM1
 D XIT
 Q
DELETE ;EP-delete
 I AMHRCNT=0 W !,"There are no visits in the list to delete." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Delete Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
DEL ;EP
 I $P($G(^AMHREC(AMHR,11)),U,12)]"",'$D(^XUSEC("AMHZ DELETE SIGNED NOTE",DUZ)),$O(^AMHREC(AMHR,31,0)) D  Q
 .W !!,"You cannot delete this record, the note has been electronically signed.",!,"Please see your supervisor or program manager." D PAUSE^AMHLEA,XIT Q
 I '$D(^XUSEC("AMHZ DELETE RECORD",DUZ)),'$D(^XUSEC("AMHZ DELETE SIGNED NOTE",DUZ)) W !!,"You do not have the security access to delete a Visit.",!,"Please see your supervisor or program manager.",! D PAUSE^AMHLEA,XIT Q
 I $$EHR^AMHUTIL(AMHR) D EHRE^AMHEHR D PAUSE^AMHLEA,XIT Q
DGSECD ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITD9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITD9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to delete this record",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITD9 ;
 S AMHACTN=4
 I '$G(AMHGRPDE) D  I 'Y!($D(DIRUT)) Q
 .D EN^AMHRDSP
 .W !! S DIR(0)="Y",DIR("A")="Are you sure you want to DELETE this record",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 .Q:$D(DIRUT)
 .Q:'Y
 D DEL^AMHLEA
 S AMHACTN=4 D PCCLINK^AMHLEA
 I '$D(AMHPATCE),'$G(AMHGRPDE) D XIT
 Q
PRINT ;EP
 I AMHRCNT=0 W !,"There are no visits in the list to print." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Print Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
DGSECP ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITP9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITP9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to print this encounter form",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITP9 ;
 K AMHEFT
 D FORMDIR^AMHLEFP(AMHR)
 Q:$D(DIRUT)
 S AMHEFT=Y
 D FULL^VALM1
 S AMHACTN=5
 S XBRC="COMP^AMHLEFP",XBRP="^AMHLEFP2",XBNS="AMH",XBRX="XIT^AMHLEFP"
 D ^XBDBQUE
 D XIT
 Q
DISPLAY ;EP
 I AMHRCNT=0 W !,"There are no visits to display." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Display Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
DGSECDS ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITDS9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITDS9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to display this record",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITDS9 ;
DISP ;
 S AMHACTN=5
 D ^AMHDVD
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D OTHER^AMHLEA
 D XIT
 Q
APPT ;
 D FULL^VALM1
 S AMHACTN=6
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 D APPT^AMHVRL2(AMHPAT)
 D PAUSE^AMHLEA
 D XIT
 Q
HS ;EP - Display PP
 D FULL^VALM1
 S AMHACTN=6
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 D ^AMHDPP
 D PAUSE^AMHLEA
 D XIT
 Q
ID ;EP
 D FULL^VALM1
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 D EP^AMHLEIVP(AMHPAT)
 D PAUSE^AMHLEA
 D XIT
 Q
OI ;
 D FULL^VALM1
 S AMHACTN=6
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 D 1^AMHLEA
 D PAUSE^AMHLEA
 D XIT
 Q
SR ;EP
 D FULL^VALM1
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 D EP^AMHPST(AMHPAT)
 D PAUSE^AMHLEA
 D XIT
 Q
LAB ;
 D FULL^VALM1
 S AMHACTN=6
 D GETPAT^AMHLEA
 I 'AMHPAT W !,"NO Patient selected!",! D PAUSE^AMHLEA D XIT Q
 S DFN=AMHPAT,ORVP=AMHPAT_";DPT(" D OR^LRRP2 K DFN
 D PAUSE^AMHLEA
 D XIT
 Q
TIUN ;EP
 I AMHRCNT=0 W !,"There are no visits in the list to display." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Display Note for Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$O(^AMHREC(AMHR,54,0)) W !,"There is no TIU Note associated with that visit." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 D FULL^VALM1
DGSECT ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITT9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITT9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to display the TIU note",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITT9 ;
TIUN1 ;
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D TIU^AMHEHR
 D XIT
 Q
ESIG ;EP - PROTOCOL
 NEW AMHXX,AMHR,AMHR1
 I AMHRCNT=0 W !,"There are no visits in the list to sign." D PAUSE^AMHLEA D XIT Q
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Sign Which Record" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No record selected." G XIT
 S AMHR1=+Y I 'AMHR1 K VALMY,XQORNOD W !,"No record selected." G XIT
 S AMHR=^TMP("AMHVRECS",$J,"IDX",AMHR1,AMHR1) I 'AMHR K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I '$D(^AMHREC(AMHR,0)) W !,"Not a valid BH RECORD." K AMHRDEL,AMHR D PAUSE^AMHLEA D XIT Q
 I $P(^AMHREC(AMHR,0),U,34) W !!,"This is a group encounter.  You must sign this note through the Group",!,"Form Data Entry menu option.",! D PAUSE^AMHLEA,XIT Q
 D FULL^VALM1
DGSECS ;
 I '$P(^AMHREC(AMHR,0),U,8) G EDITS9
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
 D PTSEC^AMHUTIL2(.AMHRESU,AMHPAT,1)
 I '$G(AMHRESU(1)) G EDITS9
 I $G(AMHRESU(1))=3!($G(AMHRESU(1))=4)!($G(AMHRESU(1))=5) D DISPDG^AMHLE,PAUSE^AMHLEA,XIT Q
 D DISPDG^AMHLE
 W ! K DIR S DIR(0)="Y",DIR("A")="Do you want to continue to sign this note",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I 'Y D XIT Q
 K AMHRESU
 D NOTICE^DGSEC4(.AMHRESU,AMHPAT,,3)
EDITS9 ;
 S AMHXX=$$ESIG^AMHESIG(AMHR)
 I 'AMHXX W !!,$P(AMHXX,U,3),! D PAUSE^AMHLEA I '$P(AMHXX,U,4) D XIT Q
ESIGD ;
 S AMHACTN=5
 D ^AMHDVD
 S AMHPAT=$P(^AMHREC(AMHR,0),U,8)
ESIGE ;
 W !!
 S DIR(0)="Y",DIR("A")="Do you wish to edit this record/note",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) D XIT Q
 I 'Y D ESIG9 Q
 D EDIT
 D XIT
 Q
ESIG9 ;
 D OTHER^AMHLEA
 S AMHACTN=1
 D PCCLINK^AMHLEA
 D XIT
 Q
XIT ;EP
 S VALMBCK="R"
 D TERM^VALM0
 D GATHER^AMHLEL
 S VALMCNT=AMHRCNT
 D HDR^AMHLE
EOJ K AMHR,AMHTYPE,AMHR0,AMHERROR,AMHC,AMHRPOV,AMHX,AMHSHIGH,AMHOTH,AMHOKAY,AMHNONE,AMHACTN,AMHLOC,AMHPAT,DA,DIE,DIRUT,DUOUT,DIC,D0,AMHVDLT,AMHR1,DFN
 K AMHTYPE,AMHECLN,AMHSD,AMHVISIT,AMHRESU
 D KILL^AUPNPAT
 K DFN,AGE,SSN
 K DGXFRO,DGB
 Q