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

HLUCM004.m

Go to the documentation of this file.
  1. HLUCM004 ;CIOFO-O/LJA - HL7/Capacity Mgt API ;3/13/03 09:37
  1. ;;1.6;HEALTH LEVEL SEVEN;*88,103**;Oct 13, 1995
  1. ;
  1. LOOPU ; Loop thru ^TMP($J,"HLUCMSTORE","U") data. Full-screen view...
  1. N CT,DATA,EXCL,IEN772,IENPAR,INCL,IOINHI,IOINORM,RNOMSG,STOP,TYPE,X
  1. S X="IOINHI;IOINORM" D ENDR^%ZISS
  1. ;
  1. LOOPU1 KILL DATA,EXCL,INCL,IEN772,IENPAR,INCL,RNOMSG,STOP,TYPE
  1. W @IOF,$$CJ^XLFSTR("Display of ^TMP($J,""HLUCMSTORE"",""U"") Data",IOM)
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. ;
  1. W !!,$$CJ^XLFSTR("Type Totals",IOM)
  1. W !,$$CJ^XLFSTR("--------------------------------",IOM)
  1. S TYPE=""
  1. F S TYPE=$O(^TMP($J,"HLUCMSTORE","T",TYPE)) Q:TYPE']"" D
  1. . S DATA=$G(^TMP($J,"HLUCMSTORE","T",TYPE))
  1. . W !,$$CJ^XLFSTR(TYPE_" "_DATA,IOM)
  1. ;
  1. W !!,"Enter text in messages to include and exclude..."
  1. W !
  1. D EXCL(.EXCL)
  1. W !
  1. D INCL(.INCL)
  1. ;
  1. R !!,"Restrict # messages: 999// ",RNOMSG:999
  1. S:RNOMSG']"" RNOMSG=999
  1. QUIT:RNOMSG'?1.N ;->
  1. ;
  1. S (CT,CT(1))=0,IENPAR=0,STOP=0
  1. F S IENPAR=$O(^TMP($J,"HLUCMSTORE","U",IENPAR)) Q:'IENPAR!(STOP) D
  1. . S CT(1)=CT(1)+1
  1. . QUIT:'$$OK(+IENPAR,RNOMSG,.EXCL,.INCL) ;->
  1. . S CT=CT+1
  1. . D SHOWU(+IENPAR,"FULL")
  1. . R X:999 I X[U S STOP=1
  1. ;
  1. I CT(1)'>0 W !!,"No data exists..." H 2
  1. ;
  1. I CT(1)>0 D
  1. . W !!,$S('CT:"No matching entries found...",1:"#"_CT_" matching entries displayed...")
  1. . S CT=CT(1)-CT W !,"#"_CT_" entries skipped..."
  1. ;
  1. Q
  1. ;
  1. OK(IENPAR,RNOMSG,EXCL,INCL) ; Exclude and INcludes..
  1. N DATA,FAIL,HOLDEXCL,IEN772,NUM
  1. ;
  1. ; Count messages...
  1. S NUM=0,IEN772=0
  1. F S IEN772=$O(^TMP($J,"HLUCMSTORE","U",+IENPAR,IEN772)) Q:'IEN772 D
  1. . S NUM=NUM+1
  1. ;
  1. ; Quit if number messages in unit isn't right...
  1. I RNOMSG=999 QUIT:NUM>RNOMSG "" ;-> Should never happen!
  1. I RNOMSG'=999 QUIT:NUM'=RNOMSG "" ;->
  1. ;
  1. ; Parent node check...
  1. S DATA=$G(^TMP($J,"HLUCMSTORE","U",+IENPAR))
  1. ;
  1. ; Exclusions...
  1. QUIT:$$HOLDEXCL(DATA,.EXCL) "" ;->
  1. ;
  1. ; Child nodes check...
  1. I $O(EXCL(""))]"" D
  1. . S IEN772=0,HOLDEXCL=0
  1. . F S IEN772=$O(^TMP($J,"HLUCMSTORE","U",+IENPAR,IEN772)) Q:'IEN772!(HOLDEXCL) D
  1. . . S DATA=$$DATA(+IEN772)
  1. . . S HOLDEXCL=$$HOLDEXCL(DATA,.EXCL)
  1. ;
  1. QUIT:$G(HOLDEXCL) "" ;->
  1. ;
  1. ; Quit, if no INCLUDES...
  1. QUIT:$O(INCL(""))']"" 1 ;->
  1. ;
  1. ; Inclusion check for parent node...
  1. QUIT:$$HOLDINCL(DATA,.INCL) 1 ;->
  1. ;
  1. ; Child node inclusion checks...
  1. S IEN772=0,HOLDINCL=0
  1. F S IEN772=$O(^TMP($J,"HLUCMSTORE","U",+IENPAR,IEN772)) Q:'IEN772!(HOLDINCL) D
  1. . S DATA=$$DATA(+IEN772)
  1. . S HOLDINCL=$$HOLDINCL(DATA,.INCL)
  1. ;
  1. Q HOLDINCL
  1. ;
  1. EXCL(EXCL) ; What entries to exclude? (Searches PARENT node)
  1. W !!,"Every parent node that includes one of the EXCLUDE values that you enter now"
  1. W !,"will not be included in the entries displayed."
  1. W !
  1. D ASK("EXCLUDE",.EXCL)
  1. Q
  1. ;
  1. HOLDEXCL(DATA,EXCL) ; Includes text that should be excluded?
  1. N HOLD
  1. S EXCL="",HOLD=0
  1. F S EXCL=$O(EXCL(EXCL)) Q:EXCL']""!(HOLD) D
  1. . I DATA[EXCL S HOLD=1
  1. Q HOLD
  1. ;
  1. INCL(INCL) ; What entries to include? (Searches PARENT node)
  1. W !!,"Every parent node that doesn't include one of the INCLUDE values that you"
  1. W !,"enter now will not be included in the entries displayed."
  1. W !
  1. D ASK("INCLUDE",.INCL)
  1. Q
  1. ;
  1. HOLDINCL(DATA,INCL) ; Does DATA hold one of the INCLUDEs?
  1. N HOLD
  1. S INCL="",HOLD=0
  1. F S INCL=$O(INCL(INCL)) Q:INCL']""!(HOLD) D
  1. . I DATA[INCL S HOLD=1
  1. Q HOLD
  1. ;
  1. ASK(TYPE,ENTRY) ; Repeatedly ask...
  1. N ANS
  1. F D QUIT:ANS']""
  1. . W !,TYPE,": "
  1. . R ANS:999 S:ANS=U ANS="" Q:ANS']"" ;->
  1. . S ENTRY(ANS)=""
  1. Q
  1. ;
  1. SHOWU(IENPAR,VIEW) ; Show one entry in VIEW format...
  1. N HL,X
  1. MERGE HL=^TMP($J,"HLUCMSTORE","U",+IENPAR)
  1. S X="D "_VIEW_"(.HL)" X X
  1. Q
  1. ;
  1. FULL(HL) ; Display one entry in FULL format...
  1. ; IOINHI,IOINORM -- req
  1. N COUNT,DATA,DATA4,DATAN,DATAP,DATAR,IEN772,L,LEN
  1. N PNO,PROTP,PROTC,RES,STOP
  1. ;
  1. ; Header...
  1. W @IOF
  1. S DATA=HL
  1. F D Q:DATA']""
  1. . W !,$$CJ^XLFSTR($E(DATA,1,70),IOM)
  1. . S DATA=$E(DATA,71,999)
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. ;
  1. S PROTP=$P(HL,U,7)
  1. ;
  1. ; Body...
  1. S COUNT=0,IEN772=0,STOP=0
  1. F S IEN772=$O(HL(IEN772)) Q:'IEN772!(STOP) D
  1. . S COUNT=COUNT+1
  1. . S DATA=$$DATA(+IEN772)
  1. . S L=$L(DATA),X=$E(DATA,L-2,L) I X?3U,X'="CCC" S DATA=$E(DATA,1,L-3)_IOINHI_X_IOINORM
  1. . S PROTC=$P(DATA,U,7)
  1. . S $P(DATA,U,7)=$S(PROTP=PROTC:"...",1:"~hi~"_PROTC_"~hi~")
  1. . W !,IEN772,?12,"-",?14
  1. . F PNO=1:1:$L(DATA,U) D
  1. . . S DATAP=$P(DATA,U,+PNO)
  1. . . S DATAN=$P(DATA,U,+PNO+1)
  1. . . I DATAP["~hi~" D
  1. . . . S DATAP=$P(DATAP,"~hi~",2),LEN=$L(DATAP)+1
  1. . . . S DATAP=IOINHI_DATAP_IOINORM
  1. . . E S LEN=$L(DATAP)+1
  1. . . S DATAP=DATAP_$S(DATAN]"":U,1:"")
  1. . . W:(IOM-$X-LEN)'>0 !,?14
  1. . . W DATAP
  1. . I '(COUNT#4) W " ",IOINHI,"<",IOINORM R X:120 I X[U S STOP=1
  1. . W !,$$REPEAT^XLFSTR($S($O(HL(IEN772)):"-",1:"="),IOM)
  1. ;
  1. ; Trailer...
  1. S RES="C"
  1. F S RES=$O(HL(RES)) Q:RES'?3U D
  1. . S DATAR=HL(RES)
  1. . W $$CJ^XLFSTR(RES_" - "_DATAR,IOM)
  1. ;
  1. Q
  1. ;
  1. DATA(IEN772) ; Return what is displayed...
  1. N DATA,IENPAR,RES
  1. S IENPAR=+$G(^TMP($J,"HLUCMSTORE","X",+IEN772)) QUIT:'IENPAR "" ;->
  1. S RES=$O(^TMP($J,"HLUCMSTORE","U",+IENPAR,+IEN772,"")) ; CCC, CXC, etc
  1. S DATA=$G(^TMP($J,"HLUCMSTORE","U",+IENPAR,+IEN772,RES))_" <<>> "_$G(^TMP($J,"HLUCMSTORE","U",+IENPAR,+IEN772,RES,772))_" <<>> "_RES
  1. I $TR(DATA," <>","")']"" S DATA=""
  1. Q DATA
  1. ;
  1. XTMPGBL(SHOW) ; Display XTMP data totals?
  1. N ANS,API,BEG,COND,DATA,END,HOLD,NO,RUN,SVNO,TIME,XTMP
  1. ;
  1. S XTMP="HLUCM ",SHOW=+$G(SHOW),HOLD=0
  1. QUIT:$O(^XTMP(XTMP))'?1"HLUCM "7N ;->
  1. W !!,$$CJ^XLFSTR(" XTMP-stored Reports ",IOM),!,$$REPEAT^XLFSTR("=",IOM)
  1. W !,"#",?4,"Run-time",?20,"API Call"
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. F S XTMP=$O(^XTMP(XTMP)) Q:XTMP'?1"HLUCM "7N D
  1. . S BEG=0
  1. . F S BEG=$O(^XTMP(XTMP,"P",BEG)) Q:'BEG D
  1. . . S END=0
  1. . . F S END=$O(^XTMP(XTMP,"P",BEG,END)) Q:'END D
  1. . . . S COND=""
  1. . . . F S COND=$O(^XTMP(XTMP,"P",BEG,END,COND)) Q:COND']"" D
  1. . . . . S DATA=$G(^XTMP(XTMP,"P",BEG,END,COND)) QUIT:DATA']"" ;->
  1. . . . . S SVNO=+DATA,TIME=$P(DATA,U,2) QUIT:TIME']"" ;->
  1. . . . . S DATA=$G(^XTMP(XTMP,"N",+SVNO)),API=$P(DATA,U,4)
  1. . . . . S HOLD=HOLD+1
  1. . . . . S HOLD(TIME,HOLD)=XTMP_U_SVNO_"~"_$E(TIME_" ",1,16)_$E("$$"_API_"("_BEG_","_END_",1,1,"""_COND_""",TOTALS,.ERR)",1,60)
  1. . . . . S RUN(+SVNO)=XTMP
  1. S TIME=0,HOLD=0
  1. F S TIME=$O(HOLD(TIME)) Q:'TIME D
  1. . S NO=0
  1. . F S NO=$O(HOLD(TIME,NO)) Q:NO'>0 D
  1. . . S DATA=HOLD(TIME,NO),XTMP=$P(DATA,U)
  1. . . S SVNO=$P($P(DATA,"~"),U,2),DATA=$P(DATA,"~",2,999)
  1. . . S HOLD=HOLD+1
  1. . . S HOLD("N",HOLD)=XTMP_U_SVNO
  1. . . W !,$E("#"_HOLD_" ",1,4),DATA
  1. ;
  1. QUIT:HOLD'>0 "" ;->
  1. ;
  1. W !!,"You may choose to print the totals report from stored XTMP data if you like."
  1. W !,"If so, enter the number of the XTMP report from above now. (Otherwise,"
  1. W !,"press RETURN.)"
  1. ;
  1. R !!,"Enter XTMP Report#: ",NO:999 Q:'$D(HOLD("N",+NO)) "" ;->
  1. S XTMP=$P(HOLD("N",+NO),U),SVNO=$P(HOLD("N",+NO),U,2)
  1. ;
  1. Q $NA(^XTMP(XTMP,"D",SVNO))
  1. ;
  1. EOR ; HLUCM004 - HL7/Capacity Mgt API ;3/13/03 09:37