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

BRARPT3.m

Go to the documentation of this file.
BRARPT3 ; IHS/ADC/PDW - Radiology Exam Roster by Technologist, Proc. ;  
 ;;5.0;Radiology/Nuclear Medicine;;Feb 20, 2004
 ;
 D ^XBKVAR K BRADIC
PROMPT ;
 S:'$D(IOF) IOF="!!"
 W @IOF,!?19 F I=1:1:40 W "-"
 W !?19,"| ***  FILM USAGE BY TECHNOLOGIST  *** |"
 W !?19 F I=1:1:40 W "-"
 ;
 ;---> GET DATE RANGE, RETURNS "RABEGDT" AND "RAENDDT".
 D DATE^RAUTL G:RAPOP EXIT
 S RABEGDT=BEGDATE,RAENDDT=ENDDATE
 ;
 S BRAY=0
TECH ;---> SELECT TECHNOLOGISTS.
 S BRADIR="technologist",BRAVAR="RATECH",BRAGBL="^VA(200,"
 S BRADIC=200,BRADIC("S")="I $D(^VA(200,""ARC"",""T"",Y))"
 D SELECT^BRARPT1 K BRADIC("S")
 G:'BRAY EXIT
 ;
PROC ;---> SELECT PROCEDURES.
 S BRADIR="procedure",BRADIC=71
 S BRAVAR="RAPRC",BRAGBL="^RAMIS(71,"
 D SELECT^BRARPT1
 G:'BRAY EXIT
 ;
 ;
 ;G TASKMAN
EXAMS ;---> PROMPT FOR DISPLAYING EACH EXAM.
 W ! S DIR("A")="Do you wish to display each exam and film size"
 S DIR(0)="Y",DIR("B")="Y",RAEX=0
 S DIR("?",1)="Answer ""YES"" to display each individual exam and"
 S DIR("?",2)="film size under each 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^BRARPT3"
 F RASV="RABEGDT","RAENDDT","RAEX","RAPRC(","RATECH(" 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 ^BRARPT4
 ;
EXIT ;
 K DIC,DIR,DIRUT,I,K,L,N,O,P,RAPOP,Q,R,RABEGDT,RACNI,RAD0,RADFN,RADIAG
 K RADTE,RADTI,RAEND,RAENDDT,RAEX,RAMES,RANAME,RAP0,RAPAGE,RAPRC,RARAD
 K RASV,RATCH,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 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)))
 .;---> LOOP THROUGH TECHS.
 .N F,T
 .S T=0 F  S T=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",T)) Q:'T  D
 ..S RATECH=$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",T,0),U)
 ..Q:'RATECH  Q:('$D(RATECH(RATECH)))&('$D(RATECH("ALL")))
 ..;---> LOOP THROUGH FILM SIZES.
 ..S F=0 F  S F=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"F",F)) Q:'F  D
 ...S RAFILM0=^RADPT(RADFN,"DT",RADTI,"P",RACNI,"F",F,0),RAFILM=+^(0)
 ...Q:'RAFILM
 ...D SET
 Q
SET ;
 ;---> GET DIVISION SUBSCRIPT.
 S RADIV=$S($D(^RA(79,+$P(RAD0,"^",3),0)):+$P(RAD0,"^",3),1:9999)
 ;---> GET TECHNOLOGIST SUBSCRIPT.
 Q:'$D(^VA(200,RATECH,0))  S RATCH=$E($P(^(0),U),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#^FILM SIZE^TOTAL FILMS^RETAKES
 ;S X=$P(RAP0,U)_U_$$HRCN^BDGF2(RADFN,DUZ("2"))_U_RAFILM
 S X=$P(RAP0,U)_U_$$HRCN^BDGF2(RADFN,DUZ("2"))_U_$P(RAFILM0,U,2)_U_$P(RAFILM0,U,9)
 S ^TMP($J,"RA",RADIV,RATCH,RAPRC,RANAME,RADTE,RAFILM)=X
 Q