source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCONS3.m@ 1006

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

initial load of WorldVistAEHR

File size: 5.7 KB
Line 
1GMRCONS3 ;ALB/MRY - Consult Status link report ;4/10/06 14:21
2 ;;3.0;CONSULT/REQUEST TRACKING;**52**;DEC 27, 1997
3NEWSTS ;
4 N TEMPSTAT
5 S TEMPSTAT=GMRCSTAT
6 S GMRCSTAT=$$STS Q:GMRCSTAT=""
7 ;S:$D(GMRCQUT) GMRCSTAT=TEMPSTAT
8 D CT3
9 Q
10STS() ;Select a set of status for view.
11 I $D(IOTM),$D(IOBM),$D(IOSTBM) D FULL^VALM1
12 N DIR,X,Y,GMRCSTCK
13STSAGAIN ;Loop to get another status.
14 S DIR(0)="SAOM^al:All Status's;ap:All Pending;dc:Discont.;c:Completed;p:Pending;a:Active;s:Scheduled;pr:Incomplete;x:Cancelled"
15 S DIR("A")="Only Display Consults With Status of: "
16 S DIR("B")="All Status's"
17 I $D(GMRCSTCK) D
18 . S DIR("A")="Another Status to display: "
19 . K DIR("B")
20 D ^DIR
21 I $D(DUOUT)!($D(DTOUT)) S GMRCQUT=1 G END
22 I '$L(Y) G END
23 D STCK($$LOW^XLFSTR(Y))
24 I $D(GMRCSTCK),GMRCSTCK'="COM,PEN,ACT,SCH,INC,DSC,CAN" G STSAGAIN
25END Q $S($D(GMRCSTCK):GMRCSTCK,1:"")
26 ;
27STCK(RES) ;change code to status
28 N CODE
29 ; al:All Status's;dc:Discont.;c:Completed;h:On Hold;f:Flagged;p:Pending;a:Active;e:Expired;s:Scheduled
30 ;;pr:Incomplete;d:Delayed;u:Unreleased;dce:Discont/Ed;x:Cancelled;l:Lapsed;rn:Renewed;':No Status")
31CASE ;
32 I RES="al" S GMRCSTCK="COM,PEN,ACT,SCH,INC,DSC,CAN" Q ;All Status's
33 ; display no. file name file abbr.
34 I RES="ap" D Q
35 .F CODE="PEN","ACT","SCH","INC" D CKCODE(CODE) ; All Pending Statuses
36 I RES="dc" D CKCODE("DSC") Q ; Discont. 1 DISCONTINUED dc
37 I RES="c" D CKCODE("COM") Q ; Completed 2 COMPLETE c
38 I RES="p" D CKCODE("PEN") Q ; Pending 5 PENDING p
39 I RES="a" D CKCODE("ACT") Q ; Active 6 ACTIVE a
40 I RES="s" D CKCODE("SCH") Q ; Scheduled 8 SCHEDULED s
41 I RES="pr" D CKCODE("INC") Q ; Incomplete 9 PARTIAL RESULTS pr
42 I RES="x" D CKCODE("CAN") Q ; Cancelled 13 CANCELLED x
43ENDCASE Q
44 ;
45CKCODE(CODE) ;
46 I $D(GMRCSTCK),$$FND(CODE) W $C(7),!,"Already selected" Q
47 ;I +$G(GMRCSTCK) S GMRCSTCK=GMRCSTCK_","_CODE
48 ;I $G(GMRCSTCK) S GMRCSTCK=GMRCSTCK_","_CODE
49 I $D(GMRCSTCK) S GMRCSTCK=GMRCSTCK_","_CODE
50 E S GMRCSTCK=CODE
51 Q
52 ;
53FND(CD) ;status already selected?
54 I GMRCSTCK=CD Q 1
55 I $F(GMRCSTCK,(CD_",")) Q 1
56 I $E(GMRCSTCK,$L(GMRCSTCK))=CD Q 1
57 Q 0
58 ;
59NUMBER ;
60 I GMRCCTRL'=120 S GMRCCTRL=120
61 E S GMRCCTRL=0
62 Q
63 ;
64SUMARY ;
65 ;;ACTERAP;Active, By Admin;Active, Edit Re-submit Admin Purpose
66 ;;ACTERCC;Active, Can By Clinic;Active, Edit Re-submit, Cancel by Clinic
67 ;;ACTERCP;Active, Can By Patient;Active, Edit Re-submit, Cancel by Patient
68 ;;ACTERNS;Active, No-Show;Active, Edit Re-submit, No Show
69 ;;ACTEROW;Active, Edit Resubmit;Active, Edit Re-submit, Old Way
70 ;;ACTWOLHNWL;Active, Manually;Active, Without Link History
71 ;;ACTWOLHWL;Active, EWL;Active, Without Link History
72 ;;ACTWOLHIFC;Active, IFC;Active, Without Link History
73 ;;CANCELED;Cancelled;Cancelled
74 ;;COMPLETE;Completed;Completed
75 ;;DSCNTUED;Discontinued;Discontinued
76 ;;INCMPLTE;Incomplete;Incomplete
77 ;;PENNWL;Pending;Pending
78 ;;PENWL;Pending, EWL;Pending, Electronic Wait List
79 ;;SCHWALCO;Sch, Linked, Ck'd Out;Scheduled, Linked, Checked Out;1
80 ;;SCHWALNCO;Scheduled, Linked;Scheduled, Linked;1
81 ;;SCHWHNAL;Sch, Not Linked now;Scheduled, Not Linked
82 ;;SCHWOLHNWL;Sch, Never Linked;Scheduled, Without Link History
83 ;;SCHWOLHWL;Schedule, EWL;Scheduled, Without Link history, wait listed
84 ;;SCHWOLHIFC;Schedule, IFC;Scheduled, Without Link history, interfacility consult
85 ;;TOC;Total Open Consults;Total Open Consults
86 ;;TCC;Total Closed Consults;Total Closed Consults
87 ;;
88CT3 ;print clinic summary
89 D WAIT^DICD K ^TMP("GMRCR",$J)
90 S LN=0,A="" F S A=$O(^TMP($J,"B",A)) Q:A="" D
91 .K SUM S HDR="",B="" F S B=$O(^TMP($J,"B",A,B)) Q:B="" D:GMRCSTAT[$E(B,1,3)
92 ..I $D(HDR) D HEADER K HDR
93 ..S SUM(B)=^TMP($J,"B",A,B)
94 ..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
95 ...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
96 ....I P6=1 I $D(^SC("AWAS1",CNSLT)) D
97 .....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)
98 .....S Y=SDAPT D DD^%DT S SDAPTIM=$E($P(Y,"@",2),1,5)
99 ....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)
100 ....D:P6=1 D SETNOD
101 .....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)
102 .I $D(SUM) S SETNOD=" " D SETNOD D S SETNOD=" " D SETNOD S SETNOD=" " D SETNOD
103 ..S I="" F S I=$O(SUM(I)) Q:I="" F II=1:1 S SM=$T(SUMARY+II) S PC3=$P(SM,";",3) Q:PC3="" I I=PC3 S SETNOD=$$SPC(" ",6),SETNOD=SETNOD_$$SPC(SUM(I),6),SETNOD=SETNOD_$P(SM,";",4) D SETNOD Q
104 Q
105HEADER ;
106 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
107 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)
108 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
109 Q
110SETNOD ;
111 S LN=LN+1,^TMP("GMRCR",$J,"CP",LN,0)=SETNOD,SPC="",VALMCNT=LN
112 Q
113SPC(DATA,COL) ;
114 N SPC S SPC=DATA,L2=COL,L1=$L(DATA) F L3=1:1:(L2-L1) S SPC=SPC_" "
115 Q SPC
116 Q
Note: See TracBrowser for help on using the repository browser.