source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCONS2.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 7.7 KB
Line 
1GMRCONS2 ;ALB/MRY - Consult/Scheduling link report ;4/10/06 14:21
2 ;;3.0;CONSULT/REQUEST TRACKING;**52**;DEC 27, 1997
3 ;
4 ;Continued from GMRCONS1
5 D SUMARY,CT,SUMARY2,CT2
6 S SETNOD=" " D SETNOD S SETNOD=" " D SETNOD S SETNOD="End of report." D SETNOD
7 ;
8VALM S VALMHDR(1)="Service: "_SRVNM
9 S SETNOD=$$SPC("Status",21),SETNOD=SETNOD_"Date",SETNOD=$$SPC(SETNOD,31),SETNOD=SETNOD_"SC",SETNOD=$$SPC(SETNOD,36),SETNOD=SETNOD_"L4",SETNOD=$$SPC(SETNOD,41),SETNOD=SETNOD_"Patient",SETNOD=$$SPC(SETNOD,62)
10 S SETNOD=SETNOD_"Appointment",SETNOD=$$SPC(SETNOD,79),SETNOD=SETNOD_"Date/Time",SETNOD=$$SPC(SETNOD,97)
11 D CHGCAP^VALM("CAPTION LINE",SETNOD)
12 Q
13 ;
14SUMARY ;Create the "A" x-ref
15 ;;ACTERAP;Active, By Admin;Active, Edit Re-submit Admin Purpose
16 ;;ACTERCC;Active, Can By Clinic;Active, Edit Re-submit, Cancel by Clinic
17 ;;ACTERCP;Active, Can By Patient;Active, Edit Re-submit, Cancel by Patient
18 ;;ACTERNS;Active, No-Show;Active, Edit Re-submit, No Show
19 ;;ACTEROW;Active, Edit Resubmit;Active, Edit Re-submit, Old Way
20 ;;ACTWOLHNWL;Active, Manually;Active, Without Link History
21 ;;ACTWOLHWL;Active, EWL;Active, Without Link History EWL
22 ;;ACTWOLHIFC;Active, IFC;Active, Without Link History IFC
23 ;;CANCELED;Cancelled;Cancelled
24 ;;COMPLETE;Completed;Completed
25 ;;DSCNTUED;Discontinued;Discontinued
26 ;;INCMPLTE;Incomplete;Incomplete
27 ;;PENNWL;Pending;Pending
28 ;;PENWL;Pending, EWL;Pending, Electronic Wait List
29 ;;SCHWALCO;Sch, Linked, Ck'd Out;Scheduled, Linked, Checked Out;1
30 ;;SCHWALNCO;Scheduled, Linked;Scheduled, Linked;1
31 ;;SCHWHNAL;Sch, Not Linked now;Scheduled, Not Linked
32 ;;SCHWOLHNWL;Sch, Never Linked;Scheduled, Without Link History
33 ;;SCHWOLHWL;Schedule, EWL;Scheduled, Without Link history, wait listed
34 ;;SCHWOLHIFC;Schedule, IFC;Scheduled, Without Link history, interfacility consult
35 ;;TOC;Total Open Consults;Total Open Consults
36 ;;TCC;Total Closed Consults;Total Closed Consults
37 ;;
38 F A=1:1 S B=$T(SUMARY+A) Q:$P(B,";",3)="" S ^TMP($J,"A",$P(B,";",3))=0
39 S ST="" F S ST=$O(^TMP($J,"S",ST)) Q:ST="" D K WL
40 .S AD=0 F S AD=$O(^TMP($J,"S",ST,AD)) Q:'+AD S CS=0 F S CS=$O(^TMP($J,"S",ST,AD,CS)) Q:'+CS S TND=^(CS),PTNM=$P(TND,U),PTIEN=$P(TND,U,2),LSTACT=$P(TND,U,3),AWAS1=$P(TND,U,4),AHST1=$P(TND,U,5),SRV=$P(TND,U,6) D K WL
41 ..S STPCLNC="",SC=0 F S SC=$O(^GMR(123.5,SRV,688,SC)) Q:'+SC S STPCOD=$P(^GMR(123.5,SRV,688,SC,0),U) I STPCOD'="" S STPCLNC=$P(^DIC(40.7,STPCOD,0),U)_","_STPCLNC
42 ..I ST="ACTIVE" D ACTIVE,TOC
43 ..I ST="SCHEDULED" D SCHEDULE,TOC
44 ..I ST="PENDING" D PENDING,TOC
45 ..I ST="PARTIAL RESULTS" D INCMPLTE,KILNODE,TOC
46 ..I ST="CANCELLED" D CANCELED,KILNODE,TCC
47 ..I ST="DISCONTINUED" D DSCNTUED,KILNODE,TCC
48 ..I ST="COMPLETE" D COMPLETE,KILNODE,TCC
49 Q
50ACTIVE D ACTIVE^GMRCONS1 Q
51SCHEDULE D SCHEDULE^GMRCONS1 Q
52PENDING D PENDING^GMRCONS1 Q
53INCMPLTE D INCMPLTE^GMRCONS1 Q
54CANCELED D CANCELED^GMRCONS1 Q
55DSCNTUED D DSCNTUED^GMRCONS1 Q
56COMPLETE D COMPLETE^GMRCONS1 Q
57TOC D TOC^GMRCONS1 Q
58TCC D TCC^GMRCONS1 Q
59KILNODE D KILNODE^GMRCONS1 Q
60 ;
61CT ;whole summary
62 S LN=0,WDTH=102,PG=1,$P(DSH,"=",WDTH)="",FR=$E(PSD,4,5)_"/"_$E(PSD,6,7)_"/"_$E(PSD,2,3),TO=$E(ED,4,5)_"/"_$E(ED,6,7)_"/"_$E(ED,2,3),PD=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
63 S SETNOD="SUMMARY From: "_FR_" To "_TO,SETNOD=$$SPC(SETNOD,93),SETNOD=SETNOD_PD D SETNOD
64 S SETNOD=DSH D SETNOD S SETNOD=" " D SETNOD
65 S PG=PG+1,BB=$O(^TMP($J,"A","")),SUBTOT=0
66 S B="",SUM2=0,SUM=0 F S B=$O(^TMP($J,"A",B)) Q:B="" S TOT=^(B) I TOT'=0 D:B'="COMPLETE"&(B'="CANCELED")&(B'="DSCNTUED")&(B'="TOC")&(B'="TCC")
67 .F TX=1:1 S TEXT=$T(SUMARY+TX),P3=$P(TEXT,";",3) Q:P3="" I P3[B S SUM=SUM+TOT,SUBTOT=SUBTOT+TOT,SETNOD=" "_$J(TOT,6)_" "_$P(TEXT,";",4) D SETNOD Q
68 S SUM2=SUM2+SUM,SETNOD="----------" D SETNOD S SETNOD=$$SPC(" "_$J(SUM,6),12),SETNOD=SETNOD_"Total OPEN consults" D SETNOD S SETNOD=" " D SETNOD
69 S B="",SUM=0 F S B=$O(^TMP($J,"A",B)) Q:B="" S TOT=^(B) I TOT'=0 D:B="COMPLETE"!(B="CANCELED")!(B="DSCNTUED")
70 .F TX=1:1 S TEXT=$T(SUMARY+TX),P3=$P(TEXT,";",3) Q:P3="" I P3[B S SUM=SUM+TOT,SETNOD=" "_$J(TOT,6)_" "_$P(TEXT,";",4) D SETNOD Q
71 S SUM2=SUM2+SUM,SETNOD="----------" D SETNOD S SETNOD=$$SPC(" "_$J(SUM,6),12),SETNOD=SETNOD_"Total CLOSED consults" D SETNOD S SETNOD=" " D SETNOD
72 S SETNOD="==========" D SETNOD S SETNOD=$$SPC(" "_$J(SUM2,6),12),SETNOD=SETNOD_"GRAND TOTAL" D SETNOD S SETNOD=" " D SETNOD
73 Q
74SPC(DATA,COL) ;
75 N SPC S SPC=DATA,L2=COL,L1=$L(DATA) F L3=1:1:(L2-L1) S SPC=SPC_" "
76 Q SPC
77 Q
78SETNOD ;
79 S LN=LN+1,^TMP("GMRCR",$J,"CP",LN,0)=SETNOD,SPC="",VALMCNT=LN
80 Q
81CT2 ;print clinic summary
82 S A="" F S A=$O(^TMP($J,"B",A)) Q:A="" S PG=PG+1 D
83 .S SETNOD=" " D SETNOD
84 .S SETNOD=A_" "_FR_" - "_TO D SETNOD S SETNOD=$$SPC(" ",22),SETNOD=SETNOD_"Consult",SETNOD=$$SPC(SETNOD,63),SETNOD=SETNOD_"Clinic",SETNOD=$$SPC(SETNOD,80),SETNOD=SETNOD_"Appointment",SETNOD=$$SPC(SETNOD,97),SETNOD=SETNOD_"Stop" D SETNOD
85 .S SETNOD=$$SPC("Status",22),SETNOD=SETNOD_"Date",SETNOD=$$SPC(SETNOD,32),SETNOD=SETNOD_"SC",SETNOD=$$SPC(SETNOD,37),SETNOD=SETNOD_"L4",SETNOD=$$SPC(SETNOD,42),SETNOD=SETNOD_"Patient",SETNOD=$$SPC(SETNOD,63)
86 .S SETNOD=SETNOD_"Appointment",SETNOD=$$SPC(SETNOD,80),SETNOD=SETNOD_"Date/time",SETNOD=$$SPC(SETNOD,97),SETNOD=SETNOD_"Code" D SETNOD S SETNOD=DSH D SETNOD
87 .S PG=PG+1,SUM=0,B="" F S B=$O(^TMP($J,"B",A,B)) Q:B="" S TOT=^(B) I TOT'=0 D:B'="COMPLETE"&(B'="CANCELED")&(B'="DSCNTUED")&(B'="TOC")&(B'="TCC")
88 ..S CNSDT=0 F S CNSDT=$O(^TMP($J,"B",A,B,CNSDT)) Q:'+CNSDT S CNSLT=0 F S CNSLT=$O(^TMP($J,"B",A,B,CNSDT,CNSLT)) Q:'+CNSLT S CNSLTND=^(CNSLT),PTNM=$P(CNSLTND,U),PRTCNDT=$E(CNSDT,4,5)_"-"_$E(CNSDT,6,7)_"-"_$E(CNSDT,2,3) D
89 ...F TX=1:1 S TEXT=$T(SUMARY+TX),P3=$P(TEXT,";",3) Q:P3="" I P3[B S P4=$P(TEXT,";",4),P6=$P(TEXT,";",6) D
90 ....I P6=1 I $D(^SC("AWAS1",CNSLT)) D
91 .....S CLINIC=$O(^SC("AWAS1",CNSLT,":"),-1),SDAPT=$O(^SC("AWAS1",CNSLT,CLINIC,":"),-1),STCOD=$P(^SC(CLINIC,0),U,7),STCOD=$P(^DIC(40.7,STCOD,0),U,2),CLINIC=$P(^SC(CLINIC,0),U),SDAPT1=$E(SDAPT,4,5)_"-"_$E(SDAPT,6,7)_"-"_$E(SDAPT,2,3)
92 .....S Y=SDAPT D DD^%DT S SDAPTIM=$E($P(Y,"@",2),1,5)
93 ....S SETNOD=$$SPC(P4,22),SETNOD=SETNOD_PRTCNDT,SETNOD=$$SPC(SETNOD,32),SETNOD=SETNOD_$P(CNSLTND,U,10),SETNOD=$$SPC(SETNOD,37),SETNOD=SETNOD_$P(CNSLTND,U,9),SETNOD=$$SPC(SETNOD,42),SETNOD=SETNOD_$E(PTNM,1,18),SETNOD=$$SPC(SETNOD,63)
94 ....D:P6=1 D SETNOD S SUM=SUM+TOT
95 .....S SETNOD=SETNOD_$E(CLINIC,1,15),SETNOD=$$SPC(SETNOD,80),SETNOD=SETNOD_SDAPT1_" @ "_SDAPTIM,SETNOD=$$SPC(SETNOD,98),SETNOD=SETNOD_$E(STCOD,1,5)
96 .S SETNOD=" " D SETNOD
97 .S BB=$O(^TMP($J,"B",A,"")),SUBTOT=0,SUM2=0,SUM=0,B="" F S B=$O(^TMP($J,"B",A,B)) Q:B="" S TOT=^(B) I TOT'=0 D:B'="COMPLETE"&(B'="CANCELED")&(B'="DSCNTUED")&(B'="TOC")&(B'="TCC")
98 ..F TX=1:1 S TEXT=$T(SUMARY+TX),P3=$P(TEXT,";",3) Q:P3="" I P3[B S SUM=SUM+TOT S SUBTOT=SUBTOT+TOT D
99 ...S SETNOD=" "_$J(TOT,6)_" "_$P(TEXT,";",4) D SETNOD Q
100 .S SUM2=SUM2+SUM,SETNOD="----------" D SETNOD S SETNOD=$$SPC(" "_$J(SUM,6),12),SETNOD=SETNOD_"Total OPEN consults" D SETNOD S SETNOD=" " D SETNOD
101 .S SUM=0,B="" F S B=$O(^TMP($J,"B",A,B)) Q:B="" S TOT=^(B) I TOT'=0 D:B="COMPLETE"!(B="CANCELED")!(B="DSCNTUED")
102 ..F TX=1:1 S TEXT=$T(SUMARY+TX),P3=$P(TEXT,";",3) Q:P3="" I P3[B S SUM=SUM+TOT,SETNOD=" "_$J(TOT,6)_" "_$P(TEXT,";",4) D SETNOD Q
103 .S SUM2=SUM2+SUM,SETNOD="----------" D SETNOD S SETNOD=$$SPC(" "_$J(SUM,6),12),SETNOD=SETNOD_"Total CLOSED consults" D SETNOD
104 .S SETNOD=" " D SETNOD S SETNOD="==========" D SETNOD
105 .S SETNOD=$$SPC(" "_$J(SUM2,6),12),SETNOD=SETNOD_"Total "_A_" consults" D SETNOD S SETNOD=" " D SETNOD
106 Q
107SUMARY2 ;create the "B" x-reference
108 S A="" F S A=$O(^TMP($J,"A",A)) Q:A="" S B=0 F S B=$O(^TMP($J,"A",A,B)) Q:'+B S C=0 F S C=$O(^TMP($J,"A",A,B,C)) Q:'+C S D=0 F S D=$O(^TMP($J,"A",A,B,C,D)) Q:'+D S ND=^(D) D
109 .S CLNCNM=$P(^GMR(123.5,B,0),U) S ^TMP($J,"B",CLNCNM,A,C,D)=ND,^TMP($J,"C",A,CLNCNM,C,D)=ND S:'($D(^TMP($J,"B",CLNCNM,A))#2) ^TMP($J,"B",CLNCNM,A)=0 S ^TMP($J,"B",CLNCNM,A)=^TMP($J,"B",CLNCNM,A)+1
110 Q
Note: See TracBrowser for help on using the repository browser.