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

GMTSXAP.m

Go to the documentation of this file.
  1. GMTSXAP ; SLC/KER - List Parameters/Precedence ; 02/27/2002
  1. ;;2.7;Health Summary;**47,49**;Oct 20, 1995
  1. Q
  1. ;
  1. ; External References in GMTSXAP
  1. ; DBIA 2343 $$ACTIVE^XUSER
  1. ; DBIA 10026 ^DIR
  1. ;
  1. EN ; Main Entry Point for Health Summary
  1. N GMTSUSR S GMTSUSR=+($G(DUZ)) D PREF Q
  1. EN2(X) ; Entry Point for User
  1. N GMTSUSR S GMTSUSR=+($G(X)) D PREF Q
  1. ;
  1. PREF ; Get Preference - Precedence
  1. N GMTSACT Q:'$L($$UNM^GMTSXAW3(+($G(GMTSUSR))))
  1. S GMTSACT=$$ACTIVE^XUSER(+GMTSUSR) D:+GMTSACT'>0 DP^GMTSXAP2(GMTSUSR)
  1. Q:+GMTSACT'>0 S X=$$PRE(GMTSUSR) D:$L(X) EDIT^GMTSXAP2(GMTSUSR,X) Q
  1. ;
  1. PRE(GMTSUSR) ; Precedence of Parameter Entities
  1. ;
  1. ; Input User, pointer to NEW PERSON file
  1. ;
  1. ; Output String of Selected Entity Abbreviations,
  1. ; delimited by a semi-colon, and arranged in
  1. ; the order they should be used.
  1. ;
  1. ; Example: USR;SYS;NAT
  1. ;
  1. ; Use "User" defined Health Summary Types,
  1. ; "System" defined Health Summary Types and
  1. ; "National" Health Summary Types in that order.
  1. ;
  1. N GMTSEL,GMTSORD,GMTS,GMTSDEF,GMTSEXIT,GMTSINC,GMTSIN,GMTSCPL,GMTSPRE
  1. S GMTSUSR=+($G(GMTSUSR)),GMTSEXIT=0 Q:'$L($$UNM^GMTSXAW3(+($G(GMTSUSR)))) ""
  1. W:+($G(GMTSUSR))'=.5 !,"CPRS Reports Tab, Health Summary Type List (Contents)",!
  1. W:+($G(GMTSUSR))=.5 !,"Site Default CPRS Reports Tab, Health Summary Type List (Contents)",!
  1. D INA S GMTSIN=0 F S GMTSIN=$O(GMTSINC(GMTSIN)) Q:+GMTSIN=0 Q:+($G(GMTSEXIT))>0 D INC(GMTSINC(GMTSIN)) Q:+($G(GMTSEXIT))>0
  1. I +GMTSEXIT>0,$D(GMTSEL("@")) D ADEL^GMTSXAP2
  1. Q:+($G(GMTSEXIT))>0 "" S X="" I '$D(GMTSEL)!($O(GMTSEL(0))'>0) Q X
  1. I $D(GMTSEL),$O(GMTSEL(0))>0 D ORD
  1. I +GMTSEXIT>0,$D(GMTSORD("@")) D ADEL^GMTSXAP2
  1. S:+($G(GMTSEXIT))=0 X=$$CPL
  1. I +GMTSEXIT>0,$D(GMTSCPL("@")) D ADEL^GMTSXAP2
  1. Q X
  1. ; Include Health Summary Types
  1. INA ; Input Array (from Parameter File)
  1. N GMTSI,GMTST,GMTSA,GMTSN,GMTSP,GMTSH,GMTSC,GMTSALW D EN^GMTSXAW
  1. S (GMTSC,GMTSI)=0 F S GMTSI=$O(GMTSALW(GMTSI)) Q:+GMTSI=0 D
  1. . S GMTST=$G(GMTSALW(GMTSI)) Q:'$L(GMTST) S GMTSA=$P(GMTST,"^",1) Q:$L(GMTSA)'=3 S GMTSN=$P(GMTST,"^",4) Q:'$L(GMTSN)
  1. . ; Include User Preferred Health Summary Types: (Y/N)
  1. . ; Include System Defined Health Summary Types: (Y/N)
  1. . ; Group National Types together (Remote Data Views): (Y/N)
  1. . S GMTSP="Include "_GMTSN_" Defined Health Summary Types"
  1. . S GMTSH=GMTSN_" Level Health Summary Types"
  1. . S:GMTSA="USR" GMTSP="Include "_GMTSN_" Preferred Health Summary Types",GMTSH=GMTSN_" Preferred Health Summary Types"
  1. . S GMTSC=GMTSC+1,GMTSINC(GMTSC)=GMTSA_"^"_GMTSP_"^"_GMTSH
  1. S GMTSC=GMTSC+1,GMTSA="NAT",GMTSN="National"
  1. S GMTSP="Group "_GMTSN_" Types together (Remote Data View)"
  1. S GMTSH="Nationally Exported Health Summary Types"
  1. S GMTSINC(GMTSC)=GMTSA_"^"_GMTSP_"^"_GMTSH
  1. Q
  1. INC(X) ; Select Health Summary Types to Include
  1. Q:+($G(GMTSEXIT))>0 N Y,DIR,%,%P,DTOUT,DUOUT,DIRUT,DIROUT,GMTSI,GMTST,GMTSA,GMTSO S GMTST=$G(X)
  1. S GMTSA=$P(GMTST,"^",1),GMTSO=$P(GMTST,"^",3),GMTST=$P(GMTST,"^",2) Q:'$L(GMTST) Q:GMTSA'?3U
  1. S GMTSI=+($O(GMTSDEF(" "),-1))+1,GMTSDEF(GMTSI)=GMTSA_"^"_GMTST_"^"_GMTSO
  1. S DIR(0)="YAO",DIR("A")=" "_GMTST_":" F Q:$L(DIR("A"))>51 S DIR("A")=DIR("A")_" "
  1. S DIR("A")=DIR("A")_" (Y/N) " S:$L(GMTSO) DIR("A")=" "_DIR("A")
  1. S DIR("B")="Y",DIR("?")="^D INH1^GMTSXAP",DIR("??")="^D INH2^GMTSXAP"
  1. S:DIR("A")["Group Nat" DIR("B")="N"
  1. D ^DIR I Y="",X="@" D
  1. . N GMTSD S GMTSD=$P($G(^GMT(142.98,+($G(GMTSUSR)),1)),"^",2)
  1. . S GMTSEXIT="1^"_$S($L(GMTSD):"",1:"exiting")
  1. . S Y="@" K GMTSEL S GMTSEL("@")=""
  1. S:Y["^"!($D(DUOUT))!($D(DIROUT)) GMTSEXIT="1^exiting"
  1. S:$D(DTOUT) GMTSEXIT="1^try later"
  1. I +($G(GMTSEXIT))>0 W $S($L($P(GMTSEXIT,"^",2)):"...",1:""),$P(GMTSEXIT,"^",2) Q
  1. I +Y>0 S GMTSI=+($O(GMTSEL(" "),-1))+1,GMTSEL(GMTSI)=GMTSA_"^"_GMTST_"^"_GMTSO
  1. Q
  1. INH1 ; Include Help - Single ?
  1. W !," Enter either 'Y' or 'N'" D INH3 Q
  1. INH2 ; Include Help - Double ??
  1. W !," Select specified groups of Health Summary Types to include in the"
  1. W !," Health Summary Types list on the CPRS Reports Tab. Groups include:",!
  1. W !," USR User Preferred Health Summary Types in the Parameters file"
  1. W !," SYS System Defined Summary Types in the parameters file"
  1. W !," NAT National Health Summary Types (Remote Data Views)" D INH3 Q
  1. INH3 ; Include Help - Prompt
  1. I $L($G(DIR("A"))),$G(DIR("A"))'["Include",$G(DIR("A"))=$G(%P) D
  1. . N GMTSL S GMTSL=" ",GMTSL=$S($G(DIR("A"))[GMTSL:" ",1:"")
  1. . S (%P,DIR("A"))=GMTSL_" Include "_$$TRIM^GMTSXA(DIR("A")," ",1)
  1. Q
  1. ;
  1. ORD ; Order of Health Summaries in List
  1. N GMTSI,GMTST,GMTSC,GMTSCNT,GMTSTOT,GMTSREM,GMTSSO,GMTSNXT,GMTSNXC
  1. S (GMTSSO,GMTSCNT,GMTSI)=0,(GMTSTOT,GMTST)=$$SLT^GMTSXAP2
  1. ; One Selected
  1. I GMTST=1 D Q
  1. . S (GMTSI,GMTSC)=0 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
  1. . . S GMTST=$P($G(GMTSEL(GMTSI)),"^",1)
  1. . . S:GMTST?3U GMTSC=GMTSC+1,GMTSORD(GMTSC)=GMTSEL(GMTSI)
  1. ; Multiple Selected
  1. W !!!," You have selected multiple Health Summary types to be listed on the CPRS",!," reports tab. Now you must select the order in which you want these to",!," be displayed."
  1. F Q:+($G(GMTSEXIT))>0 D SO Q:+($G(GMTSEXIT))>0 Q:'$D(GMTSEL)
  1. Q
  1. SO ; Select Order
  1. N GMTSI,GMTSC,GMTSMAX,GMTSREO S GMTSI=0,GMTSREM=$$SLT^GMTSXAP2
  1. S GMTSCNT=GMTSTOT-GMTSREM,GMTSNXT=GMTSCNT+1,GMTSSO=+($G(GMTSSO))+1
  1. S GMTSNXC=$S(GMTSNXT=1:(GMTSNXT_"st"),GMTSNXT=2:(GMTSNXT_"nd"),GMTSNXT=3:(GMTSNXT_"rd"),1:(GMTSNXT_"th"))
  1. I +GMTSREM=1 D Q
  1. . S Y=+GMTSREM D SET
  1. W ! D:+($G(GMTSSO))=1 SOHD D SOL,REO S (GMTSC,GMTSI)=0
  1. S GMTSMAX=GMTSREM
  1. W ! N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
  1. S DIR(0)="NAO^1:"_GMTSMAX_":0"
  1. S DIR("?")="^D SOH1^GMTSXAP"
  1. S DIR("??")="^D SOH2^GMTSXAP"
  1. S DIR("A")=" Select the "_GMTSNXC_" to be listed: "
  1. K DIR("B") S:+($O(GMTSREO(0)))>0 DIR("B")=+($O(GMTSREO(0)))
  1. D ^DIR I Y="",X="@" D
  1. . N GMTSD S GMTSD=$P($G(^GMT(142.98,+($G(GMTSUSR)),1)),"^",2)
  1. . S GMTSEXIT="1^"_$S($L(GMTSD):"",1:"exiting")
  1. . S Y="@" K GMTSORD S GMTSORD("@")=""
  1. S:Y["^"!($D(DUOUT))!($D(DIROUT)) GMTSEXIT="1^exiting" S:$D(DTOUT) GMTSEXIT="1^try later"
  1. I +($G(GMTSEXIT))>0 W $S($L($P(GMTSEXIT,"^",2)):"...",1:""),$P(GMTSEXIT,"^",2) Q
  1. I +Y>0,+Y'>GMTSREM D SET
  1. Q
  1. SOL ; List - Included Health Summaries
  1. N GMTSC,GMTSI S (GMTSC,GMTSI)=0 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
  1. . S GMTSC=GMTSC+1 W !,?9,$J(GMTSC,4)," ",$P(GMTSEL(GMTSI),"^",3)
  1. Q
  1. SOHD ; Help Text
  1. W !," Order to Display Included Health Summary Types",! Q
  1. SOH1 ; Help - Single ?
  1. N GMTSC,GMTSI,GMTSN,GMTSCT S (GMTSC,GMTSI)=0,GMTSCT=+($G(GMTSNXT)) F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 S GMTSC=GMTSC+1
  1. S GMTSN=$S(GMTSCT=1:"first",GMTSCT=2:"second",GMTSCT=3:"third",GMTSCT=4:"fourth",GMTSCT=5:"fifty",GMTSCT=6:"sixth",GMTSCT=7:"seventh",GMTSCT=8:"eighth",GMTSCT=9:"nineth",1:"")
  1. I '$L(GMTSN),+GMTSC>1 W !,?9,"Select a group of Health Summary Types to list (1-",GMTSC,")",!
  1. I $L(GMTSN),+GMTSC>1 W !,?9,"Select a group of Health Summary Types to list ",GMTSN," (1-",GMTSC,")",!
  1. D SOL
  1. Q
  1. SOH2 ; Help - Double ??
  1. W !," You have included multiple Health Summary types to be"
  1. W !," listed on the CPRS reports tab, Health Summary Types box."
  1. W !," Now you must select the order in which you want these"
  1. W !," to be listed.",!
  1. D SOL
  1. Q
  1. ;
  1. ; Arrange
  1. SET ; Set Order
  1. D REO N GMTSO S GMTSO=+($O(GMTSORD(" "),-1))+1
  1. S:$L($G(GMTSREO(+$G(Y)))) GMTSORD(GMTSO)=$G(GMTSREO(+Y))
  1. S (GMTSC,GMTSI)=0
  1. F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
  1. . S GMTSC=GMTSC+1 I GMTSC=+Y K GMTSEL(GMTSI),GMTSREO(GMTSC)
  1. Q
  1. REO ; Re-order
  1. K GMTSREO N GMTSC,GMTSI S (GMTSC,GMTSI)=0
  1. F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
  1. . S GMTSC=GMTSC+1 S GMTSREO(GMTSC)=$G(GMTSEL(GMTSI))
  1. Q
  1. CPL(X) ; Compile Order
  1. Q:+($G(GMTSEXIT))>0 ""
  1. N GMTSI,GMTSA,GMTSOK,GMTSNEW S X="",GMTSI=0
  1. F S GMTSI=$O(GMTSORD(GMTSI)) Q:+GMTSI=0 D
  1. . S GMTSA=$$UP^GMTSXA($P($G(GMTSORD(GMTSI)),"^",1))
  1. . S:GMTSA?3U X=$G(X)_";"_GMTSA
  1. S (GMTSNEW,X)=$$TRIM^GMTSXA(X,";",3)
  1. S GMTSOK=$$OK^GMTSXAP2 Q:GMTSOK'>0 ""
  1. Q X