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

IBDF18A1.m

Go to the documentation of this file.
  1. IBDF18A1 ;ALB/CJM/AAS - ENCOUNTER FORM - utilities for PCE ;12-AUG-94
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;**34,38**;APR 24, 1997
  1. ;
  1. COPYLIST(LIST,ARY,COUNT) ;
  1. ; -- copies the entries from LIST to @ARY, starting subscript at COUNT+1
  1. ;
  1. N SLCTN,NODE,NODE1,NODE2,TSUBCOL,GROUP,ORDER,HDR,PRNT
  1. ;
  1. D SUBCOL(LIST,.TSUBCOL) ;find the subcolumn containing the text
  1. ;
  1. S PRNT=""
  1. F S PRNT=$O(^IBE(357.4,"APO",LIST,PRNT)) Q:PRNT="" D
  1. . S GROUP=""
  1. . F S GROUP=$O(^IBE(357.4,"APO",LIST,PRNT,GROUP)) Q:GROUP="" D
  1. .. S HDR=$P($G(^IBE(357.4,GROUP,0)),"^")
  1. .. I HDR="BLANK" S HDR=""
  1. .. S COUNT=COUNT+1,@ARY@(COUNT)="^"_HDR
  1. .. S ORDER=""
  1. .. F S ORDER=$O(^IBE(357.3,"APO",LIST,GROUP,ORDER)) Q:ORDER="" D
  1. ... S SLCTN=0
  1. ... F S SLCTN=$O(^IBE(357.3,"APO",LIST,GROUP,ORDER,SLCTN)) Q:'SLCTN D
  1. .... S NODE=$G(^IBE(357.3,SLCTN,0))
  1. .... S NODE2=$G(^IBE(357.3,SLCTN,2))
  1. .... S NODE1=$G(^IBE(357.3,SLCTN,1,+$O(^IBE(357.3,SLCTN,1,"B",+TSUBCOL,0)),0))
  1. .... ; -- return placeholders as headers when use as subheader
  1. .... ; is yes and quit
  1. .... I $P(NODE,"^",2),$P(NODE,"^",7)=1 D Q
  1. ..... S COUNT=COUNT+1,@ARY@(COUNT)="^"_$P(NODE,"^",6)
  1. .... ;
  1. .... I $P(NODE1,"^")=TSUBCOL,$L($P(NODE1,"^",2)) S COUNT=COUNT+1,@ARY@(COUNT)=$P(NODE,"^")_"^"_$P(NODE1,"^",2)_"^^^^"_$P(NODE2,"^")_"^"_$P(NODE2,"^",3)_"^"_$P(NODE2,"^",4)_"^"_$P(NODE2,"^",2)
  1. .... D MODLIST
  1. Q
  1. ;
  1. SUBCOL(LIST,TSUBCOL) ; -- finds the subcolumn containing the text
  1. ; -- TSUBCOL passed by reference - used to return the subcolumn
  1. ; LIST is the selection list to search
  1. ;
  1. ; -- refering to the data returned by the package interface,
  1. ; piece 2 is usually the description
  1. ;
  1. N PI,SC
  1. S TSUBCOL="",SC=0
  1. S PI=$P($G(^IBE(357.6,+$P($G(^IBE(357.2,+LIST,0)),"^",11),0)),"^")
  1. ;
  1. F S SC=$O(^IBE(357.2,LIST,2,SC)) Q:'SC D
  1. .Q:$P($G(^IBE(357.2,LIST,2,SC,0)),"^",4)=2 ;is a marking area
  1. .I $P($G(^IBE(357.2,LIST,2,SC,0)),"^",5)=2 S TSUBCOL=$P(^(0),"^") Q
  1. .I TSUBCOL="",$P($G(^IBE(357.2,LIST,2,SC,0)),"^",5)>2 S TSUBCOL=$P(^(0),"^") Q ; -- see if other than data piece two is text subcolumn
  1. .;
  1. .; -- utility for selecting blanks is exception
  1. .I TSUBCOL="",PI="IBDF UTILITY FOR SELECTING BLANKS",$P($G(^IBE(357.2,LIST,2,SC,0)),"^",5)=1 S TSUBCOL=$P(^(0),"^") Q
  1. Q
  1. ;
  1. F2(ARY) ; -- filter cpt code array to find only codes beginning with 992 and asssicated headers
  1. ; -- Copy filtered array to from ibdtmp( to @ary@(
  1. ;
  1. N NODE,IBQUIT,COUNT
  1. S (COUNT,IBQUIT)=0
  1. ;
  1. ;I INTRFACE'="DG SELECT CPT PROCEDURE CODES" S @ARY=IBDTMP K IBDTMP
  1. ;
  1. S NODE="" F S NODE=$O(IBDTMP(NODE),-1) Q:NODE="" I $E(IBDTMP(NODE),1,3)=992 D ;Q:IBQUIT ;comment out the q:ibquit if want from more than 1 list
  1. .;
  1. .S @ARY@(NODE)=IBDTMP(NODE),COUNT=COUNT+1 ;this is bottom of list
  1. .;
  1. .; -- process from bottom of list to header
  1. .F S NODE=$O(IBDTMP(NODE),-1) Q:NODE="" D Q:IBQUIT
  1. ..S IBQUIT=0
  1. ..I $E(IBDTMP(NODE),1,3)=992 S @ARY@(NODE)=IBDTMP(NODE),COUNT=COUNT+1
  1. ..I $P(IBDTMP(NODE),"^",1)="" S @ARY@(NODE)=IBDTMP(NODE),IBQUIT=1,COUNT=COUNT+1
  1. I COUNT S @ARY@(0)=COUNT
  1. Q
  1. ;
  1. URH ; -- UnReferenced Headers (removal)
  1. ; if a header doesn't have any data under it, then remove the header
  1. N X,HDR
  1. S X=0 F S X=$O(@ARY@(X)) Q:'X D
  1. .I '$D(HDR),$P(@ARY@(X),"^",1)="" S HDR=X Q ;find a header
  1. .I $P(@ARY@(X),"^",1)="" K HDR Q ; is item under header
  1. .; -- patch 34 check if piece one below = null instead of positive
  1. .I $D(HDR),$P(@ARY@(X),"^",1)="" K @ARY@(HDR) S COUNT=COUNT-1,HDR=X ;hdr doesn't have any items, kill hdr node and reset header to next header
  1. .;I $D(HDR),$P(@ARY@(X),"^",1) K @ARY@(HDR) S COUNT=COUNT-1,HDR=X ;hdr doesn't have any items, kill hdr node and reset header to next header
  1. I $D(HDR) S X=$O(@ARY@(""),-1) I $P(@ARY@(X),"^",1)="" K @ARY@(X) S COUNT=COUNT-1,HDR=X ;last item in list is a header
  1. Q
  1. MODLIST ; return all CPT Modifiers if defined
  1. ;
  1. Q:$G(MODIFIER)'=1
  1. N MCOUNT,MOD
  1. Q:'$D(^IBE(357.3,SLCTN,3))
  1. S MCOUNT=0
  1. F MOD=0:0 S MOD=$O(^IBE(357.3,SLCTN,3,MOD)) Q:'MOD D
  1. . S MCOUNT=MCOUNT+1
  1. . S @ARY@(COUNT,"MODIFIER",MCOUNT)=$G(^IBE(357.3,SLCTN,3,MOD,0))
  1. S:MCOUNT>0 @ARY@(COUNT,"MODIFIER",0)=MCOUNT
  1. Q