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

IBDFDE2.m

Go to the documentation of this file.
  1. IBDFDE2 ;ALB/AAS - AICS Data Entry, process selection lists ;02/24/96
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;**4,63**;APR 24, 1997;Build 80
  1. ;
  1. ;
  1. % G ^IBDFDE
  1. ;
  1. CHOICE(I) ; -- return ^tmp(ibd-lst,ibdfmien,ibdf(pi),ibdf(ien),i)
  1. Q $G(^TMP("IBD-LST",$J,+$G(IBDFMIEN),+$G(IBDF("PI")),+$G(IBDF("IEN")),+$G(I)))
  1. ;
  1. LIST(RESULT,IBDF,IBDASK) ; -- Procedure
  1. ; -- Manual Data entry routine for Visit Type input
  1. ; Input : Result := call by reference, used to output results
  1. ; IBDF("IEN") := pointer to selection list (357.2)
  1. ; IBDF("PI") := pointer to input package interface
  1. ; IBDF("DFN") := pointer to patient (required for dynamic lists only)
  1. ; IBDF("CLINIC") := pointer to hospital location (required for dynamic lists only)
  1. ;
  1. ; Output: Selections for input in IBDFDE1 (and eventually IBDFRPC4)
  1. ; RESULT(0) := count of selections (including previous)
  1. ; RESULT(n) $p1 := package interface
  1. ; $p2 := Code to send (usually ien)
  1. ; $p3 := Text to send (from form or additional text)
  1. ; $p4 := Header to send (from form) (optional)
  1. ; $p5 := Clinical lexicon pointer (from 357.2) (optional)
  1. ; $p6 := qualifier (optional)
  1. ; $p7 := ien of list (in 357.2)
  1. ; $p10 := external value (optional)
  1. ;
  1. N I,J,X,Y,CHOICE,RULE,ROW,QLFR,TEXT,TEXTU,CODE,NUMBER,OVER,SELECT,ANS,DISPTXT,HDR,NEXT,NEXT1,PICK,DA,DR,DIE,DIC,DIR,DIRUT,DUOUT,DTOUT,IBDEFLT,CNTH,OVER,IBDP,SELAST,IOINHI,IOINORM,ARRAY,VAR
  1. S X="IOINHI;IOINORM" D ENDR^%ZISS
  1. S IBQUIT=0,ANS=""
  1. I IBDF("TYPE")="MC" D MULT^IBDFDE4(.RESULT,.IBDF) G VSTQ
  1. ;
  1. ; -- check required variables
  1. I '$D(IBDFMIEN)!('$D(IBDF("PI")))!('$D(IBDF("IEN"))) W !!,"Required variables not defined for this list:",!,"Form =",$G(IBDFMIEN),!,"Interface = ",$G(IBDF("PI")),!,"List = ",$G(IBDF("IEN")) G VSTQ
  1. ;
  1. S VAR="^TMP(""IBD-LST"",$J,"_+$G(IBDFMIEN)_","_+$G(IBDF("PI"))_","_+$G(IBDF("IEN"))_")"
  1. I $$CHOICE(0)="" D OBJLST^IBDFRPC1(VAR,.IBDF) D COMPLST^IBDFDE5
  1. ;
  1. I '$D(^TMP("IBD-ASK",$J,IBDFMIEN,IBDASK)),$G(IBDF("IBDF")) S ^TMP("IBD-ASK",$J,IBDFMIEN,$$UP^XLFSTR(IBDASK),IBDF("IBDF"))=""
  1. ;
  1. I +$$CHOICE(0)<1,+$G(IBDF("PROVIDER PI"))'=IBDF("PI") G VSTQ ;list is empty, don't ask, unless its provider
  1. ;
  1. ; -- look at zero node, find qualifiers and selection rule
  1. D RULES^IBDFDE22
  1. ;
  1. I $G(IBDREDIT) S ANS=" " D CHK^IBDFDE22 S ANS="" G:'OVER VSTQ N IBDREDIT
  1. ;
  1. ; -- set dir("b")
  1. I $D(IBDPI(IBDF("PI")))>1 D DEFAULT^IBDFDE21
  1. ;
  1. OVER ; -- ask or re-ask for selection(s) from list
  1. S OVER=0
  1. S CNTH=1,I=0 F S I=$O(RULE(I)) Q:'I D
  1. . IF RULE(I)=0 S DIR("?",CNTH)="Any Number of "_$G(IOINHI)_QLFR(I)_$S(QLFR(I)'="":" ",1:"")_IBDASK_$G(IOINORM)_" allowed (including zero)." S CNTH=CNTH+1 Q
  1. . IF RULE(I)=1 S DIR("?",CNTH)="Exactly one "_IOINHI_QLFR(I)_$S(QLFR(I)'="":" ",1:"")_IBDASK_$G(IOINORM)_" Required." S CNTH=CNTH+1 Q
  1. . IF RULE(I)=2 S DIR("?",CNTH)="At most one "_$G(IOINHI)_QLFR(I)_$S(QLFR(I)'="":" ",1:"")_IBDASK_$G(IOINORM)_" allowed." S CNTH=CNTH+1 Q
  1. . IF RULE(I)=3 S DIR("?",CNTH)="At least 1 (1 or more) "_$G(IOINHI)_QLFR(I)_$S(QLFR(I)'="":" ",1:"")_IBDASK_$G(IOINORM)_" Required." S CNTH=CNTH+1 Q
  1. ;
  1. S DIR("?",CNTH)="",CNTH=CNTH+1
  1. S DIR("?")="Select an item from the form, enter by name or number. Enter '??' to see the list of items on the form. When editing, press enter to accept, '@' to delete, or enter a new selection."
  1. I $G(IBDF("OTHER")) S DIR("?")=DIR("?")_" Or enter an item written on the form."
  1. ;
  1. S DIR("??")="^D LST^IBDFDE21"
  1. ;
  1. ; -- default provider is 1st provider
  1. I +$G(IBDF("PROVIDER PI"))=IBDF("PI") D I $G(SELECT) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 K IBNAQLFR G VSTOVER
  1. .S SELECT=0
  1. .I $G(IBDF("PROVIDER")) Q
  1. .I '$G(IBDREDIT),'$D(IBDPI(IBDF("PI"))),+$$CHOICE(0)=1,+$$PRDEF^IBDFRPC3(IBDF("CLINIC")) S ANS=" ",SELECT=1 W !!,IOINHI,"Using Default Provider : "_IBDPTPRI,IOINORM S IBNAQLFR=1 Q
  1. .Q:$P(IBDF("PROVIDER PI"),"^",2) ;not on form don't ask if not default
  1. .Q:$D(IBDPI(IBDF("PI"))) ;one already select
  1. .I $$PRDEF^IBDFRPC3(IBDF("CLINIC")) S DIR("B")=$P($$CHOICE(1),"^")
  1. ;
  1. S DIR(0)="FO^1:40^I $D(X),X="" "" K X W !!,$G(IOINHI),""Spacebar Return Not allowed!"",$G(IOINORM)"
  1. S DIR("A")="Select "_$G(IBDASK)
  1. I $G(^TMP("IBD-PI-CNT",$J,IBDF("PI")))>1 S DIR("A")=DIR("A")_" (Page "_IBDF("PAGE")_")"
  1. D ^DIR K DIR
  1. I $G(IBDEFLT(IBDF("PI")))'="",Y=IBDEFLT(IBDF("PI")) S Y="" ; on re-edit, accepting last entry same as entering nothing.
  1. S ANS=$$UP^XLFSTR(Y)
  1. I ANS="",$D(DIRUT),$G(IBDEFLT(IBDF("PI")))'="",$G(SELAST) K IBDPI(IBDF("PI"),SELAST),IBDSEL(SELAST) W " Deleted!" ;user type "@" at prompt
  1. I ANS="" D CHK^IBDFDE22 G VSTOVER
  1. I ANS["^",ANS'="^" D G VSTOVER
  1. .S GOTO=$$UP^XLFSTR($P(ANS,"^",2))
  1. .I GOTO="?"!(GOTO="??") X "W !!,""Valid Blocks to Jump to: "" S IBDX=0 F S IBDX=$O(^TMP(""IBD-ASK"",$J,IBDFMIEN,IBDX)) Q:IBDX="""" W !,?6,IBDX" S OVER=1 Q
  1. .S X=$O(^TMP("IBD-ASK",$J,IBDFMIEN,GOTO))
  1. .I X'="",X[GOTO W $E(X,$L(GOTO)+1,$L(X)) S IBDF("GOTO")=+$O(^TMP("IBD-ASK",$J,IBDFMIEN,X,""))-1,IBDREDIT=1 Q
  1. .S IBQUIT=1
  1. I $D(DIRUT) S IBQUIT=1 G VSTQ
  1. S SELECT=0
  1. ;
  1. ; -- first check for exact code matches
  1. I $G(NUMBER(ANS)) S SELECT=$G(NUMBER(ANS)) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. ;
  1. S ARRAY="^TMP(""IBD-LCODE"",$J,IBDFMIEN,IBDF(""PI""),IBDF(""IEN""))"
  1. I $G(@ARRAY@(" "_ANS,1)),'$O(@ARRAY@(" "_ANS,1)) S SELECT=@ARRAY@(" "_ANS,1) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. I $G(@ARRAY@(" "_ANS,1)) D I $G(SELECT) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. .; -- more than one code the same number
  1. .S SELECT=$$PARTLST^IBDFDE21(ARRAY," "_ANS," "_ANS)
  1. ;
  1. ; -- next check for partial code answers
  1. S ANS1=" "_ANS
  1. S NEXT=$O(@ARRAY@(ANS1)) D I SELECT D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. .Q:NEXT=""!($E(NEXT,1,$L(ANS1))'=ANS1)
  1. .I $O(@ARRAY@(NEXT,1)) S SELECT=$$PARTLST^IBDFDE21(ARRAY,NEXT,ANS1) Q
  1. .S NEXT1=$O(@ARRAY@(NEXT)) I $E(NEXT1,1,$L(ANS1))=ANS1 S SELECT=$$PARTLST^IBDFDE21(ARRAY,NEXT,ANS1) Q ;Not Unique answer
  1. .W $E(NEXT,($L(ANS1)+1),$L(NEXT))
  1. .S SELECT=$G(@ARRAY@(NEXT,1))
  1. ;
  1. ; -- check for exact text matches
  1. S ARRAY="^TMP(""IBD-LTEXT"",$J,IBDFMIEN,IBDF(""PI""),IBDF(""IEN""))"
  1. I $G(@ARRAY@(ANS,1)),'$O(@ARRAY@(ANS,1)) S SELECT=@ARRAY@(ANS,1) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. I $G(@ARRAY@(ANS,1)) D I $G(SELECT) D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. .; -- more than one description the same
  1. .S SELECT=$$PARTLST^IBDFDE21(ARRAY,ANS,ANS)
  1. ;
  1. ; -- next check for partial text answers
  1. S NEXT=$O(@ARRAY@(ANS)) D I SELECT D SEL^IBDFDE21(SELECT),CHK^IBDFDE22 G VSTOVER
  1. .Q:NEXT=""!($E(NEXT,1,$L(ANS))'=ANS)
  1. .I $O(@ARRAY@(NEXT,1)) S SELECT=$$PARTLST^IBDFDE21(ARRAY,NEXT,ANS) Q
  1. .S NEXT1=$O(@ARRAY@(NEXT)) I $E(NEXT1,1,$L(ANS))=ANS S SELECT=$$PARTLST^IBDFDE21(ARRAY,NEXT,ANS) Q ;Not Unique answer
  1. .W $E(NEXT,($L(ANS)+1),$L(NEXT))
  1. .S SELECT=$G(@ARRAY@(NEXT,1))
  1. ;
  1. I ANS'="" S SEL=$$OTHER^IBDFDE21(ANS) I SEL'="" D SEL^IBDFDE21(SEL),CHK^IBDFDE22 G VSTOVER
  1. I ANS'="" W " ?? ",$C(7),"Not Found" G OVER
  1. ;
  1. VSTOVER K SELAST G:OVER OVER
  1. I $G(ASKOTHER) F S SEL=$$OTHER^IBDFDE21("") Q:SEL="" D SEL^IBDFDE21(SEL),CHK^IBDFDE22 Q:'$G(ASKOTHER)
  1. ;
  1. VSTQ ; -- kill array for dynamic lists
  1. I $P($G(^IBE(357.6,IBDF("PI"),0)),"^",14) S:IBDF("PI")'=$G(IBDF("PROVIDER PI")) IBDF("DYNAMIC")=1 K ^TMP("IBD-LST",$J,IBDFMIEN,IBDF("PI")),^TMP("IBD-LTEXT",$J,IBDFMIEN,IBDF("PI")),^TMP("IBD-LCODE",$J,IBDFMIEN,IBDF("PI"))
  1. K ^TMP("IB",$J,"INTERFACES")
  1. K IBDF("OTHER"),ASKOTHER
  1. Q