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

BWLABLG.m

Go to the documentation of this file.
BWLABLG ;IHS/ANMC/MWR - DISPLAY LAB LOG;15-Feb-2003 21:55;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CALLED BY OPTION: "BW LAB PRINT LOG" TO PRINT THE "LOG" OF
 ;;  OF PROCEDURES THAT HAVE BEEN ENTERED ("ACCESSIONED").
 ;
 ;---> VARIABLES:
 ;---> DATES: BWBEGDT=BEGINNING DATE, BWENDDT=ENDING DATE
 ;---> BWA:   1=ALL PROCEDURES, 0=ONLY PROCEDURES WITHOUT RESULTS
 ;---> BWB:   1=DISPLAY EACH PROCEDURE, 0=TOTALS ONLY
 ;
 D SETVARS^BWUTL5 S BWPOP=0
 D TITLE^BWUTL5("PRINT LOG OF PROCEDURES ENTRY")
 D DATES    G:BWPOP EXIT
 D SELECT   G:BWPOP EXIT
 D FACILITY G:BWPOP EXIT
 D RESULT   G:BWPOP EXIT
 D TOTALS   G:BWPOP EXIT
 D ORDER    G:BWPOP EXIT
 D DEVICE   G:BWPOP EXIT
 D SORT
 D COPYGBL
 D ^BWLABLG1
 ;
EXIT ;EP
 D KILLALL^BWUTL8
 Q
 ;
DATES ;EP
 ;---> ASK DATE RANGE.  RETURN DATES IN BWBEGDT AND BWENDDT.
 ;---> LAB PEOPLE GENERALLY LOOK AT THE LOG FOR ONE DAY.
 D ASKDATES^BWUTL3(.BWBEGDT,.BWENDDT,.BWPOP,"T-1","",1)
 Q
 ;
SELECT ;EP
 ;---> SELECT ENTRIES TO SEARCH FOR.
 D SELECT^BWSELECT("Accession Area",9002086.2,"BWAREA","","PAP",.BWPOP)
 Q
 ;
FACILITY ;EP
 ;---> SELECT FACILITY TO SEARCH FOR.
 N B S B=$$INSTTX^BWUTL6(DUZ(2))
 W !!?3,"Select the Facility for the log you wish to display."
 D DIC^BWFMAN(9002086.02,"QEMA",.Y,"   Select FACILITY: ",B)
 I Y<0 S BWPOP=1 Q
 S BWFAC=+Y
 Q
 ;
RESULT ;EP
 ;---> DISPLAY ALL PROCEDURES, OR ONLY PROCEDURES WITHOUT RESULTS.
 N DIR K DIRUT
 W !!?3,"Display ALL Procedures, or only Procedures with NO RESULTS?"
 S DIR("A")="   Select ALL or NO RESULTS: ",DIR("B")="ALL"
 S DIR(0)="SAM^a:ALL;n:NO RESULTS" D HELP1^BWLABLG2
 D ^DIR
 I Y=-1!($D(DIRUT)) S BWPOP=1 Q
 ;---> IF ALL PPROCEDURES, S BWA=1; IF ONLY NO RESULTS, S BWA=0.
 S BWA=$S(Y="a":1,1:0)
 Q
 ;
TOTALS ;EP
 ;---> DISPLAY ALL PROCEDURES, OR ONLY TOTALS.
 N DIR
 W !!?3,"Display data for EACH Procedure, or just TOTALS?"
 S DIR("A")="   Select EACH or TOTALS: ",DIR("B")="EACH"
 S DIR(0)="SAM^e:EACH;n:TOTALS" D HELP2^BWLABLG2
 D ^DIR
 I Y=-1!($D(DIRUT)) S BWPOP=1 Q
 ;---> IF DISPLAY EACH PROCEDURE, S BWB=1; IF TOTALS ONLY, S BWB=0
 S BWB=$S(Y="e":1,1:0)
 Q
 ;
ORDER ;EP
 ;---> ASK ORDER BY ACCESSION# OR BY PATIENT NAME.
 ;---> SORT SEQUENCE IN BWC:  1=ACCESSION# (DEFAULT), 2=PATIENT NAME
 S BWC=1
 ;---> QUIT IF DISPLAYING TOTALS ONLY.
 Q:'BWB  N DIR,DIRUT,Y
 W !!?3,"Display Procedures in order of:"
 W ?37,"1) ACCESSION# (earliest first)"
 W !?37,"2) PATIENT NAME (alphabetically)"
 S DIR("A")="   Select 1 or 2: ",DIR("B")=1
 S DIR(0)="SAM^1:ACCESSION#;2:PATIENT NAME" D HELP3^BWLABLG2
 D ^DIR
 I Y=-1!($D(DIRUT)) S BWPOP=1 Q
 S BWC=Y
 Q
 ;
DEVICE ;EP
 ;---> GET DEVICE AND POSSIBLY QUEUE TO TASKMAN.
 S ZTRTN="DEQUEUE^BWLABLG"
 F BWSV="A","B","C","BEGDT","ENDDT","FAC" D
 .I $D(@("BW"_BWSV)) S ZTSAVE("BW"_BWSV)=""
 ;---> SAVE ATTRIBUTES ARRAY. NOTE: SUBSTITUTE LOCAL ARRAY FOR BWAREA.
 I $D(BWAREA) N N S N=0 F  S N=$O(BWAREA(N)) Q:N=""  D
 .S ZTSAVE("BWAREA("""_N_""")")=""
 D ZIS^BWUTL2(.BWPOP,1)
 Q
 ;
SORT ;EP
 ;---> SORT AND STORE ARRAY IN ^TMP("BW",$J
 ;---> BWBEGDT1=ONE SECOND BEFORE BEGIN DATE.
 ;---> BWENDDT1=THE LAST SECOND OF END DATE.
 ;
 K ^TMP("BW",$J)
 S BWBEGDT1=BWBEGDT-.0001,BWENDDT1=BWENDDT+.9999
 S BWDATE=BWBEGDT1
 F  S BWDATE=$O(^BWPCD("ADE",BWDATE)) Q:'BWDATE!(BWDATE>BWENDDT1)  D
 .S BWIEN=0
 .F  S BWIEN=$O(^BWPCD("ADE",BWDATE,BWIEN)) Q:'BWIEN  D
 ..S Y=^BWPCD(BWIEN,0),BWDFN=$P(Y,U,2)
 ..;---> QUIT IF NOT DONE AT THE SELECTED FACILITY.
 ..Q:$P(Y,U,34)'=BWFAC
 ..;---> QUIT IF NOT ALL "ACCESSION AREAS" (PROCEDURE TYPES) AND
 ..;---> THIS DOES NOT MATCH THE SELECTED AREA.
 ..I '$D(BWAREA("ALL")) Q:$P(Y,U,4)=""  Q:'$D(BWAREA($P(Y,U,4)))
 ..D STORE
 Q
 ;
 ;
STORE ;EP
 ;--->BWDATE IS ALREADY SET FROM LL SORT ABOVE.        ;---> DATE
 S BWCHRT=$$HRCN^BWUTL1(BWDFN)                         ;---> CHART#
 S BWNAME=$$NAME^BWUTL1(BWDFN)                         ;---> NAME
 S BWACCN=$P(Y,U)                                      ;---> ACCESSION#
 S X=$P(Y,U,4),BWPCDN=$$PCDNAM^BWUTL6                  ;---> PROC TYPE
 S BWDIAG=$$DIAG^BWUTL4($P(Y,U,5))                     ;---> RESULT/DIAG
 S BWRES=$O(^BWPCD(BWIEN,1,0))                         ;---> RESULT TEXT
 ;---> QUIT IF DISPLAYING ONLY PROCEDURES WITH NO RESULTS.
 Q:'BWA&($P(Y,U,5))
 S BWPDATE=$$SLDT2^BWUTL5($P(Y,U,12))                  ;---> PROC DATE
 S BWRCVDT=$$SLDT2^BWUTL5($P(Y,U,17))                  ;---> RCV RES DAT
 S X=$P(Y,U,11),BWHLOC=$$HOSPLC^BWUTL6                 ;---> HOSP LOC
 S X=$P(Y,U,7),BWPROV=$$PROV^BWUTL6                    ;---> PROVIDER
 S X=$P(Y,U,18),BWUSER=$$PROV^BWUTL6                   ;---> ENTERED BY
 ;
 S X=BWCHRT_U_BWNAME_U_BWDATE_U_BWACCN_U_BWPCDN_U_BWRES_U_BWPDATE
 S X=X_U_BWHLOC_U_BWPROV_U_BWUSER_U_BWRCVDT_U_BWDIAG_U_BWIEN
 I BWC=1 S ^TMP("BW",$J,1,BWDATE,$P(BWACCN,"-"),$P(BWACCN,"-",2))=X Q
 I BWC=2 S ^TMP("BW",$J,1,BWDATE,BWNAME,BWACCN)=X Q
 Q
 ;
COPYGBL ;EP
 ;---> COPY ^TMP("BW",$J,1 TO ^TMP("BW",$J,2 TO MAKE IT FLAT.
 N I,M,N,P,Q
 S N=0,I=0
 F  S N=$O(^TMP("BW",$J,1,N)) Q:N=""  D
 .S M=0
 .F  S M=$O(^TMP("BW",$J,1,N,M)) Q:M=""  D
 ..S P=0
 ..F  S P=$O(^TMP("BW",$J,1,N,M,P)) Q:P=""  D
 ...S I=I+1,^TMP("BW",$J,2,I)=^TMP("BW",$J,1,N,M,P)
 Q
 ;
DEQUEUE ;EP
 ;---> TASKMAN QUEUE OF PRINTOUT.
 D SETVARS^BWUTL5,SORT,COPYGBL,^BWLABLG1,EXIT
 Q