source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RADLQ1.m@ 1378

Last change on this file since 1378 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.0 KB
Line 
1RADLQ1 ;HISC/GJC AISC/MJK,RMO-Delq Status/Incomplete Rpt's ;10/30/97 15:02
2 ;;5.0;Radiology/Nuclear Medicine;**15**;Mar 16, 1998
3 ;'RALL' will be defined in the entry action of RA INCOMPLETE
4 I $D(DUZ),($O(RACCESS(DUZ,""))']"") D CHECK^RADLQ3(DUZ)
5 S X=$$DIVLOC^RAUTL7() K ^TMP($J,"RADLQ")
6 I X K:$D(RAPSTX) RAPSTX K RAQUIT,X,I,POP Q ; Selection process aborted.
7 S INVMAXDT=9999999.9999,RAXIT=0
8 S RAHD(0)=$S($D(RALL):"Incomplete Exam",1:"Delinquent Status")
9 S RAHD(0)=RAHD(0)_" Report" W @IOF,!?(IOM-$L(RAHD(0))\2),RAHD(0)
10 D DISPXAM^RADLQ3 ; Display xam statuses
11 I RAXIT D EXIT^RADLQ3 Q
12DEV D DATE^RAUTL I RAPOP D EXIT^RADLQ3 Q ; Quit if device not selected
13 S RABEG=INVMAXDT-ENDDATE,RAEND=INVMAXDT-BEGDATE K DIR,X,Y
14 S DIR(0)="SO^I:INPATIENT;O:OUTPATIENT;B:BOTH"
15 S DIR("?",1)="This report can be broken out by"
16 S DIR("?")="Outpatient, Inpatient, or Both."
17 S DIR("A")="Report to include" D ^DIR K DIR
18 I $D(DIRUT) D EXIT^RADLQ3 Q
19 S RASORT1=Y
20 W !!?5,"Now that you have selected ",Y(0)
21 W " do you want to sort by",!?5,"Patient or Date ?" K X,Y
22 S DIR(0)="SO^P:PATIENT;D:DATE"
23 S DIR("?",1)="This allows you the flexibility to further"
24 S DIR("?")="sort the report by Patient or Date." D ^DIR K DIR
25 I $D(DIRUT) D EXIT^RADLQ3 Q
26 S RASORT2=Y D ZEROUT^RADLQ3("RADLQ")
27 I '$D(^TMP($J,"RADLQ")) D EXIT^RADLQ3 Q
28 K RACCESS(DUZ,"DIV-IMG") W !
29 S ZTRTN="START^RADLQ1" S:$D(RALL) ZTSAVE("RALL")=""
30 F RASV="RAHD(","RACRT(","RABEG","RAEND","RASORT1","RASORT2","INVMAXDT","RAXIT","RADIVNM" D
31 . S ZTSAVE(RASV)=""
32 . Q
33 S ZTSAVE("^TMP($J,""RA D-TYPE"",")=""
34 S ZTSAVE("^TMP($J,""RADLQ"",")=""
35 S ZTSAVE("^TMP($J,""RA I-TYPE"",")=""
36 D ZIS^RAUTL I RAPOP D EXIT^RADLQ3 Q
37START ; start processing here
38 U IO S $P(RALN1,"-",(IOM+1))=""
39 S:$D(ZTQUEUED) ZTREQ="@"
40 S $P(RALN2,"=",(IOM+1))="",(RAPG,RASTI)=0
41 F S RASTI=$O(^RADPT("AS",RASTI)) Q:'RASTI D Q:RAXIT
42 . D RADFN:$S($D(RALL):1,$D(RACRT(RASTI)):1,1:0)
43 . Q
44 K RADIV("I") D:'RAXIT PRINT^RADLQ2
45 I 'RAXIT D
46 . S RADIVNM=$$DIVTOT^RACMP("RADLQ") Q:'RADIVNM
47 . S RAXIT=$$EOS^RAUTL5() Q:RAXIT S RAFLAG="" D HDR^RADLQ2
48 . D:'RAXIT LIST^RADLQ3
49 . Q
50 D EXIT^RADLQ3
51 Q
52RADFN ; $ order through rad patients ien's
53 S RADFN=0
54 F S RADFN=$O(^RADPT("AS",RASTI,RADFN)) Q:'RADFN D Q:RAXIT
55 . F RADTI=RABEG-1:0 S RADTI=$O(^RADPT("AS",RASTI,RADFN,RADTI)) Q:'RADTI!(RADTI>RAEND) D Q:RAXIT
56 .. S RADTE=INVMAXDT-RADTI D RACNI
57 .. Q
58 . Q
59 Q
60RACNI ; $ order through case #
61 S RACNI=0
62 F S RACNI=$O(^RADPT("AS",RASTI,RADFN,RADTI,RACNI)) Q:'RACNI D SORT Q:RAXIT
63 Q
64SORT ; sort logic
65 S RAREGEX(0)=$G(^RADPT(RADFN,"DT",RADTI,0)) Q:RAREGEX(0)']""
66 S RADIV("I")=+$P(RAREGEX(0),"^",3) Q:RADIV("I")=0
67 S RADIV("I")=$S($D(^RA(79,RADIV("I"),0)):$P(^(0),"^"),1:0)
68 S RADIV=$S($D(^DIC(4,RADIV("I"),0)):$P(^(0),"^"),1:0)
69 Q:'$D(^TMP($J,"RA D-TYPE",RADIV))
70 S RADIV=RADIV("I"),RAPAT(0)=$G(^DPT(RADFN,0))
71 S RANME=$S($P(RAPAT(0),"^")]"":$P(RAPAT(0),"^"),1:"Unknown")
72 S RASSN=$$SSN^RAUTL
73 S RAEXAM(0)=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) Q:RAEXAM(0)']""
74 S RAIPHY="Unknown"
75 S:$P(RAEXAM(0),"^",15)]"" RAIPHY=$P($G(^VA(200,+$P(RAEXAM(0),"^",15),0)),"^")
76 S:$P(RAEXAM(0),"^",12)]""&(RAIPHY="Unknown") RAIPHY=$P($G(^VA(200,+$P(RAEXAM(0),"^",12),0)),"^")
77 K RATECH S RATD4=+$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",0))
78 I RATD4 D ; Obtain the first 'tech' encountered
79 . S RATECH=$E($$GET1^DIQ(200,+$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"TC",RATD4,0))_",",.01),1,15)
80 . Q
81 K RATD4 S:'$L($G(RATECH)) RATECH="Unknown"
82 S RACN=+$P(RAEXAM(0),"^"),RAPRC=+$P(RAEXAM(0),"^",2)
83 S RAPRC=$S($D(^RAMIS(71,RAPRC,0)):$P(^(0),"^"),1:"Unknown")
84 S RAST=+$P(RAEXAM(0),"^",3),RADT=$P(RADTE,".")
85 S RAITYPE("I")=$S($D(^RA(72,RAST,0)):+$P(^(0),"^",7),1:0)
86 S RAITYPE=$S($D(^RA(79.2,RAITYPE("I"),0)):$P(^(0),"^"),1:"Unknown")
87 Q:'$D(^TMP($J,"RA I-TYPE",RAITYPE))
88 S:'$D(^RA(72,RAST,0)) RAST="Unknown"
89 S:$D(^RA(72,RAST,0)) RAST=$P(^(0),"^")
90 S RADT=$E(RADT,4,5)_"/"_$E(RADT,6,7)_"/"_$E(RADT,2,3)
91 ; 6th piece: Ward Location <-> 8th piece: Principal Clinic
92 ; 9th piece: Contact/Sharing Source <-> 17th piece: Report Text
93 F RA=6,8,9,17 S RA(RA)=+$P(RAEXAM(0),"^",RA)
94 S RA("R")=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"R"))
95 S RAWHE=$S($D(^DIC(42,RA(6),0)):$P(^(0),"^"),$D(^SC(RA(8),0)):$P(^(0),"^"),$D(^DIC(34,RA(9),0)):$P(^(0),"^"),RA("R")]"":RA("R"),1:"Unknown")
96 S RAVAR=$S($D(^DIC(42,RA(6),0)):"I",1:"O")
97 Q:RASORT1'="B"&(RASORT1'=RAVAR)
98 S RARP=$S(+$O(^RARPT(RA(17),"R",0)):"Yes",+$O(^RARPT(RA(17),"I",0)):"Yes",1:"No")
99 S RAVRFIED=$P($G(^RARPT(RA(17),0)),U,5) S RAVRFIED=$S(RAVRFIED="D":"Draft",RAVRFIED="R":"Released",RAVRFIED="PD":"Prb Drft",RAVRFIED="V":"Verified",1:"No Rpt")
100 I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1 Q:RAXIT
101 S ^TMP($J,"RADLQ",RADIV,RAITYPE,RAVAR,$S(RASORT2="P":RANME,1:$P(RADTE,".")),$S(RASORT2="P":$P(RADTE,"."),1:RANME),RACN)=RACN_"^"_RAPRC_"^"_RAST_"^"_RADT_"^"_RAWHE_"^"_RARP_"^"_RASSN_"^"_RAVRFIED_"^"_RAIPHY_"^"_RATECH
102 S ^TMP($J,"RADLQ")=+$G(^TMP($J,"RADLQ"))+1
103 S ^TMP($J,"RADLQ",RADIV)=+$G(^TMP($J,"RADLQ",RADIV))+1
104 S ^TMP($J,"RADLQ",RADIV,RAITYPE)=+$G(^TMP($J,"RADLQ",RADIV,RAITYPE))+1
105 S ^TMP($J,"RADLQ",RADIV,RAITYPE,RAVAR)=+$G(^TMP($J,"RADLQ",RADIV,RAITYPE,RAVAR))+1
106 Q
Note: See TracBrowser for help on using the repository browser.