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

BRARPT5.m

Go to the documentation of this file.
BRARPT5 ; IHS/ADC/PDW - Radiology Exam Roster by Room, Procedure. ;  
 ;;5.0;Radiology/Nuclear Medicine;;Feb 20, 2004
 ;
 D ^XBKVAR K BRADIC
PROMPT ;
 S:'$D(IOF) IOF="!!"
 W @IOF,!?22 F I=1:1:33 W "-"
 W !?22,"| ***  EXAM ROSTER BY ROOM  *** |"
 W !?22 F I=1:1:33 W "-"
 ;
 ;---> GET DATE RANGE, RETURNS "RABEGDT" AND "RAENDDT".
 D DATE^RAUTL G:RAPOP EXIT
 S RABEGDT=BEGDATE,RAENDDT=ENDDATE
 ;
 S BRAY=0
ROOM ;---> SELECT ROOMS.
 S BRADIR="room",BRAVAR="RAROOM",BRAGBL="^RA(78.6,",BRADIC=78.6
 D SELECT^BRARPT1
 G:'BRAY EXIT
 ;
PROC ;---> SELECT PROCEDURES.
 S BRADIR="procedure",BRADIC=71
 S BRAVAR="RAPRC",BRAGBL="^RAMIS(71,"
 D SELECT^BRARPT1
 G:'BRAY EXIT
 ;
 ;
EXAMS ;---> PROMPT FOR DISPLAYING EACH EXAM.
 W ! S DIR("A")="Do you wish to display each exam"
 S DIR(0)="Y",DIR("B")="Y",RAEX=0
 S X="Answer ""YES"" to display each individual exam under each"
 S DIR("?",1)=X_" Radiology Procedure."
 S DIR("?")="Answer ""NO"" to display only procedures and their totals."
 D ^DIR K DIR,X
 I $D(DIRUT) G EXIT
 I Y S RAEX=1 K Y
 ;
TASKMAN ;---> TASKMAN STUFF.
 S ZTRTN="START^BRARPT5"
 F RASV="RABEGDT","RAENDDT","RAEX","RAPRC(","RAROOM(" 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 ^BRARPT6
 ;
EXIT ;
 K DIC,DIR,DIRUT,I,N,O,P,RAPOP,Q,R,RABEGDT,RACNI,RAD0,RADFN,RADIAG,RADTE
 K RADTI,RAEND,RAENDDT,RAEX,RAMES,RANAME,RAP0,RAPAGE,RAPRC,RARAD,RAROOM
 K RASV,RATECH,BRADIC,BRADIR,BRAGBL,BRAVAR,BRAY
 K ^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 ROOMS, THEN QUIT IF NOT ONE OF THE SELECTED.
 .Q:'$P(RAP0,U,18)  I '$D(RAROOM("ALL"))  Q:'$D(RAROOM($P(RAP0,U,18)))
 .;---> IF NOT ALL PROCEDURES, THEN QUIT IF NOT ONE OF THE SELECTED.
 .I '$D(RAPRC("ALL")) Q:'$P(RAP0,U,2)  Q:'$D(RAPRC($P(RAP0,U,2)))
 .;---> GET PRIMARY TECH.  IF MORE THAN ONE, APPEND "(+)".
 .S T=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",0)) Q:'T  D
 ..S RATECH=$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",T,0),U)
 ..I $O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",T)) S RATECH=RATECH_"(+)"
 .D SET
 Q
SET ;
 ;---> GET DIVISION SUBSCRIPT.
 S RADIV=$S($D(^RA(79,+$P(RAD0,"^",3),0)):+$P(RAD0,"^",3),1:9999)
 ;---> GET ROOM SUBSCRIPT.
 S RAROOM=$P(^RA(78.6,$P(RAP0,U,18),0),U)_" - "_$P(^(0),U,2)
 ;---> 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#^FILM SIZE^TOTAL FILMS^RETAKES
 S X=$P(RAP0,U)_U_$$HRCN^BDGF2(RADFN,DUZ("2"))_U_RATECH
 S ^TMP($J,"RA",RADIV,RAROOM,RAPRC,RANAME,RADTE)=X
 Q