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

AGMAN.m

Go to the documentation of this file.
AGMAN ; IHS/ASDS/EFG - PATIENT EDIT ;  
 ;;7.1;PATIENT REGISTRATION;**5,9**;AUG 25, 2005
NAME ;EP - From option.
 D PTLK^AG
 Q:'$D(DFN)
NAMEASK ;
 W !!,"Enter the NEW NAME: " D READ^AG Q:Y=""  I Y="@" W !!,*7,"CANNOT DELETE PATIENTS THROUGH THIS ROUTINE." Q
 K AG("NEWNAME")
 Q:$D(DUOUT)!$D(DTOUT)!$D(DFOUT)!$D(DQOUT)!$D(DLOUT)
 S X=Y
 S AG("NEWNAME")=Y
 D NAME^AUPNPED
 I '$D(X) W !!,"INCORRECT NAME FORMAT." K AG("NEWNAME") G NAMEASK
 S AG("OLDNAME")=$P(^DPT(DFN,0),U)
 D NOW^%DTC S AGDTS=%
 D ADDNAM^AGNAMCHG
 Q:$D(AG("NAMFAIL"))
 K DIC,DIE,DA,DR,X,Y
 S DIE="^DPT("
 S DA=DFN
 S DR=".01///"_AG("NEWNAME")
 D ^DIE Q:'$D(X)  G END:$P(^DPT(DFN,0),U)=AG("OLDNAME")
 ;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
NAME1 W !!,"Do you wish to store """,AG("OLDNAME"),"""",!,"in the ""OTHER NAMES"" file for future reference to this patient? (Y/N) " D READ^AG G NAME:$D(DUOUT) I $D(DQOUT)!$D(DLOUT)!("YN"'[Y) D YN^AG G NAME1
 I Y["Y" S DIE="^DPT(",DA=DFN,DR="1///"_AG("OLDNAME"),DR(2,2.01)=.01 D ^DIE
 S ^AGPATCH(AGDTS,DUZ(2),DFN)="",DIE="^AUPNPAT(",DR=".03///TODAY",$P(^AUPNPAT(DFN,0),U,12)=DUZ,DA=DFN D ^DIE
 G END
CHART ;EP - From option.
 KILL DOG
 D PTLK^AG
 Q:'$D(DFN)
CHART1 ;EP - From ^AG0 (Add Chart # to Patient)
 S AG("EDIT")="" D ^AG1 I $D(DUOUT)!$D(DTOUT)!$D(DFOUT) G END
 S DIE="^AUPNPAT(",DR=".03///TODAY",$P(^AUPNPAT(DFN,0),U,12)=DUZ,DA=DFN D ^DIE
 S ^XTMP("AGHL7AG",DUZ(2),DFN,"UPDATE")=""  ;fje 07082009 AG*7.1*5 EDR ;AG*7.1*9 - Added DUZ(2) subscript
 D NOW^%DTC S AGDTS=%
 I $D(AG("NEWREG")) S ^AGPATCH(AGDTS,DUZ(2),DFN)="NEW" D INITL,DELCHK G:'$D(AG("OCH")) END
 I (AG("OCH")'=AG("CH"))&($E(AG("OCH"))="T") S ^AGPATCH(AGDTS,DUZ(2),DFN)="NEW" G END
 G END:AG("OCH")=AG("CH") I $D(^AGPATCH(AGDTS,DUZ(2),DFN)) G END:$P(^(DFN),U,2)]""&($P(^(DFN),U,3)="") S:$P(^(DFN),U,2)]"" AG("OCH")=$P(^(DFN),U,2)
 D INITL S ^AGPATCH(AGDTS,DUZ(2),DFN)=DUZ(2)_U_AG("OCH")_U_AG("CH")_U_AG("INITL")_U_$P(^DPT(DFN,0),U,2)
END ;
ZMFI ;EP called from the various page edits to tag AGPATCH with PG number
 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
DEAD ;EP - Determine If a Patient is DECEASED.
 K AG("DEAD") I $D(DFN),$D(^DPT(DFN,.35)),$P(^(.35),U) S AG("DEAD")=""
 Q
DEADY ;EP - Is PATIENT DECEASED (IN FILEMANAGER).
 K AG("DEAD") I $D(Y),$D(^DPT(Y,.35)),$P(^(.35),U) S AG("DEAD")=""
 Q
INITL ;EP - PATIENT Initials -LAST NAME:FIRST NAME (ONLY).
 K AG("INITL") I $D(DFN),$D(^DPT(DFN,0)) S AG("INITL")=$E($P(^(0),U))_$E($P($P(^(0),U),",",2))
 Q
DELCHK ;Check for delete instruction in ^AGPATCH.
 S AGTXSITE=$P(^AUTTSITE(1,0),U)
 I '$D(^AGTXST(AGTXSITE)) S AGZDTS="" G DCHK1
 S AGZDTS=+$P(^AGTXST(AGTXSITE,1,0),U,3) I 'AGZDTS G DCHK1
 S AGZDTS=$P(^AGTXST(AGTXSITE,1,AGZDTS,0),U,3)
DCHK1 ;>PICK OLD HRN
 F  S AGZDTS=$O(^AGPATCH(AGZDTS)) Q:'AGZDTS  I ($D(^(AGZDTS,DUZ(2),DFN))#2),+(^(DFN)),$P(^(DFN),U,3)="" S AG("OCH")=$P(^(DFN),U,2) K ^(DFN)
 K AGTX,AGTXSITE,AGZDTS
 Q