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

PRCPHLM0.m

Go to the documentation of this file.
  1. PRCPHLM0 ;WISC/CC - NOTIFY USERS OF HL7 TRANSACTION PROBLEMS; 4/00
  1. V ;;5.1;IFCAP;**1**;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ERR(NUMBER,BULLETIN,SECID,PARAM,HLTXN,PRCPHL) ;
  1. ;
  1. ; NUMBER = error code
  1. ; BULLETIN = Specifies the bulletin to send to users
  1. ; SECID = ien of secondary inventory point
  1. ; PRARAM = array of values extracted from the HL7 transaction
  1. ; HLTXN = ien of ^HLMA and of ^HL(772)
  1. ; PRCPHL = array of HL7 segments in message (not always present)
  1. ;
  1. N ERR,LNCNT,ITEM,MES,PRCPXMY
  1. S ERR=NUMBER,LNCNT=0
  1. K ^TMP($J,"PRCPHL7")
  1. S MES="HL7 transaction #"_HLTXN_" has "
  1. F LNCNT=2,3 S ^TMP($J,"PRCPHL7",1,LNCNT,0)=" "
  1. I +ERR=1 D ; bad message
  1. . I ERR="1A" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"missing or unexpected segments."
  1. . I ERR="1B" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"the wrong message type."
  1. . I ERR="1C" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a bad order control code in ORC."
  1. . I ERR="1D" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a bad order control code/activity."
  1. . I ERR="1E" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"bad values in the QRD fields."
  1. . I ERR="1F" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an indication that the supply station could not respond."
  1. I +ERR=2 D ; bad order number
  1. . I ERR="2A" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an order not in GIP or primary is unknown."
  1. . I ERR="2A" S ^TMP($J,"PRCPHL7",1,2,0)="Please remove this order from the supply station."
  1. . I ERR="2B" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"activity on a posted order."
  1. . I ERR="2C" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"order activity rejected by GIP."
  1. . I ERR="2C" S ^TMP($J,"PRCPHL7",1,2,0)="All Posting activity for this order must be done on GIP."
  1. . I ERR="2D" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"no order number."
  1. I +ERR=3 D ; bad secondary inventory point
  1. . I ERR="3A" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an inventory point not in GIP."
  1. . I ERR="3B" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an IP that is not a secondary."
  1. . I ERR="3C" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a secondary IP not in the order."
  1. . I ERR="3D" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an invalid site specified."
  1. . I ERR="3E" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"no station specified."
  1. . I ERR="3F" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a non-supply station IP."
  1. I +ERR=4 D ; bad quantity received
  1. . S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an excessive quantity transacted."
  1. I +ERR=5 D ; bad quantity remaining
  1. . S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an excessive quantity remaining."
  1. I +ERR=6 D ; bad item
  1. . I ERR="6A" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an item not in the order."
  1. . I ERR="6B" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an item not in the primary."
  1. . I ERR="6C" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an item not in the secondary."
  1. . I ERR="6D" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a non-supply station item."
  1. . I ERR="6E" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"an invalid item."
  1. . I ERR="6F" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"no item information."
  1. . I ERR="6G" S ^TMP($J,"PRCPHL7",1,1,0)=MES_"a case cart or instrument kit item."
  1. . S ^TMP($J,"PRCPHL7",1,2,0)="item# "_PARAM("ITEM")_" "_PARAM("NAME")
  1. ;
  1. I $P(HLTXN,".",3)=447 D ; error encountered processing ^PRCP(447.1)
  1. . I BULLETIN="PRCP_BAD_ORDER" D
  1. . . I PARAM("TYPE")="FU" S ^TMP($J,"PRCPHL7",1,2,0)="Message indicating receipt of all ordered items was not processed."
  1. . . I PARAM("TYPE")'="FU",ERR'="6F" S ^TMP($J,"PRCPHL7",1,2,0)="Received "_PARAM("QTY")_" unit(s) of item# "_PARAM("ITEM")_" "_PARAM("NAME")
  1. . I BULLETIN="PRCP_BAD_ACTIVITY" D
  1. . . S ^TMP($J,"PRCPHL7",1,2,0)=PARAM("QTY")_" unit(s) of item# "_PARAM("ITEM")_" "_PARAM("NAME")
  1. . . I PARAM("ACTIVITY")="USGE" S I="taken for "_PARAM("RECIPIENT")
  1. . . I PARAM("ACTIVITY")="RTRN" S I="returned from "_PARAM("RECIPIENT")
  1. . . I PARAM("ACTIVITY")="DISP" S I="disposed of"
  1. . . I PARAM("ACTIVITY")="ADJD"!(PARAM("ACTIVITY")="DISP") S I="adjusted out of the inventory"
  1. . . I PARAM("ACTIVITY")="ADJI" S I="adjusted into the inventory"
  1. . . S ^TMP($J,"PRCPHL7",1,3,0)="was/were "_I_" by "_PARAM("USER")
  1. ;
  1. I +ERR>99 D ; error encountered while building ^PRCP(447.1)
  1. . S ^TMP($J,"PRCPHL7",1,1,0)="GIP can't create a new record for HL7 transaction# "_HLTXN
  1. . S ^TMP($J,"PRCPHL7",1,2,0)="Contact your IRM if GIP continues to have trouble creating records."
  1. . I BULLETIN="PRCP_BAD_ORDER" D
  1. . . I PARAM("TYPE")="FU" S ^TMP($J,"PRCPHL7",1,3,0)="Message indicating receipt of all ordered items was not processed."
  1. . . I PARAM("TYPE")'="FU" S ^TMP($J,"PRCPHL7",1,3,0)="Received "_PARAM("QTY")_" unit(s) of item# "_PARAM("ITEM")_" "_PARAM("NAME")
  1. . . S ^TMP($J,"PRCPHL7",1,4,0)="Please adjust the GIP to show this information."
  1. . . S ^TMP($J,"PRCPHL7",1,5,0)=" "
  1. . I BULLETIN="PRCP_BAD_ACTIVITY" D
  1. . . S ^TMP($J,"PRCPHL7",1,3,0)=PARAM("QTY")_" unit(s) of item# "_PARAM("ITEM")_" "_PARAM("NAME")
  1. . . I PARAM("ACTIVITY")="USGE" S I="taken for "_PARAM("RECIPIENT")
  1. . . I PARAM("ACTIVITY")="RTRN" S I="returned from "_PARAM("RECIPIENT")
  1. . . I PARAM("ACTIVITY")="DISP" S I="disposed of"
  1. . . I PARAM("ACTIVITY")="ADJD"!(PARAM("ACTIVITY")="DISP") S I="adjusted out of the inventory"
  1. . . I PARAM("ACTIVITY")="ADJI" S I="adjusted into the inventory"
  1. . . S ^TMP($J,"PRCPHL7",1,4,0)="was/were "_I_" by "_PARAM("USER")
  1. . . S ^TMP($J,"PRCPHL7",1,5,0)="Please adjust the GIP to show this information."
  1. . . S ^TMP($J,"PRCPHL7",1,6,0)=" "
  1. . . S LNCNT=6
  1. S LNCNT=3,I=0
  1. I ERR>99 D
  1. . I BULLETIN="PRCP_BAD_ACTIVITY" S LNCNT=6
  1. . I BULLETIN="PRCP_BAD_ORDER" S LNCNT=5
  1. I $D(PRCPHL) F S I=$O(PRCPHL(I)) Q:I']"" D
  1. . S LNCNT=LNCNT+1,^TMP($J,"PRCPHL7",1,LNCNT,0)=PRCPHL(I)
  1. I $D(PRCPHL),HLQUIT>0 F X HLNEXT Q:HLQUIT'>0 D
  1. . S LNCNT=LNCNT+1,^TMP($J,"PRCPHL7",1,LNCNT,0)=HLNODE
  1. S ^TMP($J,"PRCPHL7",1,0)=LNCNT
  1. I SECID D BLDLIST I $O(XMY(0))]"" D SEND
  1. I 'SECID D
  1. . N SS
  1. . S SECID=0,SS=0
  1. . F S SS=$O(^PRCP(445,"AI",SS)) Q:'+SS D
  1. . . S SECID=$O(^PRCP(445,"AI",SS,SECID)) Q:'+SECID D BLDLIST
  1. . I $O(XMY(0))]"" D SEND
  1. K ^TMP($J,"PRCPHL7")
  1. Q
  1. ;
  1. ; build array of message recipients
  1. BLDLIST D GETUSER^PRCPXTRM(SECID) Q:'$O(PRCPXMY("")) ; inventory point users
  1. S ITEM=0
  1. ; restrict to managers
  1. F S ITEM=$O(PRCPXMY(ITEM)) Q:ITEM'>0 I PRCPXMY(ITEM)=1 S XMY(ITEM)=""
  1. Q
  1. ;
  1. SEND S XMTEXT="^TMP($J,""PRCPHL7"",1,"
  1. S XMB=BULLETIN
  1. I XMB="PRCP_BAD_ORDER" D
  1. . S XMB(1)=PARAM("ORDER")
  1. . S XMB(2)=PARAM("SIPNAME")
  1. I XMB="PRCP_BAD_ACTIVITY" D
  1. . S XMB(1)=PARAM("SIPNAME")
  1. . S XMB(2)=PARAM("ITEM")
  1. . S XMB(3)=PARAM("ACTIVITY")
  1. I XMB="PRCP_BAD_QUERY" D
  1. . S XMB(1)=PARAM("SIPNAME")
  1. S XMDUZ="SUPPLY STATION INTERFACE"
  1. D EN^XMB
  1. Q