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

ECRECSPC.m

Go to the documentation of this file.
ECRECSPC ;ALB/DAN - Event Capture Screens w/ selected procedure codes ;1/26/16  16:34
 ;;2.0;EVENT CAPTURE;**112,131**;8 May 96;Build 13
 ;
STRPT ;
 D GETREC
 I ECPTYP="E" D EXPORT Q
 U IO
 D PRINT
 Q
 ;
GETREC ;Find screens with selected procedure codes
 N IEN,ACT,FL,V,EI,ECSCR,LOC,UNT,CAT,PX,NODE
 K ^TMP("ECRECSPC",$J)
 S FL="4,724,726"
 S V="LOC,UNT,CAT",IEN=0
 F  S IEN=$O(^ECJ(IEN)) Q:'IEN  S NODE=$G(^ECJ(IEN,0)) I NODE'="" D
 .S ACT=$P(NODE,U,2),ECSCR=$TR($P(NODE,U),"-;,","^^")
 .I '$D(ECLOC1(+$P(ECSCR,U))) Q  ;Not a location we're looking for
 .F EI=1:1:3 D
 ..S @$P(V,",",EI)=$$GET1^DIQ($P(FL,",",EI),$P(ECSCR,U,EI),.01,"E"),PX=""
 .I $P(ECSCR,U,5)["EC" D
 ..S PRO=$G(^EC(725,$P(ECSCR,U,4),0)),PX=$P(PRO,U,2)_"~"_$P(PRO,U)
 .E  S PRO=$$CPT^ICPTCOD($P(ECSCR,U,4)) S PX=$P(PRO,U,2)_"~"_$P(PRO,U,3)
 .I ECLPC0'="ALL" I '$D(ECPROC($P(PX,"~"))) Q  ;not procedure code we're looking for
 .I $P(ECSCR,U,3),'$P(^ECD($P(ECSCR,U,2),0),U,11) Q  ;131 Don't show info if it has a category and DSS unit is set to no categories
 .S ^TMP("ECRECSPC",$J,PX,UNT,LOC,IEN)=CAT_U_$S(ACT="":"ACTIVE",1:"INACTIVE")_U_+$P(ECSCR,U,2)
 Q
 ;
PRINT ;
 N PAGE,UNT,LOC,IEN,DATA,PX,DONE
 D HDR
 S PX="" F  S PX=$O(^TMP("ECRECSPC",$J,PX)) Q:PX=""  D
 .W !,?3,"PROCEDURE CODE: ",$P(PX,"~"),!,?3,"PROCEDURE NAME: ",$P(PX,"~",2),!
 .S UNT="" F  S UNT=$O(^TMP("ECRECSPC",$J,PX,UNT)) Q:UNT=""  D  W !
 ..S DONE=0
 ..S LOC="" F  S LOC=$O(^TMP("ECRECSPC",$J,PX,UNT,LOC)) Q:LOC=""  S IEN=0 F  S IEN=$O(^TMP("ECRECSPC",$J,PX,UNT,LOC,IEN)) Q:'+IEN  D
 ...S DATA=^TMP("ECRECSPC",$J,PX,UNT,LOC,IEN)
 ...W ! I 'DONE W $P(DATA,U,3),?11,UNT S DONE=1
 ...W ?43,LOC,?75,$P(DATA,U),?112,$P(DATA,U,2)
 ...I $Y>(IOSL-4) D HDR
 Q
 ;
HDR ;
 W @IOF
 S PAGE=$G(PAGE)+1
 W !,?56,"EVENT CAPTURE REPORT",?123,"PAGE: ",PAGE
 W !,?35,"DSS UNITS/EVENT CODE (EC) SCREENS FOR SELECTED PROCEDURE CODE",?104,"RUN DATE: ",$$FMTE^XLFDT($$NOW^XLFDT,"M"),!
 W !,?110,"EC SCREEN",!,"DSS IEN",?11,"DSS UNIT NAME",?43,"LOCATION",?75,"CATEGORY",?112,"STATUS"
 W !,$$REPEAT^XLFSTR("-",132)
 Q
EXPORT ;
 N CNT,UNT,LOC,IEN,PX,DATA
 K ^TMP($J,"ECRPT")
 S CNT=1,^TMP($J,"ECRPT",CNT)="PROCEDURE CODE^PROCEDURE NAME^DSS UNIT IEN^DSS UNIT^LOCATION^CATEGORY^EC SCREEN STATUS"
 S PX="" F  S PX=$O(^TMP("ECRECSPC",$J,PX)) Q:PX=""  D
 .S UNT="" F  S UNT=$O(^TMP("ECRECSPC",$J,PX,UNT)) Q:UNT=""  S LOC="" F  S LOC=$O(^TMP("ECRECSPC",$J,PX,UNT,LOC)) Q:LOC=""  S IEN=0 F  S IEN=$O(^TMP("ECRECSPC",$J,PX,UNT,LOC,IEN)) Q:'+IEN  D
 ..S DATA=$G(^TMP("ECRECSPC",$J,PX,UNT,LOC,IEN))
 ..S CNT=CNT+1,^TMP($J,"ECRPT",CNT)=$P(PX,"~")_U_$P(PX,"~",2)_U_$P(DATA,U,3)_U_UNT_U_LOC_U_$P(DATA,U)_U_$P(DATA,U,2)
 Q