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

AGMBIR2.m

Go to the documentation of this file.
AGMBIR2 ;IHS/OIT/NKD - PAT REG MBI EDIT ; JULY 23, 2018
 ;;7.1;PATIENT REGISTRATION;**14**;AUG 25, 2005;Build 1
 ;
 ;IHS/OIT/NKD AG*7.1*14 MBI PHASE 2
 ;
PAT  ; PATIENT LOOKUP
 N DFN,RHIFLAG,REC,AGPATDFN
 D PTLK^AG
 Q:'$D(DFN)!$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
PRINT  ; PRINT DETAILS
 N AGRES
 S AGRES=$$GETMBIS^AGUTL(DFN,"AGRES")
 S AGRES=$G(AGRES)
 I 'AGRES W !!,"Patient has no MBI history on file."
 E  D
 . W !!,?10,"Eff Date",?26,"MBI",?40,"Source"
 . N CNT S CNT=0 F  S CNT=$O(AGRES(CNT)) Q:'CNT  D
 . . W !,$$RJ^XLFSTR(CNT_")",6),?10,$P(AGRES(CNT,0),U,2),?26,$P(AGRES(CNT,0),U,3),?40,$P(AGRES(CNT,0),U,4)
ASK  ; PROMPT FOR ACTION
 W !
 N AGANS K DIR
 S DIR("A")="ENTER ACTION (<A>dd MBI,<E>dit MBI,<D>elete MBI): "
 S DIR(0)="SAO^A:ADD;E:EDIT;D:DELETE"
 D ^DIR
 I $D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT) D END Q
 S AGANS=$G(Y)
 I AGANS="A" D ADD
 E  I AGANS="E" D EDIT(.AGRES)
 E  I AGANS="D" D DELETE(.AGRES)
 G PRINT
 Q
ADD  ; ADD MBI
 N POL
 ; INTERACTIVE ENTRY PROMPT
 K DIR
 S DIR(0)="FA^11"
 S DIR("A")="MBI: "
 D ^DIR
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 S POL=$$ASKMBI^AGUTL(DFN,$G(X),"OTH")  ;MBI FORMAT
 Q
EDIT(AGRES)  ; EDIT MBI
 N POL,AGENTRY,MBI,RES,SRC S AGRES=$G(AGRES)
 ; INTERACTIVE ENTRY PROMPT
 K DIR
 S DIR(0)="NA^1:"_$G(AGRES)
 S DIR("A")="SELECT ENTRY (1-"_$G(AGRES)_"): "
 D ^DIR
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 S AGENTRY=$G(Y)
 ; INTERACTIVE MBI PROMPT
 K DIR
 S DIR(0)="FA^11"
 S DIR("A")="MBI: "
 S DIR("B")=$P(AGRES(AGENTRY,0),U,3)
 D ^DIR
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 S MBI=$G(Y)
 ; VALIDATE MBI FORMAT
 K DIR
 S RES=$$FORMOK^AUPNMBI(MBI)
 I 'RES W !,$P(RES,U,2),! S DIR(0)="9000001.44,1",DIR("B")=MBI D ^DIR S MBI=$G(Y)
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 ; INTERACTIVE SOURCE PROMPT
 K DIR
 S DIR(0)="9000001.44,2",DIR("B")=$P(AGRES(AGENTRY,0),U,4) D ^DIR
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 S SRC=$G(Y)
 ; CALL AUPN MBI
 S RES=$$ADDMBI^AUPNMBI(DFN,$P(AGRES(AGENTRY,0),U,1),MBI,SRC)
 Q
DELETE(AGRES)  ; DELETE MBI
 N AGENTRY,RES S AGRES=$G(AGRES)
 ; INTERACTIVE ENTRY PROMPT
 K DIR
 S DIR(0)="NA^1:"_$G(AGRES)
 S DIR("A")="SELECT ENTRY (1-"_$G(AGRES)_"): "
 D ^DIR
 Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)!$D(DIRUT)
 S AGENTRY=$G(Y)
 ; CALL AUPN MBI
 S RES=$$DELMBI^AUPNMBI(DFN,$P(AGRES(AGENTRY,0),U,1),$P(AGRES(AGENTRY,0),U,3))
 Q
END  ; CLEANUP
 K DIR
 S DIR("A")="Press RETURN..."
 S DIR(0)="E"
 D ^DIR
 K DIR
 D ^XBFMK,KILL^AUPNPAT
 Q