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

BRARPT1.m

Go to the documentation of this file.
BRARPT1 ; IHS/ADC/PDW - Radiology Exam Roster by Proc, Rad, Diag Code. ;    
 ;;5.0;Radiology/Nuclear Medicine;;Feb 20, 2004
 ;
 D ^XBKVAR K BRADIC
PROMPT ;
 ;S:'$D(IOF) IOF="!!" ;CMTD OUT IHS/ISD/EDE 04/01/97
 ;W @IOF,!?10 F I=1:1:62 W "-"
 W !!,?10 F I=1:1:62 W "-" ; REPLACED W @IOF WITH W !!
 W !?10,"| ***  EXAM ROSTER BY RADIOLOGIST, PROCEDURE, DIAG CODE  *** |"
 W !?10 F I=1:1:62 W "-"
 ;
 ;---> GET DATE RANGE, RETURNS "RABEGDT" AND "RAENDDT".
 D DATE^RAUTL G:RAPOP EXIT
 S RABEGDT=BEGDATE,RAENDDT=ENDDATE
 ;
 S BRAY=0
PROC ;---> SELECT PROCEDURES.
 S BRADIR="procedure",BRADIC=71
 S BRAVAR="RAPRC",BRAGBL="^RAMIS(71,"
 D SELECT
 G:'BRAY EXIT
 ;
RAD ;---> SELECT RADIOLOGISTS.
 S BRADIR="radiologist",BRAVAR="RARAD",BRAGBL="^VA(200,"
 S BRADIC=200,BRADIC("S")="I $D(^VA(200,""ARC"",""S"",Y))"
 D SELECT K BRADIC("S")
 G:'BRAY EXIT
 ;
DIAG ;---> SELECT DIAGNOSTIC CODES.
 S BRADIR="diagnostic code",BRADIC=78.3
 S BRAVAR="RADIAG",BRAGBL="^RA(78.3,"
 D SELECT
 G:'BRAY EXIT
 ;
TASKMAN ;---> TASKMAN STUFF.
 S ZTRTN="START^BRARPT1"
 F RASV="RABEGDT","RAENDDT","RAPRC(","RARAD(","RADIAG(" D
 .S ZTSAVE(RASV)=""
 ;
DEV ;---> GET DEVICE AND/OR QUEUE.
 W ! D ZIS^RAUTL G:RAPOP EXIT
 ;
START ;---> TASKMAN STARTING POINT.
 D SORT
 ;
PRINT D ^BRARPT2
 ;
EXIT ;
 K DIC,DIR,DIRUT,I,N,O,P,RAPOP,Q,R,RABEGDT,RACNI,RAD0,RADFN,RADIAG,RADTE
 K RADTI,RAEND,RAENDDT,RAMES,RANAME,RAP0,RAPAGE,RAPRC,RARAD,RASV,BRADIC
 K BRADIR,BRAGBL,BRAVAR,BRAY,^TMP($J,"RA"),X,Y,ZTDESC,ZTRTN,ZTSAVE
 Q
 ;
 ;
SORT ;---> SORT EXAMS FOR SELECTED CRITERIA.
 K ^TMP($J,"RA")
 S RADTE=RABEGDT-.0001,RAEND=RAENDDT+.9999
 F  S RADTE=$O(^RADPT("AR",RADTE)) Q:RADTE'>0!(RADTE>RAEND)  D
 .S RADTI=9999999.9999-RADTE
 .D RADFN
 Q
 ;
RADFN S RADFN=0
 F  S RADFN=$O(^RADPT("AR",RADTE,RADFN)) Q:RADFN'>0  D
 .Q:'$D(^RADPT(RADFN,"DT",RADTI,0))
 .;---> RAD0=ZERO NODE OF VISIT.
 .S RAD0=^RADPT(RADFN,"DT",RADTI,0)
 .D RACNI
 Q
 ;
RACNI S RACNI=0
 F  S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:RACNI'>0  D
 .Q:'$D(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0))
 .;---> RAP0=ZERO NODE OF EXAM.
 .S RAP0=^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)
 .;---> IF NOT ALL PROCEDURES, THEN QUIT IF NOT ONE OF THE SELECTED.
 .Q:'$P(RAP0,U,2)  I '$D(RAPRC("ALL")) Q:'$D(RAPRC($P(RAP0,U,2)))
 .;---> IF NOT ALL RADIOLOGISTS, THEN QUIT IF NOT ONE OF THE SELECTED.
 .I '$D(RARAD("ALL")) Q:'$P(RAP0,U,15)  Q:'$D(RARAD($P(RAP0,U,15)))
 .;---> IF NOT ALL DIAG CODES, THEN QUIT IF NOT ONE OF THE SELECTED.
 .I '$D(RADIAG("ALL")) Q:'$P(RAP0,U,13)  Q:'$D(RADIAG($P(RAP0,U,13)))
 .D SET
 Q
SET ;
 ;---> GET DIVISION SUBSCRIPT.
 S RADIV=$S($D(^RA(79,+$P(RAD0,"^",3),0)):+$P(RAD0,"^",3),1:9999)
 ;---> GET RADIOLOGIST SUBSCRIPT.
 S RARAD="UNKNOWN"
 I $P(RAP0,U,15)]"",$D(^VA(200,$P(RAP0,U,15),0)) S RARAD=$P(^(0),U)
 S RARAD=$E(RARAD,1,30)
 ;---> GET PROCEDURE SUBSCRIPT.
 S RAPRC=$E($P(^RAMIS(71,$P(RAP0,U,2),0),U),1,29)
 ;---> GET PATIENT NAME SUBSCRIPT.
 S RANAME=$P(^DPT(RADFN,0),U)
 ;---> SET ^TMP(NODE=CASE#^CHART#^EXAM STATUS^DIAG CODE
 S X=$P(RAP0,U)_U_$$HRCN^BDGF2(RADFN,DUZ("2"))_U_$P(^RA(72,$P(RAP0,U,3),0),U)
 I $P(RAP0,U,13) S X=X_U_$P(^RA(78.3,$P(RAP0,U,13),0),U)
 S ^TMP($J,"RA",RADIV,RARAD,RAPRC,RANAME,RADTE)=X
 Q
 ;
 ;
SELECT ;EP---> SELECT PROCEDURE(S), RADIOLOGIST(S), DIAGNOSTIC CODE(S).
 K @BRAVAR N DIC,DIR
 W ! S DIR("A")="Include ALL "_BRADIR_"s in this report"
 S DIR(0)="Y",DIR("B")="Y"
 S DIR("?",1)="Answer ""YES"" to print exams for ALL "_BRADIR_"s;"
 S DIR("?")="Answer ""NO"" to select one or more "_BRADIR_"s."
 D ^DIR K DIR
 I $D(DIRUT) S BRAY=0 Q
 ;---> IF ALL ARE SELECTED, QUIT HERE.
 I Y S @(BRAVAR_"(""ALL"")")="",BRAY=1 Q
 ;
 W !!,"Select the "_BRADIR_"(s) you wish to include in this report."
 S DIC(0)="QEMA",DIC=BRADIC
 S DIC("A")="Select "_BRADIR_": "
 S:$D(BRADIC("S")) DIC("S")=BRADIC("S")
 F  D ^DIC Q:Y<0  S @(BRAVAR_"(+Y)")=""
 I '$D(@BRAVAR) W !,"No ",BRADIR,"s selected.",! S BRAY=0 Q
 W !!,"The following ",BRADIR,"s will be included in this report:"
 W ! F I=1:1:48+$L(BRADIR) W "-"
 S N=0 F  S N=$O(@(BRAVAR_"(N)")) Q:'N  D
 .W !?5,$P(@(BRAGBL_"N,0)"),U)
 .I BRAVAR="RAROOM" W " - ",$P(@(BRAGBL_"N,0)"),U,2)
 W ! S DIR(0)="Y",DIR("A")="Is this correct",DIR("B")="Y"
 D ^DIR I $D(DIRUT) S BRAY=0 Q
 I 'Y K @BRAVAR D  G SELECT
 .W "   All ",BRADIR,"s deleted.  Please begin again."
 S BRAY=1
 Q