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

SCRPW20.m

Go to the documentation of this file.
  1. SCRPW20 ;RENO/KEITH - ACRP Ad Hoc Report ;15 Nov 98 4:31 PM
  1. ;;5.3;Scheduling;**144,171,593**;AUG 13, 1993;Build 13
  1. I $E(IOST)'="C" D Q
  1. .N SDX S SDX="Your current terminal type is "_IOST_"." W !?(IOM-$L(SDX)\2),SDX
  1. .S SDX="This option requires a CRT terminal type!" W !!?(IOM-$L(SDX)\2),SDX,! Q
  1. K ^TMP("SCRPW",$J),SDPAR D BLD^SCRPW21 N DIR,X,Y,SDOUT,T S (SDREV,SDOUT)=0,T="~"
  1. F SDTAG="INTRO","FMT","PERS","LIM","ORD","XPF","REVIEW" D @SDTAG Q:SDOUT!SDREV
  1. G:SDOUT EXIT^SCRPW27 D SAVT^SCRPW21(.SDPAR)
  1. QUE N ZTSAVE S ZTSAVE("SDPAR(")="" D MAR^SCRPW29,EN^XUTMDEVQ("RPT^SCRPW26","ACRP Ad Hoc Report",.ZTSAVE) G EXIT^SCRPW27
  1. ;
  1. INTRO K SDBOT S (SDTOP,SDBOT(1))="A C R P A d H o c R e p o r t" D DISP^SCRPW23(SDTOP,.SDBOT),INTRO^SCRPW26
  1. I $$REST^SCRPW22() H 1 S SDREV=1 G REVIEW
  1. Q:SDOUT I '$O(^SDD(409.91,0)) W !! K DIR S DIR(0)="E" S X=$$DIR^SCRPW23(.DIR,0)
  1. Q
  1. FMT ;Get format parameters
  1. S SDS1="F",(SDOUT,SDNUL)=0,SDBOT(1)="Report format selection",SDBOT(2)="Report format parameters determine the appearance of the report."
  1. D DISP^SCRPW23("R E P O R T F O R M A T",.SDBOT)
  1. F SDTAG="F1","F2","F3","F4","F5","F6" D @SDTAG Q:SDOUT
  1. G:$$VF^SCRPW29() FMT I SDREV G:$$VP^SCRPW29() PERS
  1. Q
  1. PERS ;Prompt for perspective
  1. K SDBOT S SDS1="P",(SDOUT,SDNUL)=0,SDBOT(1)="Report perspective selection",SDBOT(2)="The element selected for this parameter will determine how the statistics will",SDBOT(3)="be organized and sub-totaled."
  1. D DISP^SCRPW23("R E P O R T P E R S P E C T I V E",.SDBOT)
  1. D P1 G:$$VP^SCRPW29() PERS Q
  1. LIM ;Prompt for limitations
  1. K SDBOT S SDS1="L",(SDOUT,SDNUL)=0
  1. S SDBOT(1)="Report limitation selection",SDBOT(2)="Limiting factors determine which encounter records to count. Multiple limiting",SDBOT(3)="factors can be chosen and specified to only include (or exclude) specific data."
  1. D DISP^SCRPW23("R E P O R T L I M I T A T I O N S",.SDBOT)
  1. F SDTAG="L1","L2" D @SDTAG Q:SDOUT
  1. G:$$VL^SCRPW29() LIM Q
  1. ORD ;Prompt for print order
  1. K SDBOT S SDS1="O",(SDOUT,SDNUL)=0,SDBOT(1)="Report print order selection",SDBOT(2)="This parameter determines the order in which the report will be printed."
  1. D DISP^SCRPW23("R E P O R T P R I N T O R D E R",.SDBOT)
  1. K DIR D DIRB1^SCRPW23("O",1,"ALPHABETIC") S DIR("A")="Select report print order",DIR(0)="S^A:ALPHABETIC;E:ENCOUNTER TOTAL;V:VISIT TOTAL;U:UNIQUE TOTAL",DIR("?")="Specify the order to print elements of selected perspective."
  1. S SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("O",1)=SDX Q:SDOUT
  1. D DESC^SCRPW22 Q:SDOUT G:$$VO^SCRPW29() ORD Q
  1. ;
  1. XY(X) ;Maintain $X, $Y
  1. ;Required input: X=screen handling variable to write
  1. N DX,DY S DX=$X,DY=$Y W X X SDXY Q ""
  1. ;
  1. XPF ;Extra print fields
  1. D PF^SCRPW29 Q
  1. ;
  1. REVIEW ;Review selected parameters
  1. D REVSCR,REV0 Q
  1. ;
  1. REVSCR K SDBOT S SDTOP="S e l e c t e d R e p o r t P a r a m e t e r s",SDBOT(1)="Parameters selected for ACRP Ad Hoc Report",SDBOT(2)="These parameters will determine the appearance and data contained in the output."
  1. D DISP^SCRPW23(SDTOP,.SDBOT) Q
  1. ;
  1. VERS ;Verify segments
  1. W ! F SDX="VF","VP","VL","VO" S SDX="$$"_SDX_"^SCRPW29(1)" I @(SDX)
  1. Q
  1. ;
  1. REV0 N SDERR S SDREV=1,SDOUT=0 D PLIST^SCRPW22(0,15) S SDOUT=0
  1. REV1 D VERS W:SDOUT ! S SDOUT=0 W !?32,$$XY(IORVON)," Report action ",$$XY(IORVOFF)
  1. K DIR S DIR("A")="Select report action",DIR(0)="S^C:CONTINUE;E:EDIT PARAMETERS;R:RE-DISPLAY PARAMETERS;P:PRINT PARAMETERS;Q:QUIT",DIR("B")="CONTINUE",SDACT=$P($$DIR^SCRPW23(.DIR,0),U)
  1. I $D(DTOUT)!$D(DUOUT)!(SDACT="Q") S SDOUT=1 Q
  1. I SDACT="P" N ZTSAVE S ZTSAVE("SDPAR(")="" W ! D EN^XUTMDEVQ("PPAR^SCRPW27","ACRP Ad Hoc Report Parameters",.ZTSAVE) G REV1
  1. G:SDACT="R" REVIEW
  1. I SDACT="C" D Q:'SDOUT S SDOUT=0 S SDERR="" G REV1
  1. . S SDOUT=0 D VERS
  1. . I SDOUT W !!,"Required information missing. Unable to continue with queuing!" H 3 Q
  1. . S SDOUT=$$VERICD^SCRPW29(.SDERR)
  1. . I SDOUT W:$G(SDERR)]"" !!,SDERR W !!,"Unable to continue with queuing!" H 3 Q
  1. F S (SDOUT,SDNUL)=0 W !!?31,$$XY(IORVON)," Re-edit actions ",$$XY(IORVOFF) D RDIR S SDACT=$P($$DIR^SCRPW23(.DIR,0),U) Q:SDOUT!SDNUL D REV2,REVSCR Q:SDOUT!SDNUL
  1. S (SDOUT,SDNUL)=0 G REV1
  1. ;
  1. RDIR K DIR S DIR("A")="Select section to re-edit",DIR(0)="SO^F:FORMAT;P:PERSPECTIVE;L:LIMITATIONS;O:ORDER;"_$$PFC^SCRPW29()_"A:ALL SECTIONS;E:EXIT FROM RE-EDIT" Q
  1. ;
  1. REV2 I SDACT="E" S SDNUL=1 Q
  1. D @($S(SDACT="F":"FMT",SDACT="P":"PERS",SDACT="L":"LIM",SDACT="O":"ORD",SDACT="X":"XPF",1:"REV3")) Q
  1. ;
  1. REV3 F SDACT="FMT","PERS","LIM","ORD","XPF" D @SDACT Q:SDOUT
  1. Q
  1. ;
  1. F1 K DIR D DIRB1^SCRPW23("F",1,"SUMMARY") S DIR("A")="Select report format",DIR(0)="S^D:DETAILED;S:SUMMARY",DIR("?",1)="DETAILED format allows the listing of encounters, visits or uniques and ranked"
  1. S DIR("?",2)="lists of diagnoses and procedures for selected items in the selected",DIR("?",3)="perspective. SUMMARY format provides subtotals of encounters, visits and"
  1. S DIR("?",4)="uniques for all items in a selected perspective and allows subtotals to be",DIR("?")="compared to the same date range in the previous year.",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",1)=SDX D PFR^SCRPW29 Q
  1. ;
  1. F2 I $P(SDPAR("F",1),U)="S" W ! K DIR D DIRB1^SCRPW23("F",2,"NO") S DIR("A")="Compare data to same date range for the previous year",DIR(0)="Y",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",2)=SDX
  1. Q
  1. ;
  1. F3 Q:$P(SDPAR("F",1),U)="S" K DIR D DIRB1^SCRPW23("F",3)
  1. S DIR("A")="Select type of detail",DIR(0)="S^E:ENCOUNTER/VISIT/UNIQUE LIST;D:DIAGNOSIS/PROCEDURE RANKING;B:BOTH ACTIVITY & DX/PROC. LISTS",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",3)=SDX D PFR^SCRPW29 Q
  1. ;
  1. F4 Q:$P(SDPAR("F",1),U)="S" Q:"BE"'[$P(SDPAR("F",3),U)
  1. K DIR D DIRB1^SCRPW23("F",4) S DIR("A")="List activity by",DIR(0)="S^E:ENCOUNTER;V:VISIT;U:UNIQUE",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",4)=SDX D PFR^SCRPW29 Q
  1. ;
  1. F5 Q:$P(SDPAR("F",1),U)="S" Q:"BD"'[$P(SDPAR("F",3),U) K DIR
  1. W ! D DIRB1^SCRPW23("F",5,50) S DIR("A")="Limit Dx/procedure list to most frequent",DIR(0)="N^1:999:0",DIR("?")="Specify how many of the most frequent items to list.",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",5)=SDX Q
  1. ;
  1. F6 K DIR W ! D DIRB1^SCRPW23("F",6,"FORMATTED TEXT") S DIR("A")="Produce output as",DIR(0)="S^F:FORMATTED TEXT;D:DELIMITED VALUES FOR EXPORT TO SPREADSHEET",SDX=$$DIR^SCRPW23(.DIR,0) S:$L(SDX) SDPAR("F",6)=SDX Q
  1. ;
  1. P1 K DIR,SDPAR("X") D DIRB1^SCRPW23("P",1) S DIR("A")="Select report perspective",DIR("?")="Specify the element to be used for report subtotals." S SDNUL=0,SDS1="P",SDS2=1 D CAT^SCRPW22($S(SDREV:"E",1:"A")) Q:SDOUT
  1. Q
  1. ;
  1. L1 N %DT,SDS1,I10DTI,I10DTE D SUBT^SCRPW50("*** Date Range Selection ***")
  1. S Y=$$IMP^SCRPWICD(30) S I10DTI=Y X ^DD("DD") S I10DTE=Y
  1. FDT W ! S %DT="AEPX",%DT("A")="Beginning date: ",%DT(0)="-TODAY" D DIRB1^SCRPW23("L",1) S:$D(DIR("B")) %DT("B")=DIR("B") D ^%DT I X=U!($D(DTOUT)) S SDOUT=1 Q
  1. G:Y<1 FDT K:Y>$G(SDPAR("L",2)) SDPAR("L",2) S SDS1=Y X ^DD("DD") S SDPAR("L",1)=SDS1_U_Y
  1. LDT W ! S %DT("A")=" Ending date: " D DIRB1^SCRPW23("L",2) S:$D(DIR("B")) %DT("B")=DIR("B") D ^%DT I X=U!($D(DTOUT)) S SDOUT=1 Q
  1. I Y<$P(SDPAR("L",1),U) W !!,$C(7),"Ending date must be after beginning date!" G LDT
  1. S SDS1=Y X ^DD("DD") S SDPAR("L",2)=SDS1_U_Y
  1. I ($P(SDPAR("L",1),U,1)<I10DTI),($P(SDPAR("L",2),U,1)'<I10DTI) D G FDT
  1. . W !!,$C(7),"Beginning and Ending dates must both be prior to "_I10DTE_" (ICD-9) or both be on or after "_I10DTE_" (ICD-10)."
  1. Q
  1. ;
  1. L2 I SDREV D AED^SCRPW22("L") Q
  1. L2A S SDS1="L",SDS2=$O(SDPAR(SDS1,""),-1),SDNUL=0 F Q:SDOUT!SDNUL S SDS2=SDS2+1 D:'$D(SDPAR(SDS1,SDS2)) L3
  1. Q
  1. L3 S SDX="Select "_$S(SDS2=3:"additional",1:"another")_" output limiting factor: (optional)" W !!?(80-$L(SDX)\2),$$XY(IORVON),SDX,$$XY(IORVOFF) D LDIR,CAT^SCRPW22("A") Q
  1. ;
  1. LDIR K DIR S DIR("A")="Select limiting factor",DIR("?")="Specify elements to be used to restrict the scope of data returned." Q