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

BGP4GPP.m

Go to the documentation of this file.
  1. BGP4GPP ; IHS/CMI/LAB - GUI PP REPORT ;
  1. ;;14.1;IHS CLINICAL REPORTING;;MAY 29, 2014;Build 114
  1. ;
  1. ;
  1. TESTNTL ;
  1. S ERR=""
  1. S BGPND(4)="",BGPND(3)=""
  1. S BGPLIST(3)=""
  1. D EP(.ERR,1,2522,"BGP 14 SEL PATIENT PANEL",338,"D",.BGPND,1,3040000,3000000,1801,"A",.BGPLIST,"","","B",$$NOW^XLFDT)
  1. W !,ERR
  1. Q
  1. EP(BGPRET,BGPUSER,BGPDUZ2,BGPOPTN,BGPINDJ,BGPIND,BGPQTR,BGPPER,BGPVDT,BGPSEAT,BGPLSTT,BGPLIST,BGPLPRV,BGPLPROV,BGPROT,BGPRTIME,BGPFILE,BGPDNT) ;EP - called from GUI to produce PP REPORT CI05-RPT-LOC-PP
  1. ; SEE ROUTINE BGP4DL if you have questions about any of these variables
  1. ; BGPUSER - DUZ
  1. ; BGPDUZ2 - DUZ(2)
  1. ; BGPOPTN - OPTION NAME
  1. ; BGPTAXI - IEN OF COMMUNITY TAXONOMY NAME
  1. ; BGPINDJ - $E (1st character) of the answer to the following DIR call:
  1. ; value will be a D, C, W, E or S
  1. ; Select one of the following:
  1. ;
  1. ; DM Diabetes-Related Measures
  1. ; CVD Cardiovascular Disease Prevention for At-Risk Patients
  1. ; WH Women's Health-Related Measures
  1. ; ELD Elder Care-Related Measures
  1. ; SEL Selected Measures (User Defined)
  1. ;
  1. ; Which set of Measures should be included in this report:
  1. ;
  1. ; BGPIND - note: THIS array is only required IF they choose SEL above
  1. ; so if BGPINDJ="S" pass this array
  1. ; array containing iens of the measures selected by the user
  1. ; for example, BGPIND(3)=""
  1. ; BGPIND(6)="" if the user selected measures
  1. ; 1 and 6 from the BGP 14 INDICATORS file. When
  1. ; you present them to the user for selection use all of
  1. ; then in the file, do not screen out any of them.
  1. ;
  1. ; BGPQTR - this is equal to 1,2,3,4 depending on how the user answers the following DIR call:
  1. ; Select one of the following:
  1. ;
  1. ; 1 January 1 - December 31
  1. ; 2 April 1 - March 31
  1. ; 3 July 1 - June 30
  1. ; 4 October 1 - September 30
  1. ;
  1. ; Enter the date range for your report:
  1. ;
  1. ; BGPPER - this is the year they select if they answered the above question
  1. ; with a 1 through 4 e.g 305000 (fileman imprecise date for 2010)
  1. ;
  1. ; BGPVDT - baseline year entered by user in internal fileman format, year only
  1. ; e.g. 3010000
  1. ;
  1. ; BGPSEAT - ien of search template in the search template file that the
  1. ; user selected
  1. ;
  1. ; BGPLSTT - this contains the answer to the following DIR call:
  1. ;
  1. ; Select one of the following:
  1. ; P Patient List by Provider
  1. ; A All Patients
  1. ;
  1. ; Choose report type for the Lists: R//
  1. ; BGPLIST (array) contains the iens of the measures they want a list for.
  1. ; when you present the choices for lists only present the measures they pick
  1. ; that are in array BGPIND (run report to see this)
  1. ; e.g. BGPLIST="A"
  1. ; BGPLIST(3)=""
  1. ;
  1. ; BGPLPRV - will equal ien of provider if they picked "P" above
  1. ; BGPLPROV - will equal provider name if they picked "P" above
  1. ;
  1. ; BGPROT - type of output P for printed, D For Delimited, B for both
  1. ; BGPRTIME - report will be queued automatically, this variable
  1. ; contains the time it will run, internal fileman format
  1. ; must be date and time
  1. ;
  1. ;
  1. ; BGPRET - return value is ien^error message^export file name. a zero (0) is
  1. ; passed as ien if error occurred, display the filename back to the user
  1. ; if they chose to export to area
  1. ;
  1. ;create entry in gui output file
  1. ;queue report to run with/GUIR
  1. D EP1
  1. S Y=BGPRET
  1. ;D EN^XBVK("BGP") S:$D(ZTQUEUED) ZTREQ="@"
  1. S BGPRET=Y
  1. Q
  1. EP1 ;
  1. S U="^"
  1. I $G(BGPUSER)="" S BGPRET=0_"^USER NOT PASSED" Q
  1. I $G(BGPDUZ2)="" S BGPRET=0_"^DUZ(2) NOT PASSED" Q
  1. I $G(BGPOPTN)="" S BGPRET=0_"^OPTION NAME NOT PASSED" Q
  1. ;I $G(BGPTAXI)="" S BGPRET=0_"^IEN OF COMMUNITY TAXONOMY NOT PASSED" Q
  1. ;I '$D(^ATXAX(BGPTAXI)) S BGPRET=0_"^INVALID COMMUNITY TAXONOMY IEN PASSED" Q
  1. I $G(BGPINDJ)="" S BGPRET=0_"^INDICATOR TYPE NOT PASSED" Q
  1. I "DCWESIPA"'[BGPINDJ S BGPRET=0_"^INDICATOR TYPE INVALID" Q
  1. I BGPINDJ="S",'$D(BGPIND) S BGPRET=0_"^INDICATOR ARRAY NOT PASSED" Q
  1. I BGPINDJ="S",'$O(BGPIND(0)) S BGPRET=0_"^INDICATOR ARRAY NOT PASSED" Q
  1. I $G(BGPPER)="" S BGPRET=0_"^YEAR VARIABLE NOT PASSED" Q
  1. I $G(BGPQTR)="" S BGPRET=0_"^QUARTER/DATE TYPE NOT PASSED" Q
  1. I $G(BGPVDT)="" S BGPRET=0_"^BASELINE YEAR NOT PASSED" Q
  1. I "PDB"'[$G(BGPROT) S BGPRET=0_"^REPORT OUTPUT TYPE NOT PASSED" Q
  1. I $G(BGPLSTT)="" S BGPRET=0_"^LIST TYPE NOT PASSED" Q
  1. I $G(BGPLIST)="P",$G(BGPLPRV)="" S BGPRET=0_"^PROVIDER NOT PASSED FOR LIST TYPE P" Q
  1. I $G(BGPSEAT)="" S BGPRET=0_"^SEARCH TEMPLATE IEN MISSING" Q
  1. S BGPRTIME=$G(BGPRTIME)
  1. S BGPLIST=$G(BGPLSTT)
  1. ;S DUZ=BGPUSER
  1. S DUZ(2)=BGPDUZ2
  1. S:'$D(DT) DT=$$DT^XLFDT
  1. D ^XBKVAR
  1. S BGPGUI=1
  1. S IOM=80,BGPIOSL=55
  1. S BGPRTYPE=4,BGPYRPTH="P"
  1. I BGPINDJ="D" K BGPIND D DI
  1. I BGPINDJ="C" K BGPIND D CI
  1. I BGPINDJ="W" K BGPIND D WI
  1. I BGPINDJ="E" K BGPIND D EI
  1. I BGPINDJ="I" K BGPIND D II^BGP4DL
  1. I BGPINDJ="P" K BGPIND D PI^BGP4DL
  1. I BGPINDJ="A" K BGPIND D AI^BGP4DL
  1. I BGPQTR=1 S BGPBD=$E(BGPPER,1,3)_"0101",BGPED=$E(BGPPER,1,3)_"1231"
  1. I BGPQTR=2 S BGPBD=($E(BGPPER,1,3)-1)_"0401",BGPED=$E(BGPPER,1,3)_"0331"
  1. I BGPQTR=3 S BGPBD=($E(BGPPER,1,3)-1)_"0701",BGPED=$E(BGPPER,1,3)_"0630"
  1. I BGPQTR=4 S BGPBD=($E(BGPPER,1,3)-1)_"1001",BGPED=$E(BGPPER,1,3)_"0930"
  1. I BGPQTR=5 S BGPBD=$$FMADD^XLFDT(BGPPER,-364),BGPED=BGPPER,BGPPER=$E(BGPED,1,3)_"0000"
  1. BY ;get baseline year
  1. S X=$E(BGPPER,1,3)-$E(BGPVDT,1,3)
  1. S X=X_"0000"
  1. S BGPBBD=BGPBD-X,BGPBBD=$E(BGPBBD,1,3)_$E(BGPBD,4,7)
  1. S BGPBED=BGPED-X,BGPBED=$E(BGPBED,1,3)_$E(BGPED,4,7)
  1. S BGPPBD=($E(BGPBD,1,3)-1)_$E(BGPBD,4,7)
  1. S BGPPED=($E(BGPED,1,3)-1)_$E(BGPED,4,7)
  1. S BGPHOME=$P($G(^BGPSITE(DUZ(2),0)),U,2)
  1. S BGPBEN=3
  1. D REPORT^BGP4UTL
  1. I $G(BGPQUIT) S BGPRET=0_"^COULD NOT CREATE REPORT ENTRY" Q
  1. I BGPRPT="" S BGPRET=0_"^COULD NOT CREATE REPORT ENTRY" Q
  1. S BGPDELT=""
  1. ;create entry in GUI file
  1. D ^XBFMK
  1. S X=BGPFILE
  1. ;S X=BGPUSER_$$NOW^XLFDT
  1. S BGPGFNM=X
  1. S DIC="^BGPGUIJ(",DIC(0)="L",DIADD=1,DLAYGO=90552.19,DIC("DR")=".02////"_BGPUSER_";.03////"_$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT)_";.05///"_BGPOPTN_";.06///R;.07///"_$G(BGPROT)
  1. K DD,D0,DO D FILE^DICN K DLAYGO,DIADD,DD,D0,DO
  1. I Y=-1 S BGPRET=0_"^UNABLE TO CREATE ENTRY IN GUI OUTPUT FILE" Q
  1. S BGPGIEN=+Y
  1. ;SEND THE REPORT PROCESS OFF TO THE BACKGROUND USING TASKMAN CALL
  1. D TSKMN
  1. S BGPRET=BGPGIEN
  1. Q
  1. ;
  1. TSKMN ;
  1. S ZTIO=""
  1. K ZTSAVE S ZTSAVE("*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="LOCPP^BGP4GPP",ZTDTH=$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT),ZTDESC="GUI NATIONAL GPRA REPORT COM 05" D ^%ZTLOAD Q
  1. Q
  1. LOCPP ;
  1. D ^BGP4D10
  1. K ^TMP($J,"BGPGUI")
  1. S IOM=80,BGPIOSL=55
  1. D GUIR^BGPXBLM("^BGP4DP","^TMP($J,""BGPGUI"",")
  1. ;cmi/anch/maw added 5/12/2009 for word output
  1. S X=0,C=0 F S X=$O(^TMP($J,"BGPGUI",X)) Q:X'=+X D
  1. . S C=C+1
  1. . N BGPDATA
  1. . S BGPDATA=$G(^TMP($J,"BGPGUI",X))
  1. . I BGPDATA="ZZZZZZZ" S BGPDATA=$C(12)
  1. . S ^BGPGUIJ(BGPGIEN,11,C,0)=BGPDATA
  1. S ^BGPGUIJ(BGPGIEN,11,0)="^90552.1911^"_C_"^"_C_"^"_DT
  1. K ^TMP($J,"BGPGUI")
  1. ;cmi/anch/maw end of mods
  1. D ENDLOG
  1. D XIT
  1. Q
  1. ;
  1. XIT ;
  1. K ^TMP($J)
  1. D EN^XBVK("BGP") S:$D(ZTQUEUED) ZTREQ="@"
  1. K DIRUT,DUOUT,DIR,DOD
  1. K DIADD,DLAYGO
  1. D KILL^AUPNPAT
  1. K X,X1,X2,X3,X4,X5,X6
  1. K A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
  1. K N,N1,N2,N3,N4,N5,N6
  1. K BD,ED
  1. D KILL^AUPNPAT
  1. D ^XBFMK
  1. L -^BGPDATA
  1. Q
  1. DI ;
  1. S X=0 F S X=$O(^BGPINDJC("ADM",1,X)) Q:X'=+X S BGPIND($P(^BGPINDJC(X,0),U,1))=""
  1. Q
  1. CI ;
  1. S X=0 F S X=$O(^BGPINDJC("ACARD",1,X)) Q:X'=+X S BGPIND($P(^BGPINDJC(X,0),U,1))=""
  1. Q
  1. WI ;
  1. S X=0 F S X=$O(^BGPINDJC("AWH",1,X)) Q:X'=+X S BGPIND($P(^BGPINDJC(X,0),U,1))=""
  1. Q
  1. EI ;
  1. S X=0 F S X=$O(^BGPINDJC("AEL",1,X)) Q:X'=+X S BGPIND($P(^BGPINDJC(X,0),U,1))=""
  1. Q
  1. ;
  1. ENDLOG ;-- UPDATE LOG AT END
  1. S DIE="^BGPGUIJ(",DA=BGPGIEN,DR=".04////"_$$NOW^XLFDT_";.06///C"
  1. D ^DIE
  1. K DIE,DR,DA
  1. Q