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

GMRCADC.m

Go to the documentation of this file.
  1. GMRCADC ;SLC/DLT/DCM - DC taken from List Manager ; 7/11/05 1:40pm
  1. ;;3.0;CONSULT/REQUEST TRACKING;**1,5,10,12,35,39,47**;DEC 27, 1997
  1. EXAC(MSG) ;Exit message asking for user to press <ENTER> EXAC=Exit Action
  1. N ND,X
  1. W $C(7),!,MSG I $O(MSG(0)) S ND=0 F S ND=$O(MSG(ND)) Q:ND="" D
  1. . W !,MSG(ND)
  1. W !,"Press <RETURN> to continue: " R X:DTIME W !!
  1. Q
  1. DC(GMRCO,GMRCA) ;Discontinue a consult logic from DC^GMRCA1
  1. I $D(IOTM),$D(IOBM),$D(IOSTBM) D FULL^VALM1
  1. N GMRCDA,GMRCACTM,GMRCADUZ,GMRCSERV,GMRCAD,GMRC
  1. K GMRCQUT,GMRCQIT
  1. I '+$G(GMRCO) D SELECT^GMRCA2(.GMRCO) I $D(GMRCQUT) Q
  1. I '+$G(GMRCO) S GMRCQUT=1 Q
  1. I $P($G(^GMR(123,GMRCO,12)),U,5)="P" D Q
  1. . N DIR
  1. . W !,"The requesting facility may not take this action on an "
  1. . W "inter-facility consult."
  1. . S DIR(0)="E" D ^DIR
  1. . S GMRCQUT=1
  1. I '$$LOCK^GMRCA1(GMRCO) S GMRCQUT=1 Q
  1. ;
  1. S GMRC(0)=^GMR(123,GMRCO,0),GMRCDA=GMRCO
  1. S (GMRCDFN,DFN)=$P(GMRC(0),"^",2)
  1. I $D(GMRCA),+GMRCA S GMRCACTM=$S(GMRCA=6:"Discontinued",GMRCA=19:"Cancelled",1:$P($G(^GMR(123.1,+GMRCA,0)),"^",1))
  1. ;
  1. D PROC I $D(GMRCQUT) D UNLOCK^GMRCA1(GMRCO) S GMRCQUT=1 Q
  1. ;send 513 back to service printer if request DC'd or Cancelled
  1. I GMRCA=6,$$DCPRNT^GMRCUTL1(+GMRCO,DUZ) D
  1. . D PRNT^GMRCUTL1(+$P(GMRC(0),U,5),+GMRCO)
  1. S GMRCTRLC=$S(GMRCA=19:"OC",1:"OD")
  1. D EN^GMRCHL7(DFN,GMRCO,$G(GMRCTYPE),$G(GMRCRB),GMRCTRLC,GMRCORNP,$G(GMRCVSIT),.GMRCOM,,$G(GMRCAD))
  1. D UNLOCK^GMRCA1(GMRCO)
  1. Q
  1. ;
  1. PROC ;Check validity of action and if valid process the discontinue action
  1. N DIROUT,DTOUT,DUOUT,GMRCMSG,GMRCFL,GMRCACT
  1. I $P(GMRC(0),"^",12)=1 S GMRCMSG="This consult has already been discontinued!" D EXAC(GMRCMSG) S GMRCQUT=1 Q
  1. I $P(GMRC(0),"^",12)=2 S GMRCMSG="This consult has already been completed!" D EXAC(GMRCMSG) S GMRCQUT=1 Q
  1. I $P(GMRC(0),"^",12)=9 S GMRCMSG="Action invalid. This consult has partial results!",GMRCMSG(1)="Remove the associated results and then discontinue." D EXAC(.GMRCMSG) S GMRCQUT=1 Q
  1. I $P(GMRC(0),"^",12)=13 S GMRCMSG="This consult has already been cancelled!" D EXAC(GMRCMSG) S GMRCQUT=1 Q
  1. ;
  1. S GMRCORVP=GMRCDFN_";DPT("
  1. N GETPROV
  1. FRGTPRV D GETPROV^GMRCAU I $D(DIROUT)!$D(DTOUT)!$D(DUOUT) S GMRCQUT=1 Q
  1. S GMRCACT=$$PROVIDER^XUSER(GMRCORNP) I $P(GMRCACT,U)'=1 D G FRGTPRV
  1. .W !!,"***User account is TERMINATED please choose another responsible user.***"
  1. S GMRCAD=$$GETDT^GMRCUTL1 ;Returns GMRCAD as the entered date
  1. I GMRCAD="^" S GMRCQUT=1 Q
  1. S GMRCSTS=$S(GMRCA=6:1,1:13),$P(GMRC(0),"^",12)=GMRCSTS
  1. S GMRCOM=1
  1. D STATUS^GMRCP
  1. D AUDIT^GMRCP
  1. ;
  1. S GMRCORTX=$S($L($G(GMRCACTM)):GMRCACTM,+GMRCA:$P(^GMR(123.1,GMRCA,0),U,1),1:"ACTION UNKNOWN FOR")_" consult "_$$ORTX^GMRCAU(+GMRCO)
  1. S GMRCADUZ="",GMRCFL=0
  1. I +$P($G(^GMR(123,+GMRCO,0)),"^",14),+$P(^(0),"^",14)'=DUZ S GMRCADUZ($P(^(0),"^",14))=""
  1. ;I +$P($G(^GMR(123,+GMRCO,0)),"^",14)=DUZ S GMRCFL=1
  1. I GMRCA=6 S GMRCFL=$$DCNOTE(GMRCO,DUZ) ;check NOTIFY SERVICE ON DC
  1. ;I GMRCA=19 S GMRCFL=1
  1. ;send notification info to routine to be sent to OERR
  1. N NOTYPE S NOTYPE=$S(GMRCA=6:23,1:30)
  1. D MSG^GMRCP(GMRCDFN,GMRCORTX,+GMRCO,NOTYPE,.GMRCADUZ,GMRCFL)
  1. Q
  1. DCNOTE(IEN,USER) ;determine if service users receive alerts based on 1.04
  1. N SERV,DCFLG
  1. S SERV=$P(^GMR(123,IEN,0),U,5)
  1. S DCFLG=$P($G(^GMR(123.5,SERV,1)),U,4)
  1. I 'DCFLG Q 1
  1. I DCFLG=2 Q 0
  1. I DCFLG=1,'$$VALID^GMRCAU(SERV,IEN,USER) Q 1
  1. Q 0