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

GMRCTIUP.m

Go to the documentation of this file.
  1. GMRCTIUP ;SLC/DCM,JFR - TIU/Consults UTILITIES; 4/4/01 15:01
  1. ;;3.0;CONSULT/REQUEST TRACKING;**4,13,15,17,22**;DEC 27, 1997
  1. ;
  1. ; This routine invokes IA #616,#2693
  1. ;
  1. HDR(GMRCTUPR,GMRCGLB,COUNT,FROM) ;Get Source info for header of display
  1. ;and place data in ^TMP( global. Do Not Show Any Results
  1. ;GMRCTUPR=TIU record being sought
  1. ;GMRCGLOB=Global where data goes - i.e., ^TMP("GMRCR",$J,"RES",GMRCPTR,"ADD",GMRCADD,LINECT,0)
  1. ;COUNT=Count of where current line is to go in ^TMP( global
  1. ;FROM=flag to tell whether to add Addendum TIU # or not 0=NO, Otherwise addendum number
  1. N DR,GMRCTMP
  1. S:'$D(FROM) FROM=""
  1. S DR=".01;.05;.07;.09;1201;1202;1204;1205;1208;1301;1302",GMRCERR=""
  1. D EXTRACT^TIULQ(GMRCPTR,"LOCAL",.GMRCERR,DR)
  1. S @GMRCGLB@(COUNT,0)="",COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)="Source Information",COUNT=COUNT+1,@GMRCGLB@(COUNT,0)=""
  1. S @GMRCGLB@(COUNT,0)=" Document Status: "_LOCAL(GMRCPTR,.05,"E"),COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=" Entry Date: "_$P($G(LOCAL(GMRCPTR,1201,"E")),":",1,2),COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=" Visit: "_$G(LOCAL(GMRCPTR,.07,"E"))_" "_$G(LOCAL(GMRCPTR,1205,"E"))
  1. S COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=" Author: "_LOCAL(GMRCPTR,1202,"E")
  1. S COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=" Expected Signer: "_$E(LOCAL(GMRCPTR,1204,"E")_TAB,1,22)_$E(TAB,1,5)_"Expected Cosigner: "_$S($L($G(LOCAL(GMRCPTR,1208,"E"))):LOCAL(GMRCPTR,1208,"E"),1:"None"),COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=" Entered By: "_$E(LOCAL(GMRCPTR,1302,"E")_TAB,1,30)_"TIU Document #: "_GMRCTUPR,COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)=$S(+FROM:" TIU Addendum Document #: "_FROM,1:"")_$S(+FROM:$E(TAB,1,10),1:" ")_" Urgency: "_$S($L($G(LOCAL(GMRCPTR,.09,"E"))):LOCAL(GMRCPTR,.09,"E"),1:"None"),COUNT=COUNT+1
  1. S @GMRCGLB@(COUNT,0)="",COUNT=COUNT+1
  1. K LOCAL
  1. Q
  1. PRINT(GMRCO,LINECT,GMRCRT,GMRCDET) ;get TIU results and prepare for the SF-513
  1. ;GMRCRT=Flag from RT^GMRCA1 indicating that result request is from there
  1. ; GMRCRT=0 means 'NO',
  1. ; GMRCRT=1 means 'YES" (and ES is appended to TIU main result); also,
  1. ; No result is passed back to print on the 513 if GMRCRT=0.
  1. ;GMRCTUFN=IEN of the TIU result from file 8925
  1. ;GMRCSIG=signature block name of signer : GMRCSDT=date result was signed
  1. ;GMRCSIGT=signers block title : GMRCTUFN=TIU IEN of the result record
  1. ;GMRCCSIG=cosigners block name : GMRCCSDT=date cosigner signed
  1. ;GMRCCTIT=cosigners block title : GMRCSIGM=Signature mode (E:ELECTRONIC/C:CHART)
  1. ;I GMRCDET=1 coming from a detailed display not results display
  1. N GMRCTUFN,TAB,GLOBAL
  1. S:'$D(GMRCRT) GMRCRT=0 S:'$D(GMRCDET) GMRCDET=0
  1. D GETRSLTS(GMRCO,.GMRCAR) ;I $D(GMRCQUT) D:$D(GMRCMSG) EXAC^GMRCADC(GMRCMSG) K GMRCMSG,GMRCRT Q
  1. S GLOBAL="^TMP(""GMRCR"",$J,""GMRCTIU"")",TAB="",$P(TAB," ",31)=""
  1. K ^TMP("GMRCR",$J,"RES"),^TMP("GMRCR",$J,"MCAR")
  1. S (GMRCND,GMRCPTR)="" F K @GLOBAL S GMRCND=$O(GMRCAR(GMRCND)) Q:GMRCND="" S GMRCPKG=$P(GMRCND,";",2),GMRCPTR=$P(GMRCND,";",1) D
  1. .I $E(GMRCPKG,1,3)="TIU" D
  1. .. N GMRCTXT,GMRCPAR,GMRCACTN
  1. .. D EXTRACT^TIULQ(GMRCPTR,"GMRCPAR",.GMRCERR,.06,"I")
  1. .. I $D(GMRCAR(+$G(GMRCPAR(GMRCPTR,.06,"I"))_";TIU(8925,")) Q
  1. .. S GMRCACTN=$S($G(GMRCRT):"VIEW",1:"PRINT RECORD")
  1. .. D TGET^TIUSRVR1(.GMRCTXT,+GMRCPTR,GMRCACTN)
  1. .. I $D(@(GMRCTXT)) M @GLOBAL@(GMRCPTR,"TEXT")=@GMRCTXT
  1. .. K @GMRCTXT
  1. .. I $O(@GLOBAL@(GMRCPTR,"TEXT",0)) D
  1. ...S ND=0 F S ND=$O(@GLOBAL@(GMRCPTR,"TEXT",ND)) Q:ND="" D
  1. ....S ^TMP("GMRCR",$J,"RES",GMRCPTR,"TEXT",LINECT,0)=@GLOBAL@(GMRCPTR,"TEXT",ND)
  1. ....S LINECT=LINECT+1
  1. ..Q
  1. .I $E(GMRCPKG,1,4)="MCAR" S GMRCSR=GMRCND,MCFILE=$P(GMRCSR,";",2),MCFILE=$P(MCFILE,","),MCPROC=$O(^MCAR(697.2,"C",MCFILE,"")) Q:'MCPROC D
  1. ..S GMRCPRNM=$P(^MCAR(697.2,MCPROC,0),"^",8),ORIFN=$P(^GMR(123,GMRCO,0),"^",3),ORACTION=8,MCGLOBAL="^TMP(""GMRCR"",$J,""MCAR"","_GMRCPTR_")"
  1. ..D EN^GMRCTIU3(GMRCO,ORIFN,MCGLOBAL,LINECT) K ^TMP("MC",$J)
  1. ..Q
  1. .Q
  1. ; inter-facility remote results
  1. I 'GMRCDET,$O(^GMR(123,GMRCO,51,0)) D
  1. .N GMRCTMP S GMRCTMP="^TMP(""GMRCR"",$J,""RRES"")" K @GMRCTMP
  1. .S GLOBAL="^TMP(""GMRCR"",$J,""GMRCRRES"")" K @GLOBAL
  1. .D GETREMOT^GMRCART(GMRCO,GMRCTMP,LINECT)
  1. .I $D(@(GMRCTMP)) M @GLOBAL@(.5,"TEXT")=@GMRCTMP K @GMRCTMP
  1. .I $O(@GLOBAL@(.5,"TEXT",0)) D
  1. ..S ND=0 F S ND=$O(@GLOBAL@(.5,"TEXT",ND)) Q:ND="" D
  1. ...S ^TMP("GMRCR",$J,"RES",.5,"TEXT",LINECT,0)=@GLOBAL@(.5,"TEXT",ND,0)
  1. ...S LINECT=LINECT+1
  1. .Q
  1. K DR,GLOBAL,GMRCSR,GMRCAR,GMRCPKG,GMRCPRNM,MCFILE,MCPROC,ORACTION,ORIFN,MCGLOBAL,ND,ND1,GMRCND,GMRCPTR
  1. Q
  1. GETNOTE(GMRCO,FILE) ;Get the last result added to the record - this is found in $P(^(0),"^",20)
  1. ;Function returns last note added to record.
  1. ;If it does not contain the file pointer, it is assumed that
  1. ;it pointed to the TIU file 8925
  1. ;GMRCO=file 123 IEN
  1. ;FILE='MCAR' to get last medicine result pointer
  1. ;FILE='TIU' to get last TIU result pointer
  1. N X,RSLT
  1. S RSLT=999999,X=""
  1. F S RSLT=$O(^GMR(123,+GMRCO,50,RSLT),-1) Q:'RSLT D Q:+X
  1. . I $G(^GMR(123,+GMRCO,50,RSLT,0))[FILE S X=^GMR(123,+GMRCO,50,RSLT,0)
  1. Q X
  1. GETRSLTS(GMRCO,ARRAY) ;Get the results from record and return it in array 'ARRAY')
  1. ;Looks for results in $P(^(0),"^",20),$P(^(0),"^",15) and Field 50 multiple
  1. ;GMRCO=File 123 IEN
  1. ;ARRAY=array to return results pointers in
  1. ;ARRAY will be returned as ARRAY("IEN;FILE"), as e.g., "1289;^TIU(8925,"
  1. N X
  1. S X=$$GETNOTE(GMRCO,"TIU") I $L(X) S:$P(X,";",2)="" X=X_";TIU(8925," S ARRAY(X)=""
  1. S X=$$GETNOTE(GMRCO,"MCAR") I $L(X) S ARRAY(X)=""
  1. S X="" F S X=$O(^GMR(123,GMRCO,50,"B",X)) Q:X?1A.E!(X="") S ARRAY(X)=""