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

AGMANERS.m

Go to the documentation of this file.
AGMANERS ; IHS/OIT/SCR 06/22/06 - CHANGE PATIENT NAME API FOR ERS  ;
 ;;7.1;PATIENT REGISTRATION;**2,9**;AUG 25, 2005
 ;USED BY AMER*2.5.1 req 8
 ;
NAME(AMERDFN) ;EP - From UPDATPAT^AMERVSIT
 ;IHS/OIT/SCR 6/22/06 MODIFIED NAME^AGEMAN TO FORCE THIS DFN AND NO OTHER FOR 
 Q:AMERDFN 0
EDIT ;
 N DIC,AMERONAM
 S AMERONAM=$P($G(^DPT(AMERDFN,0)),U)
 S DFN=AMERDFN
 D CHKRHI^AG
 I $D(RHIFLAG)  D
 . I RHIFLAG="A" W !,$$S^AGVDF("RVN"),$$S^AGVDF("BLN"),"This patient has Restricted Health Information",$$S^AGVDF("BLF"),$$S^AGVDF("RVF")
 ;ADD ALERT IF PATIENT HAS 'DATE OF DEATH' POPULATED IN VA
 ;PATIENT FILE
 I $D(DFN) I $$CHKDEATH^AGEDERR(DFN) W !!?5,"**** ALERT: DATE OF DEATH ON FILE FOR THIS PATIENT!!" H 2
 Q:'$D(DFN) 0
 S DIR(0)="FOr^1:80",DIR("A")="ENTER NEW NAME",DIR("?")="ENTER NAME THAT SHOULD BE ON THIS RECORD(80 characters max.)"
 S DIR("B")=AMERONAM
 D ^DIR K DIR
 I $D(DUOUT)!$D(DTOUT)!(Y="") K DUOUT,DTOUT,Y Q 0
 Q:Y=AMERONAM 0
 ;W !!,"Enter the NEW NAME: " D READ^AG Q:Y=""  I Y="@" W !!,*7,"CANNOT DELETE PATIENTS THROUGH THIS ROUTINE." Q
 K AG("NEWNAME")
 S X=Y
 S AG("NEWNAME")=Y
 D NAME^AUPNPED
 I '$D(X) D EN^DDIOL("INCORRECT NAME FORMAT","","!!") K AG("NEWNAME") Q 0
 S AG("OLDNAME")=AMERONAM
 D NOW^%DTC S AGDTS=%
 D ADDNAM^AGNAMCHG
 Q:$D(AG("NAMFAIL")) 0
 K DIC,DIE,DA,DR,Y
 S DA=DFN
 S DR=".01///"_AG("NEWNAME")
 S X=$$DIEDPT(DA,DR)
 I $P(^DPT(DFN,0),U)=AG("OLDNAME") D END Q 1
 ;HL7 INTERFACE -- PUT PATIENT DFN INTO TEMP ARRAY FOR HL7 CALL
 S ^XTMP("AGHL7",DUZ(2),DA)=DA  ;AG*7.1*9 - Added DUZ(2) subscript
 S ^XTMP("AGHL7AG",DUZ(2),DA,"UPDATE")=""  ;AG*7.1*9 - Added DUZ(2) subscript
 S DIR("A")="Do you wish to store "_AG("OLDNAME")_" in the ""OTHER NAMES"" file for future reference to this patient"
 S DIR(0)="Y",DIR("B")="YES"
 D ^DIR
 I $D(DUOUT)!$D(DTOUT)!(Y="") K DUOUT,DTOUT,Y Q 0
 I Y["Y" D
 .S DIE="^DPT("
 .S DA=DFN,DR="1///"_AG("OLDNAME"),DR(2,2.01)=.01
 .S X=$$DIEDPT(DA,DR)
 S ^AGPATCH(AGDTS,DUZ(2),DFN)="",DR=".03///TODAY",$P(^AUPNPAT(DFN,0),U,12)=DUZ,DA=DFN
 D DIEAUPN(DA,DR)
 Q 1
END  ;AMER*2.5*1 IHS/OIT/SCR 09/01/06
 I '$G(AGTDS) S X="NOW" D ^%DT S AGDTS=Y
 I $G(AGPTPG)=0,("N"'[($P(^AUTTSITE(1,0),"^",16))) S ^AGPATCH(AGDTS,DUZ(2),DFN,"ZMFI",0)=""
 I $D(^AGPATCH(AGDTS,DUZ(2),DFN))=10 S ^AGPATCH(AGDTS,DUZ(2),DFN)=""
 I $D(^AGPATCH(AGDTS,DUZ(2),DFN))=0 S ^AGPATCH(AGDTS,DUZ(2),DFN)=""
 K AGDTS
 Q
DIEDPT(DA,DR) ; GIVEN AN ENTRY NUMBER AND A DR STRING, EDIT THE VA PATIENT 
FILE ;EP
 N X,Y,%
 N D,D0,DI,DIC,DICR,DIE,DIG,DIH,DIV,DIU,DIW,DQ
 S DIE="^DPT("
 L +^DPT(DA):3 E  Q
 D ^DIE
 L -^DPT(DA)
 K DIE,DA,DR
 Q X
DIEAUPN(DA,DR) ; GIVEN AN ENTRY NUMBER AND A DR STRING, EDIT THE PATIENT FILE
 N X,Y,%
 N D,D0,DI,DIC,DICR,DIE,DIG,DIH,DIV,DIU,DIW,DQ
 S DIE="^AUPNPAT("
 L +^AUPNPAT(DA):3 E  Q
 D ^DIE
 L -^AUPNPAT(DA)
 K DIE,DA,DR
 Q