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

PXRMORHL.m

Go to the documentation of this file.
  1. PXRMORHL ; SLC/AGP - Reminder Order Checks HL7 updates;11/13/2017
  1. ;;2.0;CLINICAL REMINDERS;**16,45**;Feb 04, 2005;Build 566
  1. ;
  1. Q
  1. ADDMSG(OI,ACT,NL) ;
  1. N ACTION,GIEN,OINAME
  1. I '$D(^PXD(801,"O",OI_";ORD(101.43,")),ACT'=1 Q
  1. S OINAME=$P($G(^ORD(101.43,OI,0)),U)
  1. S ACTION=$S(ACT=1:"added",ACT=2:"inactivated",ACT=3:"changed",ACT=4:"reactivated",1:"unknown")
  1. ;only build message for new OI and OI contains within a group
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=""
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=OINAME_" was "_ACTION
  1. S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" it is used in the following Orderable Item Groups"
  1. ;build OI message for each OI
  1. ;add specific OI group to the message
  1. I '$D(^PXD(801,"O",OI_";ORD(101.43,")) D Q
  1. .S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" None" Q
  1. S GIEN=0 F S GIEN=$O(^PXD(801,"O",OI_";ORD(101.43,",GIEN)) Q:GIEN'>0 D
  1. .S NL=NL+1
  1. .S ^TMP("PXRMXMZ",$J,NL,0)=" "_$P($G(^PXD(801,GIEN,0)),U)
  1. Q
  1. ;
  1. EN ;
  1. N ACT,CHANGED,NL,NODE,OIIEN,SUB,SUB1
  1. K ^TMP("PXRMXMZ",$J)
  1. S NL=0
  1. ;check for new OI first
  1. I $D(^TMP($J,"NEW")) D
  1. .S OIIEN=0 F S OIIEN=$O(^TMP($J,"NEW",OIIEN)) Q:OIIEN'>0 D ADDMSG(OIIEN,1,.NL)
  1. ;
  1. S OIIEN=0 F S OIIEN=$O(^TMP($J,"BEFORE",OIIEN)) Q:OIIEN'>0 D
  1. .I '$D(^TMP($J,"AFTER",OIIEN)) Q
  1. .S CHANGED=0,SUB=""
  1. .;loop through each OI using the Before Global
  1. .F S SUB=$O(^TMP($J,"BEFORE",OIIEN,SUB)) Q:SUB=""!(CHANGED>0) D
  1. ..;do checks on multiples node
  1. ..I SUB=2!(SUB=8)!(SUB=9)!(SUB=10) D Q
  1. ...;
  1. ...;check the zero node first
  1. ...S NODE=^TMP($J,"BEFORE",OIIEN,SUB,0)
  1. ...I NODE'=$G(^TMP($J,"AFTER",OIIEN,SUB,0)) S CHANGED=3 Q
  1. ...;
  1. ...;check word processing field
  1. ...I SUB=8 D Q
  1. ....S SUB1=0
  1. ....F S SUB1=$O(^TMP($J,"BEFORE",OIIEN,SUB,SUB1)) Q:SUB1'>0!(CHANGED>0) D
  1. .....S NODE=^TMP($J,"AFTER",OIIEN,8,SUB1,0)
  1. .....I NODE'=$G(^TMP($J,"AFTER",OIIEN,8,SUB1,0)) S CHANGED=3 Q
  1. ...;
  1. ...;for other nodes check the "B" xref
  1. ...S SUB1=""
  1. ...F S SUB1=$O(^TMP($J,"BEFORE",OIIEN,SUB,"B",SUB1)) Q:SUB1=""!(CHANGED>0) D
  1. ....I '$D(^TMP($J,"AFTER",OIIEN,SUB,"B",SUB1)) S CHANGED=3
  1. ..;
  1. ..;check non-multiple
  1. ..S NODE=^TMP($J,"BEFORE",OIIEN,SUB)
  1. ..I NODE'=^TMP($J,"AFTER",OIIEN,SUB) D
  1. ...I SUB=.1 D Q
  1. ....I NODE="" S CHANGED=2 Q
  1. ....S CHANGED=4
  1. ...S CHANGED=3
  1. .;
  1. .I CHANGED>0 D ADDMSG(OIIEN,CHANGED,.NL)
  1. I $D(^TMP("PXRMXMZ",$J)) D SEND^PXRMMSG("PXRMXMZ","Orderable Item Updates")
  1. K ^TMP("PXRMXMZ",$J),^TMP($J,"BEFORE"),^TMP($J,"AFTER"),^TMP($J,"NEW")
  1. Q
  1. ;
  1. OIUPDATE(MSG) ;
  1. K ^TMP($J,"AFTER"),^TMP($J,"BEFORE"),^TMP($J,"NEW")
  1. M ^TMP($J,"AFTER")=^TMP($J,"OR OI AFTER")
  1. M ^TMP($J,"BEFORE")=^TMP($J,"OR OI BEFORE")
  1. I $D(^TMP($J,"OR OI NEW")) M ^TMP($J,"NEW")=^TMP($J,"OR OI NEW")
  1. D EN
  1. Q
  1. ;