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

GMRCIEV1.m

Go to the documentation of this file.
  1. GMRCIEV1 ;SLC/JFR - IFC EVENTS CONT'D ; Aug 08, 2024@10:31:29
  1. ;;3.0;CONSULT/REQUEST TRACKING;**22,28,31,154,184,185,189**;DEC 27, 1997;Build 54
  1. ;#2161 HFLNC2, #2164 HLMA, #2701 MPIF001, #3105 VAFCPID, #2056 DIQ
  1. Q ;no-no-no
  1. RESUB(GMRCDA,GMRCACT) ;build HL7 msg with edits from resubit
  1. ;Input:
  1. ; GMRCDA = ien from file 123
  1. ; GMRCACT = ien of the activity from 40 multiple
  1. ;
  1. N HL,HLL,SEG,GMRC773,GMRCIQT,GMRCPD
  1. S SEG=1
  1. K ^TMP("HLS",$J)
  1. D INIT^HLFNC2("GMRC IFC ORM EVENT",.HL)
  1. I $G(HL) D Q ; if HL array can't be built, log it with an error
  1. . D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,,904)
  1. D I $D(GMRCIQT) D NOMPI^GMRCIEVT(GMRCDA,GMRCACT) Q ;build PID seg
  1. . N GMRCDFN S GMRCDFN=$P(^GMR(123,+GMRCDA,0),U,2)
  1. . I '$G(GMRCDFN) S GMRCIQT=1 Q
  1. . I $$GETICN^MPIF001(GMRCDFN)<1 S GMRCIQT=1 Q
  1. . I $$IFLOCAL^MPIF001(GMRCDFN) S GMRCIQT=1 Q
  1. . S ^TMP("HLS",$J,SEG)=$$EN^VAFCPID(GMRCDFN,"1,2,3,4,5,7,8,19")
  1. . ;
  1. . ; If remote site is converted, enhance the PID segment. p184
  1. . ;
  1. . I $$CNVTD^GMRCIEVT(GMRCDA)=1 S ^TMP("HLS",$J,SEG)=$$ADD2PID^GMRCIUTL(^TMP("HLS",$J,SEG),GMRCDFN,$P($G(^GMR(123,GMRCDA,"CERNER")),U,3)) ;
  1. . ;
  1. . S SEG=SEG+1
  1. . Q
  1. ;
  1. ;build ORC seg based on GMRCACT
  1. S ^TMP("HLS",$J,SEG)=$$ORC^GMRCISEG(GMRCDA,"XO","IP",GMRCACT)
  1. S SEG=SEG+1
  1. ;
  1. ; include Inpatient or Outpatient
  1. S ^TMP("HLS",$J,SEG)=$$OBR^GMRCISG1(GMRCDA,GMRCACT)
  1. ;
  1. ; If remote site is converted, enhance the OBR segment. p184
  1. ;
  1. I $$CNVTD^GMRCIEVT(GMRCDA)=1 S ^TMP("HLS",$J,SEG)=$$ADD2OBR^GMRCIUTL(^TMP("HLS",$J,SEG),GMRCDA) ;
  1. ;
  1. S SEG=SEG+1
  1. ;
  1. D ;load up reason for request
  1. . K ^TMP("GMRCRFR",$J)
  1. . D OBXWP^GMRCISEG(GMRCDA,"XO",GMRCACT,$NA(^TMP("GMRCRFR",$J)))
  1. . I '$D(^TMP("GMRCRFR",$J)) Q
  1. . N I S I=0
  1. . F S I=$O(^TMP("GMRCRFR",$J,I)) Q:'I D
  1. .. S ^TMP("HLS",$J,SEG)=^TMP("GMRCRFR",$J,I)
  1. .. S SEG=SEG+1
  1. . K ^TMP("GMRCRFR",$J)
  1. . Q
  1. D ;prov DX changed, send it
  1. . S GMRCPD=$$OBXPD^GMRCISG1(GMRCDA) ;bl;154 preventing blank line for OBX
  1. . I GMRCPD'="" S ^TMP("HLS",$J,SEG)=GMRCPD ; build prov DX in OBX
  1. . S SEG=SEG+1
  1. ;
  1. D ;send ed-res comment and file as is
  1. . N I
  1. . K ^TMP("GMRCMT",$J)
  1. . D OBXWP^GMRCISEG(GMRCDA,"",GMRCACT,$NA(^TMP("GMRCMT",$J)))
  1. . Q:'$O(^TMP("GMRCMT",$J,0))
  1. . S I=0 F S I=$O(^TMP("GMRCMT",$J,I)) Q:'I D
  1. .. S ^TMP("HLS",$J,SEG)=^TMP("GMRCMT",$J,I)
  1. .. S SEG=SEG+1
  1. . K ^TMP("GMRCMT",$J)
  1. . Q
  1. S ^TMP("HLS",$J,SEG)=$$OBXTZ^GMRCISEG ;always include local time zone
  1. S HLL("LINKS",1)=$$ROUTE^GMRCIEVT(GMRCDA) I '$L(HLL("LINKS",1)) D Q
  1. . D:'$$EXIST201(GMRCDA,GMRCACT) LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,"",903) ;log error ;MKN GMRC*3*154 '$$EXIST201
  1. S HLP("SUBSCRIBER")="^^^^"_$P(HLL("LINKS",1),U,3) ;MKN GMRC*3*154 Station coming back from $$ROUTE
  1. D GENERATE^HLMA("GMRC IFC ORM EVENT","GM",1,.GMRC773,,.HLP) ;MKN GMRC*3*154 added 6th parameter that passes to HLP array in GENERATE^HLMA
  1. N ERR S ERR=$S($P(GMRC773,U,2):904,1:"") ; if err from HL7, log it
  1. D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,+GMRC773,ERR)
  1. Q
  1. ;
  1. SF(GMRCDA,GMRCACT) ;send SIG FINDING update
  1. ;Input:
  1. ; GMRCDA = ien from file 123
  1. ; GMRCACT = ien of the activity from 40 multiple
  1. N HL,HLL,SEG,GMRC773,GMRCIQT,GMRCOS,GMRCCRNR,OBR,PROSTHCS ; P184
  1. S SEG=1
  1. K ^TMP("HLS",$J)
  1. D INIT^HLFNC2("GMRC IFC ORM EVENT",.HL)
  1. I $G(HL) D Q ; if HL array can't be built, log it with an error
  1. . D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,,904)
  1. D I $D(GMRCIQT) D NOMPI^GMRCIEVT(GMRCDA,GMRCACT) Q ;build PID seg
  1. . N GMRCDFN S GMRCDFN=$P(^GMR(123,+GMRCDA,0),U,2)
  1. . I '$G(GMRCDFN) S GMRCIQT=1 Q
  1. . I $$GETICN^MPIF001(GMRCDFN)<1 S GMRCIQT=1 Q
  1. . I $$IFLOCAL^MPIF001(GMRCDFN) S GMRCIQT=1 Q
  1. . S ^TMP("HLS",$J,SEG)=$$EN^VAFCPID(GMRCDFN,"1,2,3,4,5,7,8,19")
  1. . ;
  1. . ; If remote site is converted, enhance the PID segment. p184
  1. . ;
  1. . I $$CNVTD^GMRCIEVT(GMRCDA)=1 S ^TMP("HLS",$J,SEG)=$$ADD2PID^GMRCIUTL(^TMP("HLS",$J,SEG),GMRCDFN,$P($G(^GMR(123,GMRCDA,"CERNER")),U,3)) ;
  1. . ;
  1. . S SEG=SEG+1
  1. . Q
  1. ;
  1. ;build ORC seg based on GMRCACT
  1. S GMRCOS=$S($P(^GMR(123,GMRCDA,0),U,12)="2":"CM",1:"IP")
  1. S ^TMP("HLS",$J,SEG)=$$ORC^GMRCISEG(GMRCDA,"RE","CM",GMRCACT)
  1. S SEG=SEG+1
  1. ;
  1. ; If remote site is converted, add OBR segment. p184
  1. ;
  1. I $$CNVTD^GMRCIEVT(GMRCDA)=1 D ;
  1. . S OBR=$$OBR^GMRCISG1(GMRCDA) ;
  1. . S OBR=$$ADD2OBR^GMRCIUTL(OBR,GMRCDA),^TMP("HLS",$J,SEG)=OBR ;
  1. . S SEG=SEG+1
  1. ;
  1. ; Determine if order is for Prosthetics - p184 WTC 6/1/22
  1. ;
  1. S PROSTHCS=$S($G(OBR)="":0,$P($P(OBR,"|",5),U,2)["PROSTHETICS IFC":1,1:0) ; P184
  1. ;
  1. I $O(^GMR(123,GMRCDA,40,GMRCACT,1,0)) D ;load up comment to send
  1. . K ^TMP("GMRCMT",$J)
  1. . S GMRCCRNR=$$ISCERNER^GMRCIEVT(GMRCDA) ;MKN 184
  1. . D:GMRCCRNR&'PROSTHCS CRNROBX(GMRCDA,$NA(^TMP("GMRCMT",$J))) ; P184 WTC 6/1/22
  1. . D:'GMRCCRNR!PROSTHCS OBXWP^GMRCISEG(GMRCDA,"",GMRCACT,$NA(^TMP("GMRCMT",$J))) ; P184 WTC 6/1/22
  1. . Q:'$O(^TMP("GMRCMT",$J,0))
  1. . N I S I=0 F S I=$O(^TMP("GMRCMT",$J,I)) Q:'I D
  1. .. S ^TMP("HLS",$J,SEG)=^TMP("GMRCMT",$J,I)
  1. .. S SEG=SEG+1
  1. . K ^TMP("GMRCMT",$J)
  1. . Q
  1. I $L($P(^GMR(123,GMRCDA,0),U,19)) S ^TMP("HLS",$J,SEG)=$$OBXSF^GMRCISEG(GMRCDA),SEG=SEG+1
  1. S ^TMP("HLS",$J,SEG)=$$OBXTZ^GMRCISEG ;always include local time zone
  1. S HLL("LINKS",1)=$$ROUTE^GMRCIEVT(GMRCDA) I '$L(HLL("LINKS",1)) D Q
  1. . D:'$$EXIST201(GMRCDA,GMRCACT) LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,"",903) ;log error ;MKN GMRC*3*154 '$$EXIST201
  1. S HLP("SUBSCRIBER")="^^^^"_$P(HLL("LINKS",1),U,3) ;MKN GMRC*3*154 Station coming back from $$ROUTE
  1. ;
  1. D GENERATE^HLMA("GMRC IFC ORM EVENT","GM",1,.GMRC773,,.HLP) ;MKN GMRC*3*154 added 6th parameter that passes to HLP array in GENERATE^HLMA
  1. N ERR S ERR=$S($P(GMRC773,U,2):904,1:"") ; if err from HL7, log it
  1. D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,+GMRC773,ERR)
  1. Q
  1. ;
  1. FWD(GMRCDA,GMRCACT) ;bld HL7 msg upon FWD action
  1. ;Input:
  1. ; GMRCDA = ien from file 123
  1. ; GMRCACT = ien of the activity from 40 multiple
  1. N HL,HLL,SEG,GMRC773,GMRCIQT,GMRCOS,GMRCCRNR,OBR,PROSTHCS ; P184
  1. S SEG=1
  1. K ^TMP("HLS",$J)
  1. D INIT^HLFNC2("GMRC IFC ORM EVENT",.HL)
  1. I $G(HL) D Q ; if HL array can't be built, log it with an error
  1. . D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,,904)
  1. D I $D(GMRCIQT) D NOMPI^GMRCIEVT(GMRCDA,GMRCACT) Q ;build PID seg
  1. . N GMRCDFN S GMRCDFN=$P(^GMR(123,+GMRCDA,0),U,2)
  1. . I '$G(GMRCDFN) S GMRCIQT=1 Q
  1. . I $$GETICN^MPIF001(GMRCDFN)<1 S GMRCIQT=1 Q
  1. . I $$IFLOCAL^MPIF001(GMRCDFN) S GMRCIQT=1 Q
  1. . S ^TMP("HLS",$J,SEG)=$$EN^VAFCPID(GMRCDFN,"1,2,3,4,5,7,8,19")
  1. . ;
  1. . ; If remote site is converted, enhance the PID segment. p184
  1. . ;
  1. . I $$CNVTD^GMRCIEVT(GMRCDA)=1 S ^TMP("HLS",$J,SEG)=$$ADD2PID^GMRCIUTL(^TMP("HLS",$J,SEG),GMRCDFN,$P($G(^GMR(123,GMRCDA,"CERNER")),U,3)) ;
  1. . ;
  1. . S SEG=SEG+1
  1. . Q
  1. ;
  1. ;build ORC seg based on GMRCACT
  1. S ^TMP("HLS",$J,SEG)=$$ORC^GMRCISEG(GMRCDA,"XX","IP",GMRCACT)
  1. S SEG=SEG+1
  1. ;
  1. S OBR=$$OBR^GMRCISG1(GMRCDA,GMRCACT) ;
  1. ;
  1. ; If remote site is converted, enhance the OBR segment. p184
  1. ;
  1. I $$CNVTD^GMRCIEVT(GMRCDA)=1 S OBR=$$ADD2OBR^GMRCIUTL(OBR,GMRCDA) ;
  1. S ^TMP("HLS",$J,SEG)=OBR ;
  1. ;
  1. S SEG=SEG+1 ;
  1. ;
  1. ; Determine if order is for Prosthetics - p184 WTC 6/1/22
  1. ;
  1. S PROSTHCS=$S($G(OBR)="":0,$P($P(OBR,"|",5),U,2)["PROSTHETICS IFC":1,1:0) ; P184
  1. ;
  1. I $O(^GMR(123,GMRCDA,40,GMRCACT,1,0)) D ;load up comment to send
  1. . K ^TMP("GMRCMT",$J)
  1. . S GMRCCRNR=$$ISCERNER^GMRCIEVT(GMRCDA) ;MKN 184
  1. . D:GMRCCRNR&'PROSTHCS CRNROBX(GMRCDA,$NA(^TMP("GMRCMT",$J))) ; P184 WTC 6/1/22
  1. . D:'GMRCCRNR!PROSTHCS OBXWP^GMRCISEG(GMRCDA,"",GMRCACT,$NA(^TMP("GMRCMT",$J))) ; P184 WTC 6/1/22
  1. . Q:'$O(^TMP("GMRCMT",$J,0))
  1. . N I S I=0 F S I=$O(^TMP("GMRCMT",$J,I)) Q:'I D
  1. .. S ^TMP("HLS",$J,SEG)=^TMP("GMRCMT",$J,I)
  1. .. S SEG=SEG+1
  1. . K ^TMP("GMRCMT",$J)
  1. . Q
  1. I $L($P(^GMR(123,GMRCDA,0),U,19)) S ^TMP("HLS",$J,SEG)=$$OBXSF^GMRCISEG(GMRCDA),SEG=SEG+1
  1. S ^TMP("HLS",$J,SEG)=$$OBXTZ^GMRCISEG ;always include local time zone
  1. S HLL("LINKS",1)=$$ROUTE^GMRCIEVT(GMRCDA) I '$L(HLL("LINKS",1)) D Q
  1. . D:'$$EXIST201(GMRCDA,GMRCACT) LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,"",903) ;log error ;MKN GMRC*3*154 '$$EXIST201
  1. S HLP("SUBSCRIBER")="^^^^"_$P(HLL("LINKS",1),U,3) ;MKN GMRC*3*154 Station coming back from $$ROUTE
  1. ;
  1. D GENERATE^HLMA("GMRC IFC ORM EVENT","GM",1,.GMRC773,,.HLP) ;MKN GMRC*3*154 added 6th parameter that passes to HLP array in GENERATE^HLMA
  1. N ERR S ERR=$S($P(GMRC773,U,2):904,1:"") ; if err from HL7, log it
  1. D LOGMSG^GMRCIUTL(GMRCDA,GMRCACT,+GMRC773,ERR)
  1. Q
  1. ;
  1. FWD2IFC(GMRCDA,GMRCACT) ;pkg up and send request upon fwd'ing into IFC serv
  1. ;Input:
  1. ; GMRCDA = ien from file 123
  1. ; GMRCACT = ien of the activity from 40 multiple
  1. N GMRCACTN
  1. I '$P(^GMR(123,GMRCDA,0),U,22),'$D(^GMR(123.6,"C",GMRCDA)) D Q
  1. . D NW^GMRCIEVT(GMRCDA,GMRCACT) ; Added GMRCACT parameter P 189 wtc 6/24/24
  1. . S GMRCACTN=1
  1. . F S GMRCACTN=$O(^GMR(123,GMRCDA,40,GMRCACTN)) Q:'GMRCACTN D
  1. .. D TRIGR^GMRCIEVT(GMRCDA,GMRCACTN)
  1. D FWD(GMRCDA,GMRCACT)
  1. Q
  1. ;
  1. EXIST201(GMRCDA,GMRCACT) ;
  1. N IEN123P6 S IEN123P6=$O(^GMR(123.6,"C",GMRCDA,GMRCACT,"")) Q:'IEN123P6 0
  1. Q $S($$GET1^DIQ(123.6,IEN123P6_",",.08)="Unknown Patient":1,1:0)
  1. ;
  1. ;MKN 184 ADDED CRNRNTE
  1. CRNRNTE(IEN,GMRCNA) ;format an NTE seg with all comments to go to Cerner
  1. ;Output is all comments in ^TMP("GMRCMT",$J)
  1. ;
  1. N CMT,GMRCACTD,GMRCDT,GMRCENBY,GMRCIENS,GMRCL,GMRCLOC,GMRCN,GMRCOUT,GMRCPCS,GMRCT,GMRCTMP,GMRCX,TCH
  1. S CMT=0
  1. D SETTCH2^GMRCIMSG() ;MKN GMRC*3.0*154 Get TCH array
  1. S GMRCLOC=$P($$SITE^VASITE,U,2)
  1. ;
  1. ; Prepare list of consult activities that trigger generation of cumulative comments.
  1. ;
  1. F GMRCACTD="ADDED COMMENT","DISCONTINUED","CANCELLED","RECEIVED","REMOTE REQUEST RECEIVED","SCHEDULED","SIG FINDING UPDATE","FORWARDED FROM","FWD TO REMOTE SERVICE","COMPLETE/UPDATE" D ;
  1. . S GMRCX=$O(^GMR(123.1,"B",GMRCACTD,"")) S:GMRCX GMRCACTD(GMRCX)=$$TITLE^XLFSTR(GMRCACTD)
  1. F GMRCACTD="STATUS CHANGE","EDIT/RESUBMITTED","DISASSOCIATE RESULT","ADDENDUM ADDED TO","NEW NOTE ADDED" D ; wtc 3/2/23 P185
  1. . S GMRCX=$O(^GMR(123.1,"B",GMRCACTD,"")) S:GMRCX GMRCACTD(GMRCX)=$$TITLE^XLFSTR(GMRCACTD)
  1. ;
  1. S GMRCT=0,GMRCN="@" F S GMRCN=$O(^GMR(123,IEN,40,GMRCN),-1) Q:'GMRCN S GMRCX=^(GMRCN,0) I $D(GMRCACTD($P(GMRCX,U,2))),$D(^GMR(123,IEN,40,GMRCN,1,1)) D
  1. . S GMRCIENS=GMRCN_","_IEN_"," K GMRCOUT D GETS^DIQ(123.02,GMRCIENS,"2;4;.21","IE","GMRCOUT")
  1. . S GMRCDT=$G(GMRCOUT(123.02,GMRCIENS,2,"I")),GMRCDT=$$UP^XLFSTR($$FMTE^XLFDT(GMRCOUT(123.02,GMRCIENS,2,"I"),"5PZ"))
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="NTE|1|L|Activity Type: "_GMRCACTD($P(GMRCX,U,2))
  1. . S GMRCL=0 F S GMRCL=$O(^GMR(123,IEN,40,GMRCN,1,GMRCL)) Q:'GMRCL S GMRCT=GMRCT+1,GMRCX=$G(^(GMRCL,0)),(@GMRCNA@(GMRCT))="NTE|1|L|"_GMRCX
  1. . S GMRCT=GMRCT+1,GMRCLOC=$$LOC(GMRCLOC,GMRCIENS),@GMRCNA@(GMRCT)="NTE|1|L|Entered At Location: "_GMRCLOC D SITE ; P184
  1. . S GMRCENBY=$G(GMRCOUT(123.02,GMRCIENS,4,"E")) I GMRCENBY="" S GMRCENBY=$P($G(GMRCOUT(123.02,GMRCIENS,.21,"E")),U)
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="NTE|1|L|Entered By: "_GMRCENBY
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="NTE|1|L|"_GMRCDT
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="NTE|1|L| "
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="NTE|1|L| "
  1. Q
  1. ;
  1. CRNROBX(IEN,GMRCNA) ;If Add Comment going to Cerner, send ALL comments
  1. ;
  1. ; IEN = pointer to #123
  1. ; GMRCNA = name of array where HL7 segments are stored
  1. ;
  1. ;Output is all comments in ^TMP("GMRCMT",$J)
  1. N GMRCACT,GMRCACTD,GMRCDT,GMRCENBY,GMRCIENS,GMRCL,GMRCLOC,GMRCN,GMRCO,GMRCT,GMRCTMP,GMRCX,LOCNAME ;
  1. ;
  1. ; Prepare list of consult activities that trigger generation of cumulative comments.
  1. ;
  1. S GMRCLOC=$P($$SITE^VASITE,U,2) ;
  1. F GMRCACTD="ADDED COMMENT","DISCONTINUED","CANCELLED","RECEIVED","REMOTE REQUEST RECEIVED","SCHEDULED","SIG FINDING UPDATE","FORWARDED FROM","COMPLETE/UPDATE","FWD TO REMOTE SERVICE" D ; wtc 2/4/22
  1. . S GMRCX=$O(^GMR(123.1,"B",GMRCACTD,"")) S:GMRCX GMRCACTD(GMRCX)=$$TITLE^XLFSTR(GMRCACTD)
  1. F GMRCACTD="STATUS CHANGE","EDIT/RESUBMITTED","DISASSOCIATE RESULT","ADDENDUM ADDED TO","NEW NOTE ADDED" D ; wtc 3/2/23 P185
  1. . S GMRCX=$O(^GMR(123.1,"B",GMRCACTD,"")) S:GMRCX GMRCACTD(GMRCX)=$$TITLE^XLFSTR(GMRCACTD)
  1. ;
  1. S GMRCTMP=$NA(^TMP("GMRCCRNRCMT",$J)) K @GMRCTMP
  1. ;
  1. S GMRCT=0,GMRCN="@" ;
  1. F S GMRCN=$O(^GMR(123,IEN,40,GMRCN),-1) Q:'GMRCN S GMRCX=^(GMRCN,0) I $D(GMRCACTD($P(GMRCX,U,2))),$D(^GMR(123,IEN,40,GMRCN,1,1)) D ;
  1. . S GMRCIENS=GMRCN_","_IEN_"," K GMRCO D GETS^DIQ(123.02,GMRCIENS,"2;4;.21;.32;.33","IE","GMRCO")
  1. . S GMRCDT=$G(GMRCO(123.02,GMRCIENS,2,"I")),GMRCDT=$$UP^XLFSTR($$FMTE^XLFDT(GMRCO(123.02,GMRCIENS,2,"I"),"5PZ"))
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"| ||||||P" ;
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"|Activity Type: "_GMRCACTD($P(GMRCX,U,2))_"||||||P" ;
  1. . ;
  1. . K @GMRCTMP D OBXWP^GMRCISEG(IEN,"IP",GMRCN,GMRCTMP) ; WTC 2/4/22
  1. . S GMRCL=0 F S GMRCL=$O(@GMRCTMP@(GMRCL)) Q:'GMRCL S GMRCT=GMRCT+1,GMRCX=@GMRCTMP@(GMRCL),$P(GMRCX,"|",5)=GMRCT,@GMRCNA@(GMRCT)=GMRCX ; WTC 6/10/22
  1. . ;
  1. . I GMRCO(123.02,GMRCIENS,.32,"I")'=1 S GMRCT=GMRCT+1 S (GMRCLOC,LOCNAME)=$$LOC^GMRCIEVT(GMRCLOC,GMRCIENS),@GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"|Entered At Location: "_GMRCLOC_"||||||P" ;
  1. . I GMRCO(123.02,GMRCIENS,.32,"I")=1 D ;
  1. .. N GMRCSITE,GMRCSTDA,GMRCSTNM S GMRCSITE=GMRCO(123.02,GMRCIENS,.33,"I"),GMRCSTDA=$O(^DIC(4,"D",GMRCSITE,0)),GMRCSTNM=$$GET1^DIQ(4,GMRCSTDA,.01) ;
  1. .. S GMRCT=GMRCT+1 S @GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"|Entered At Location: "_GMRCSTNM_"||||||P" ;
  1. . S GMRCENBY=$G(GMRCO(123.02,GMRCIENS,4,"E")) I GMRCENBY="" S GMRCENBY=$P($G(GMRCO(123.02,GMRCIENS,.21,"E")),U)
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"|Entered By: "_GMRCENBY_"||||||P" ;
  1. . S GMRCT=GMRCT+1,@GMRCNA@(GMRCT)="OBX|3|TX|^COMMENTS^|"_GMRCT_"|"_GMRCDT_"||||||P" ;
  1. K @GMRCTMP
  1. Q
  1. ;
  1. LOC(GMRCLOC,GMRCIENS) ;DETERMINE LOCATION
  1. N LOCNAME
  1. I '$D(^GMR(123,$P(GMRCIENS,",",2),40,($P(GMRCIENS,",",1)-1),3)) D SITE Q GMRCLOC
  1. S LOCNAME=^GMR(123,$P(GMRCIENS,",",2),40,($P(GMRCIENS,",",1)-1),3)
  1. S LOCNAME=$P(LOCNAME,U,3)
  1. S LOCNAME=$P(^DIC(4,LOCNAME,0),U,1)
  1. Q LOCNAME
  1. SITE ;SET LOCAL SITE
  1. S GMRCLOC=$P($$SITE^VASITE,U,2)
  1. Q