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

BGP6GPED.m

Go to the documentation of this file.
  1. BGP6GPED ; IHS/CMI/LAB - GUI COM REPORT ;
  1. ;;16.1;IHS CLINICAL REPORTING;;MAR 22, 2016;Build 170
  1. ;
  1. ;
  1. TESTELD ;
  1. S ERR=""
  1. S BGPND(4)="",BGPND(3)=""
  1. S BGPLIST(3)=""
  1. D EP(.ERR,1,2522,"BGP 16 PAT ED REPORT",338,"S",.BGPND,1,3040000,3000000,1,"A",.BGPLIST,"","",1,"B",$$NOW^XLFDT)
  1. W !,ERR
  1. Q
  1. EP(BGPRET,BGPUSER,BGPDUZ2,BGPOPTN,BGPTAXI,BGPZZ,BGPIND,BGPQTR,BGPPER,BGPVDT,BGPBEN,BGPLSTT,BGPLIST,BGPLPRV,BGPLPROV,BGPEXPT,BGPROT,BGPRTIME,BGPMFITI,BGPFILE,BGPSEAT,BGPBEGIN,BGPDNT) ;EP - called from GUI to produce COM REPORT CI05-RPT-LOC-COM
  1. ; SEE ROUTINE BGP6DEL if you have questions about any of these variables
  1. ; TAXONOMY CHECK IS IN ^BGP6XTEL
  1. ; BGPUSER - DUZ
  1. ; BGPDUZ2 - DUZ(2)
  1. ; BGPOPTN - OPTION NAME
  1. ; BGPTAXI - IEN OF COMMUNITY TAXONOMY NAME
  1. ; BGPZZ - $E (1st character) of the answer to the following DIR call:
  1. ; A = All Measures
  1. ; S = Selected Measures
  1. ;
  1. ; Which set of Measures should be included in this report:
  1. ;
  1. ; BGPIND - note: THIS ARRAY IS ONLY REQUIRED IF BGPINDM="S"
  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 16 ELDER INDICATORS file (^BGPELIM GLOBAL). When
  1. ; you present them to the user for selection use all of them
  1. ; in the file, do not screen out any of them.
  1. ;
  1. ; BGPQTR - this is equal to 1,2,3,4,5 depending on how the user answers the following
  1. ; 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. ; 5 User defined date range
  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. ; if they choose 5 then this is the fileman date for the end date the user enters
  1. ;
  1. ; BGPVDT - baseline year entered by user in internal fileman format, year only
  1. ; e.g. 3010000
  1. ;
  1. ; BGPBEN - 1 for Indians only, 2 for Not Indian, 3 for both (see reader call
  1. ; at subroutine BEN in BGP6DL
  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. ; BGPEXPT - if they choose to export to area this will by set to 1
  1. ; note********* only ask if they want to export if they selected All for measure type
  1. ; e.g. BGPZZ="A"
  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)="",$G(BGPSEAT)="" S BGPRET=0_"^IEN OF COMMUNITY TAXONOMY NOT PASSED" Q
  1. I $G(BGPTAXI),'$D(^ATXAX(BGPTAXI)) S BGPRET=0_"^INVALID COMMUNITY TAXONOMY IEN PASSED" Q
  1. I $G(BGPZZ)="" S BGPRET=0_"^INDICATOR TYPE NOT PASSED" Q
  1. I "AS"'[BGPZZ S BGPRET=0_"^INDICATOR TYPE INVALID" Q
  1. I BGPZZ="S",'$D(BGPIND) S BGPRET=0_"^INDICATOR ARRAY NOT PASSED" Q
  1. I BGPZZ="S",'$O(BGPIND(0)) S BGPRET=0_"^INDICATOR ARRAY NOT PASSED" Q
  1. I BGPZZ="A" S X=0 F S X=$O(^BGPPEIM(X)) Q:X'=+X S BGPIND(X)=""
  1. I BGPZZ='"A" S BGPEXPT=""
  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 $G(BGPBEN)="",'$G(BGPSEAT) S BGPRET=0_"^BENEFICIARY TYPE 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. S BGPRTIME=$G(BGPRTIME)
  1. S BGPLIST=$G(BGPLSTT)
  1. I $G(BGPLIST)="P",$G(BGPLPRV)="" S BGPRET=0_"^PROVIDER NOT PASSED FOR LIST TYPE P" Q
  1. I $G(BGPLPRV) S BGPLPROV=$P($G(^VA(200,BGPLPRV,0)),U)
  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=6,BGPYRPTH="C"
  1. I $G(BGPSEAT) S BGPEDPP=1,BGPPEEXP=0,BGPEXPT=0
  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 BGPED=BGPPER,BGPPER=$E(BGPED,1,3)_"0000",BGPBD=BGPBEGIN
  1. ;
  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. K BGPTAX S X=0
  1. I $G(BGPTAXI) D
  1. . F S X=$O(^ATXAX(BGPTAXI,21,X)) Q:'X D
  1. ..S BGPTAX($P(^ATXAX(BGPTAXI,21,X,0),U))=""
  1. ..Q
  1. D REPORT^BGP6PUTL
  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. S BGPUF=$$GETDIR^BGP6UTL2()
  1. S BGPFILEN=""
  1. I BGPEXPT S BGPFILEN="BG161"_$P(^AUTTLOC(DUZ(2),0),U,10)_".PED"_BGPRPT_" in directory "_BGPUF
  1. ;create entry in GUI file
  1. D ^XBFMK
  1. S X=BGPFILE
  1. S BGPGFNM=X
  1. S DIC="^BGPGUIM(",DIC(0)="L",DIADD=1,DLAYGO=90556.19,DIC("DR")=".02////"_BGPUSER_";.03////"_$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT)_";.05///"_BGPOPTN_";.06///R;.07///"_$G(BGPROT)_";1///"_BGPFILEN
  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. I BGPEXPT S $P(BGPRET,"~",3)=BGPFILEN
  1. Q
  1. ;
  1. TSKMN ;
  1. S ZTIO=""
  1. K ZTSAVE S ZTSAVE("*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="OTHPED^BGP6GPED",ZTDTH=$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT),ZTDESC="GUI PAT ED REPORT" D ^%ZTLOAD
  1. D UPLOG^BGP6GUA(BGPGIEN,ZTSK)
  1. Q
  1. OTHPED ;
  1. D ^BGP6DPE1
  1. K ^TMP($J,"BGPGUI")
  1. S IOM=80,BGPIOSL=55
  1. D GUIR^BGPXBLM("^BGP6DPEP","^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 ^BGPGUIM(BGPGIEN,11,C,0)=BGPDATA
  1. S ^BGPGUIM(BGPGIEN,11,0)="^90556.1911^"_C_"^"_C_"^"_DT
  1. K ^TMP($J,"BGPGUI")
  1. ;cmi/anch/maw end of mods
  1. I BGPEXPT D GS^BGP6PUTL
  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. ENDLOG ;-- UPDATE LOG AT END
  1. S DIE="^BGPGUIM(",DA=BGPGIEN,DR=".04////"_$$NOW^XLFDT_";.06///C"
  1. D ^DIE
  1. K DIE,DR,DA
  1. Q