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

PXRMAPI.m

Go to the documentation of this file.
  1. PXRMAPI ;SLC/PKR - Clinical Reminders APIs;03/06/2015 07:38
  1. ;;2.0;CLINICAL REMINDERS;**45**;Feb 04, 2005;Build 566
  1. ;========================================================
  1. ITEMLIST(RIEN,GNAME,LIST,SUB) ;Return a list of items for an order
  1. ;check group.
  1. ;Controlled by ICR #6029
  1. ;INPUT: RIEN - Rule IEN (file #801.1) (optional)
  1. ; GNAME - GROUP NAME (.01 field in file #801) (optional)
  1. ; LIST - type of list to return; either P, O, I or A
  1. ; P: Pharmacy item list
  1. ; O: Orderable item list
  1. ; I: Imaging Type
  1. ; A: All entries
  1. ; SUB - Name of the subscript underwhich to return data in ^TMP($J,
  1. ; (optional; defaults to "PXRMLIST")
  1. ;OUTPUT: Data is returned descendant from ^TMP($J,SUB)
  1. ; Error messages are returned in ^TMP($J,SUB,"ERROR")
  1. N FIELD,INDEX,ITEM,TYPE,ENTRY
  1. I $G(SUB)="" S SUB="PXRMLIST"
  1. K ^TMP($J,SUB)
  1. ;ICR #10104
  1. S GNAME=$$UP^XLFSTR($G(GNAME)),LIST=$$UP^XLFSTR($G(LIST))
  1. I $G(RIEN)="",$G(GNAME)="" D Q
  1. .S ^TMP($J,SUB,"ERROR")="You must specify either a rule IEN or a group name."
  1. I $G(RIEN)'="",$G(GNAME)'="" D Q
  1. .S ^TMP($J,SUB,"ERROR")="You cannot request both a rule and a group name at the same time."
  1. I $G(GNAME)="",$G(RIEN)'?1.N!('$D(^PXD(801.1,$G(RIEN,0)))) D Q
  1. .S ^TMP($J,SUB,"ERROR")="Invalid rule requested: "_$G(RIEN)
  1. I $G(RIEN)="",'$D(^PXD(801,"B",GNAME)) D Q
  1. .S ^TMP($J,SUB,"ERROR")="Invalid group name requested: "_GNAME
  1. I $L(LIST)'=1!("POIA"'[LIST) D Q
  1. .S ^TMP($J,SUB,"ERROR")="Invalid list requested: "_LIST_"; specify either P, O, I or A"
  1. I $G(RIEN) D Q:$D(^TMP($J,SUB,"ERROR"))
  1. .N IEN2
  1. .S IEN2=0 F S IEN2=$O(^PXD(801,"R",RIEN,IEN2)) Q:'IEN2 D
  1. ..S ENTRY(IEN2)=$P($G(^PXD(801,IEN2,0)),U)
  1. .I $D(ENTRY)'=10 S ^TMP($J,SUB,"ERROR")="Invalid rule requested: "_RIEN
  1. I GNAME'="" D Q:$D(^TMP($J,SUB,"ERROR"))
  1. .S ENTRY($O(^PXD(801,"B",GNAME,0)))=GNAME
  1. .I $D(ENTRY(0)) S ^TMP($J,SUB,"ERROR")="Invalid name requested: "_GNAME
  1. S INDEX=0 F S INDEX=$O(ENTRY(INDEX)) Q:'INDEX D
  1. .S INDEX(3)=0 F S INDEX(3)=$O(^PXD(801,INDEX,1.5,"B",INDEX(3))) Q:'INDEX(3) D
  1. ..S TYPE=$$GETTYPE(INDEX(3)) I TYPE="" Q
  1. ..S ^TMP($J,SUB,ENTRY(INDEX),TYPE,INDEX(3))=""
  1. Q
  1. ;
  1. GETTYPE(TYPE) ;
  1. Q $S(TYPE["PSDRUG":"P",TYPE["PSNDF(50.6":"P",TYPE["PS(50.605":"P",TYPE["RA(79.2":"I",TYPE["ORD(101.43":"O",1:"")
  1. ;========================================================
  1. PUSAGE(IEN) ;Return true if the reminder definition contains a "P"
  1. ;in the Usage field. This means it is ok for a patient to use the
  1. ;reminder. IEN is the internal entry number.
  1. N OK,USAGE
  1. S USAGE=$P($G(^PXD(811.9,IEN,100)),U,4)
  1. S OK=$S(USAGE["P":1,1:0)
  1. Q OK
  1. ;
  1. ;========================================================
  1. USAGE(IEN) ;Return the Usage for a reminder definition. IEN is the
  1. ;internal entry number.
  1. Q $P($G(^PXD(811.9,IEN,100)),U,4)
  1. ;