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

INHMS2.m

Go to the documentation of this file.
  1. INHMS2 ;JSH,DJL; 25 Sep 97 13:01;Interface - Message Search
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. LIST(INQUIT,IND,INSRCH,DWLRF,INRVSRCH,INL,INSRCHCT) ; Build the msg. array
  1. ; MODULE NAME: LIST ( Build the list of matching messages )
  1. ; DESCRIPTION:
  1. ; loop through the messages from date-start to date-end and
  1. ; give the user a progress indicator
  1. ; PARAMETERS:
  1. ; INQUIT = 0 = The program completed properly
  1. ; 1 = No matching messages were found
  1. ; IND = The starting time/date of the search set from information
  1. ; in INSRCH and determined by INRVSRCH flag
  1. ; INSRCH = Array for holding search criteria information
  1. ; DWLRF = Settings for the Display Processor
  1. ; INRVSRCH = Flag set user indicating direction of the search
  1. ; -1 = (default)a reverse listing order. Newest to Oldest
  1. ; 0 = a forward search listing order. Oldest to Newest
  1. ; INL = Array used to load with message items matching the criteria
  1. ; INSRCHCT = The combined count of message items searched
  1. ; CODE BEGINS
  1. N INM,INFNDCT,INBLKCT,INNOMORE,INDSPSZ,DWLR
  1. S INDSPSZ=1000 ; max. num. of msg. for disp. progress
  1. S INFNDCT=$P(@DWLRF,U,2),INBLKCT=INFNDCT+19 ; INBLKCT=num. of msg./win.
  1. S:'IND IND=$O(^INTHU("B",IND),INRVSRCH)
  1. F Q:$S('IND:1,(INRVSRCH>-1)&(IND>INSRCH("INEND")):1,(INRVSRCH=-1)&(IND<INSRCH("INSTART")):1,1:0)!(INFNDCT>(INBLKCT)) D S IND=$O(^INTHU("B",IND),INRVSRCH)
  1. . S INM="" F S INM=$O(^INTHU("B",IND,INM),INRVSRCH) Q:'INM D
  1. .. D MSGTEST(INM,.DWLRF,.INSRCH,.INSRCHCT,.INFNDCT) I '(INSRCHCT#20) D MS^DWD("SEARCHING... (APPROXIMATE) MESSAGES SEARCHED: "_INSRCHCT_" MESSSAGES FOUND: "_INFNDCT)
  1. D MS^DWD("SEARCHING... (APPROXIMATE) MESSAGES SEARCHED: "_INSRCHCT_" MESSSAGES FOUND: "_INFNDCT)
  1. I '$O(@DWLRF@(0)) D MS^DWD("No Messages Found.") S INQUIT=$$CR^UTSRD,INQUIT=1 Q
  1. ; check for completion of search to terminate 'more' functionality
  1. S INNOMORE=0 S:$S('IND:1,(INRVSRCH>-1)&(IND>INSRCH("INEND")):1,(INRVSRCH=-1)&(IND<INSRCH("INSTART")):1,1:0) INNOMORE=1,$P(@DWLRF,U,2)=0
  1. S:'INNOMORE $P(@DWLRF,U,2)=INFNDCT
  1. S INQUIT=0
  1. Q
  1. ;
  1. MSGTEST(INMIEN,INLIST,INSRCH,INSRCHCT,INFNDCT) ; Add matching msg. to array
  1. ; MODULE NAME: MSGTEST ( Interface Message Match Criteria Test )
  1. ; DESCRIPTION: Tests the message for matches to values passed in third
  1. ; parameter array nodes and addes the IEN to the second
  1. ; parameter array. Updates counters accordingly.
  1. ; RETURN = none
  1. ; PARAMETERS:
  1. ; INMIEN= IEN into ^INTHU
  1. ; INLIST = The NAME of the array to add items found
  1. ; INSRCH = The array of items to find
  1. ; INSRCHCT = The count of messages searched
  1. ; INFNDCT = The count of messages found
  1. ; CODE BEGINS
  1. N INTEMPX,INMAXSZ
  1. S INMAXSZ=1100,INTEMPX=$G(^INTHU(INMIEN,0)),INSRCHCT=INSRCHCT+1
  1. I INSRCH("INDEST")]"",$P(INTEMPX,U,2)'=INSRCH("INDEST") Q
  1. I INSRCH("INSTAT")]"",$P(INTEMPX,U,3)'=INSRCH("INSTAT") Q
  1. I INSRCH("INID")]"",$P(INTEMPX,U,5)'=INSRCH("INID") Q
  1. I INSRCH("INSOURCE")]"",$E($P(INTEMPX,U,8),1,$L(INSRCH("INSOURCE")))'=INSRCH("INSOURCE") Q
  1. I INSRCH("INDIR")]"",$P(INTEMPX,U,10)'=INSRCH("INDIR") Q
  1. I INSRCH("INORIG")]"",$P(INTEMPX,U,11)'=INSRCH("INORIG") Q
  1. I INSRCH("INPAT")]"" Q:'$$INMSPAT^INHMS1(INMIEN,INSRCH("INPAT"))
  1. I $D(INSRCH("INTEXT"))>9 Q:'$$INMSRCH^INHMS1(.INSRCH,INMIEN,INSRCH("INTYPE"))
  1. ; move the found-items array to ^UTILITY if it's getting too large
  1. ; kill the new ^UTILITY space incase it already exists prior to merg
  1. I INFNDCT>INMAXSZ,(INLIST'[U) N INTEMPY S INTEMPY=INLIST,INLIST="^UTILITY(""INL"","_$J_"_"_DUZ_"_"_$P($H,",",2)_")" K @INLIST M @INLIST=@INTEMPY K @INTEMPY,INTEMPY
  1. S @INLIST@(INSRCHCT)=$$INMSGSTR(INMIEN,"",""),@INLIST@(INSRCHCT,0)=INMIEN,INFNDCT=INFNDCT+1
  1. I $G(INSRCH("INEXPAND")) S @INLIST@(INSRCHCT+.1)=$$INMSGSTR(INMIEN,"",$G(INSRCH("INEXPAND")))
  1. Q
  1. ;
  1. INMSGSTR(INMSGIEN,INLABEL,INEXPAND) ; Build a string from msg. elements
  1. ; MODULE NAME: INMSGSTR ( Interface Message Listing String Builder )
  1. ; DESCRIPTION: Construct a string containing selected fields from
  1. ; the message. Used to construct the string which is
  1. ; displayed in the List Processor indicating messages
  1. ; found to match the search criteria. Or consruct a
  1. ; label used to identify the field to be listed.
  1. ; RETURN = The composite message string or
  1. ; a string indicating error status
  1. ; PARAMETERS:
  1. ; INMSGIEN= IEN into ^INTHU
  1. ; INLABEL= Flag to return a string to be used as the title
  1. ; containing the field labels used below.
  1. ; 0/null= no label requested
  1. ; 1= return the only the label
  1. ; INEXPAND= Flag (1/0) to build expanded listing
  1. ; CODE BEGINS
  1. N INTEMP,INTDATE,INMSGID,INDEST,INMSGSTR,INMSGTXT,INDSTNUM,INPATNAM
  1. S INLABEL=$G(INLABEL),INEXPAND=$G(INEXPAND)
  1. ; build and return a title string if the flag is set
  1. I INLABEL,'INEXPAND S $E(INMSGSTR,3,17)="Date/Time",$E(INMSGSTR,23,40)="Message ID",$E(INMSGSTR,55,79)="Destination" Q INMSGSTR
  1. I INLABEL,INEXPAND S $E(INMSGSTR,3,17)="Date/Time",$E(INMSGSTR,23,37)="Message ID",$E(INMSGSTR,55,67)="Destination",$E(INMSGSTR,87,100)="Patient",$E(INMSGSTR,109,140)="Transaction Type" Q INMSGSTR
  1. S INMSGTXT=$G(^INTHU(INMSGIEN,0))
  1. Q:'$L(INMSGTXT) "No Message Information Found"
  1. S INTDATE=$TR($$CDATASC^%ZTFDT($P(INMSGTXT,U),1,2),":")
  1. S INMSGID=$P(INMSGTXT,U,5)
  1. S INDSTNUM=+$P(INMSGTXT,U,2),INDEST="" S:INDSTNUM INDEST=$P($G(^INRHD(INDSTNUM,0)),U)
  1. I 'INEXPAND S $E(INMSGSTR,1,17)=$E(INTDATE,1,19),$E(INMSGSTR,21,52)=$E(INMSGID,1,30),$E(INMSGSTR,53,79)=$E(INDEST,1,25) Q INMSGSTR
  1. I INEXPAND D Q INMSGSTR
  1. .S INTEMP=$$INMSPAT^INHMS1(INMSGIEN,"",.INPATNAM)
  1. .S INORGTT=+$P(INMSGTXT,U,11),INOTT="" S:INORGTT INOTT=$P($G(^INRHT(INORGTT,0)),U)
  1. .S $E(INMSGSTR,5,25)=$E(INPATNAM,1,20),$E(INMSGSTR,27,75)=$E(INOTT,1,45)
  1. Q ""
  1. ;
  1. POST(INNAME) ; Disply/Print messages
  1. ; MODULE NAME: POST ( Post-action logic on List Processor field )
  1. ; DESCRIPTION: Display/print messages using INH MESSAGE DISPLAY
  1. ; template
  1. ; RETURN = none
  1. ; PARAMETERS:
  1. ; INNAME= A NAME of an Array of IEN's into ^INTHU of messages
  1. ; selected for displaying/printing
  1. ; CODE BEGINS
  1. N I,DIC,DR,DHD,DW,DWCP,INIO,DIE,DA
  1. I $O(@INNAME@(0)) D
  1. . D CLEAR^DW
  1. . S %ZIS="N" D ^%ZIS Q:POP S INIO=IO,IOP=ION_";"_IOST_";"_IOM_";"_IOSL
  1. . S I=0 F S I=$O(@INNAME@(I)) Q:'I S DA(@INNAME@(I))=""
  1. . S DR="INH MESSAGE DISPLAY",DIC=4001,DHD="@" D PRTLIST^DWPR
  1. . S:INIO=IO X=$$CR^UTSRD
  1. Q
  1. ;
  1. ERR(INMSG,INFSCRN,INCONT) ; Error/Information handler
  1. ; MODULE NAME: ERR ( Interface Message Error/Information Processor )
  1. ; DESCRIPTION: ERR is a multi-functional message display utility for
  1. ; handling user notification of errors and other messages
  1. ; RETURN = none
  1. ; PARAMETERS:
  1. ; INMSG = a string to be displayed
  1. ; INFSCRN = flag to disable/enable the poping of a window
  1. ; 0=disable(default)
  1. ; 1=enable
  1. ; INCONT = flag to disable/enable continuation prompting
  1. ; 0=disable(default)
  1. ; 1=enable
  1. ; CODE BEGINS
  1. N INTEMP
  1. S INMSG=$G(INMSG)
  1. D:$G(INFSCRN) MESS^DWD(5,10)
  1. ; org W !,INMSG
  1. W INMSG
  1. S:$G(INCONT) INTEMP=$$CR^UTSRD
  1. Q
  1. ;