source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCSLM3.m@ 1208

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1GMRCSLM3 ;SLC/DCM - Extract medicine results for consult tracking ;7/16/98 02:01
2 ;;3.0;CONSULT/REQUEST TRACKING;**1,4,15**;DEC 27, 1997
3 ;
4 ; This routine invokes IA #615,#3042
5 ;
6EN(GMRCSEL,GMRCSR,COUNT) ;;This entry point is used to collect consult data from the Medicine Package.
7 ;GMRCSR="^MCAR(x," file IEN where result to associate is stored
8 ;in $P(^GMR(123,IEN,0),"^",15)
9 ; 1=Called from RT^GMRCA1 or DT^GMRCSLM2 routine
10 ;Consult/Request Tracking
11 ;GMRCSEL: The IEN of the consult from file 123.
12 ;COUNT: The current position in ^TMP where data is to be placed.
13 D ENDT,EXIT Q
14 ;
15ENDT Q:'$D(GMRCSEL) Q:'$D(GMRCSEL)
16 S ORIFN=$P(^GMR(123,GMRCSEL,0),"^",3),ORACTION=8
17 S ^TMP("GMRCR",$J,"DT",COUNT,0)="",COUNT=COUNT+1
18 S X="MCOR" X ^%ZOSF("TEST") I '$T S ^TMP("GMRCR",$J,"DT",COUNT,0)="Medicine package not installed. Online results are not available.",COUNT=COUNT+1
19 I 'GMRCSR S ^TMP("GMRCR",$J,"DT",COUNT,0)="No Medicine results are available for review",COUNT=COUNT+1 Q
20 N SINGLE
21 S SINGLE=$$SINGLE^MCAPI(GMRCSR)
22 S GMRCRTIT=$P(SINGLE,U)_" SUMMARY REPORT "_$P(SINGLE,U,6)
23 S GMRCH="",$P(GMRCH,"-",(77-$L(GMRCRTIT))\2)=""
24 S ^TMP("GMRCR",$J,"DT",COUNT,0)=GMRCH_" "_GMRCRTIT_" "_GMRCH
25 S COUNT=COUNT+1,^TMP("GMRCR",$J,"DT",COUNT,0)="",COUNT=COUNT+1
26 D PRINT^MCOR I '$D(^TMP("MC",$J)) D
27 . S ^TMP("GMRCR",$J,"DT",COUNT,0)="No results are available for review."
28 . S COUNT=COUNT+1
29 ;GMRCFT=Field Type of D (Diagnosis, I (Indications), S (Summary)
30SET S GMRCFT="D" I $D(^TMP("MC",$J,"D")) D
31 . S ^TMP("GMRCR",$J,"DT",COUNT,0)=$E(TAB,1,34)_"DIAGNOSIS"
32 . S COUNT=COUNT+1
33 . D SETFLD
34 S GMRCFT="I" I $D(^TMP("MC",$J,"I")) D
35 . S ^TMP("GMRCR",$J,"DT",COUNT,0)="",COUNT=COUNT+1
36 . S ^TMP("GMRCR",$J,"DT",COUNT,0)="INDICATIONS:",COUNT=COUNT+1
37 . D SETFLD
38 I $D(^TMP("MC",$J,"S")) D SUM
39 Q
40EXIT K GMRCH,GMRCX,GMRCFT,GMRCFLD,GMRCSUM,GMRCFLDN,GMRCSUMP,GMRCRTIT
41 K GMRCPRNM,GMRCFLDP,MCC,MCK,MCMFLD,MCMUP
42 K ^TMP("MC",$J)
43 Q
44SETFLD S GMRCFLD=0,GMRCFLDP=""
45 F S GMRCFLD=$O(^TMP("MC",$J,GMRCFT,GMRCFLD)) Q:GMRCFLD="" D
46 . S GMRCFLD(0)=^TMP("MC",$J,GMRCFT,GMRCFLD) D
47 .. S GMRCFLDN=$P(GMRCFLD(0),"^",2) Q:GMRCFLDN[";W"
48 .. I GMRCFLDP=GMRCFLDN S COUNT=COUNT-1,^TMP("GMRCR",$J,"DT",COUNT,0)=^TMP("GMRCR",$J,"DT",COUNT,0)_", "
49 .. E S GMRCFLDP=GMRCFLDN,^TMP("GMRCR",$J,"DT",COUNT,0)=GMRCFLDP_":"_$E(TAB,1,18-$L(GMRCFLDP))
50 .. I $L($P(GMRCFLD(0),"^",1))>45 D Q
51 ... S ^TMP("GMRCR",$J,"DT",COUNT,0)=^TMP("GMRCR",$J,"DT",COUNT,0)_$P(GMRCFLD(0),U)
52 ... S COUNT=COUNT+1
53 .. I $L($P(GMRCFLD(0),"^",1))'>77 S ^TMP("GMRCR",$J,"DT",COUNT,0)=^TMP("GMRCR",$J,"DT",COUNT,0)_$P(GMRCFLD(0),"^",1)
54 .. S COUNT=COUNT+1 Q
55 Q
56SUM ;
57 S GMRCSUM=$P(^TMP("MC",$J,"S"),"^",1)
58 S GMRCSUMP=$P(^TMP("MC",$J,"S"),"^",2)
59 I $L(GMRCSUM)!($L(GMRCSUMP)) S ^TMP("GMRCR",$J,"DT",COUNT,0)="SUMMARY:"
60 I $L(GMRCSUM) S ^TMP("GMRCR",$J,"DT",COUNT,0)=^TMP("GMRCR",$J,"DT",COUNT,0)_$E(TAB,1,11)_GMRCSUM,COUNT=COUNT+1
61 I $L(GMRCSUMP) S ^TMP("GMRCR",$J,"DT",COUNT,0)="SUMMARY PROCEDURE: "_GMRCSUMP,COUNT=COUNT+1
62 Q
63AREN(GMRCSEL,GMRCSR,GMRCPROC) ;Entry point for display of Medicine Results when associating a result with a consult - List Manager display set-up.
64 ;GMRCSR=^MCAR(191, file IEN where result to associate is stored
65 ;GMRCSEL=File ^GMR(123, IEN of consult to associate with medicine result
66 ;GMRCPROC=pointer to GMRC PROCEDURE (#123.3) file
67 S COUNT=1,TAB="",TAB=$P(TAB," ",30)
68 S X="MCOR" X ^%ZOSF("TEST") I '$T S ^TMP("GMRCR",$J,"DT",COUNT,0)="Medicine Package is not installed. Online results are not available.",COUNT=COUNT+1 G END
69 I 'GMRCSR S ^TMP("GMRCR",$J,"DT",COUNT,0)="No Medicine results are available for review.",COUNT=COUNT+1
70 S ORIFN=$S($G(GMRCSEL):$P(^GMR(123,+GMRCSEL,0),"^",3),1:0),ORACTION=8
71 S:+GMRCPROC GMRCPRNM=$$GET1^DIQ(697.2,$P(^GMR(123.3,+GMRCPROC,0),U,5),7)
72 S GMRCPRNM=$S($L($G(GMRCPRNM)):GMRCPRNM,1:"ELECTROCARDIOGRAM")
73 I +GMRCSR D PRINT^MCOR I $D(^TMP("MC",$J)) S ^TMP("GMRCR",$J,"DT",COUNT,0)=TAB_"MEDICINE RESULTS",COUNT=COUNT+1,^TMP("GMRCR",$J,"DT",COUNT,0)="",COUNT=COUNT+1 D SET
74 S ^TMP("GMRCR",$J,"DT",COUNT,0)="",COUNT=COUNT+1
75END S GMRCCT=COUNT-1
76 K COUNT,GMRCH,GMRCFT,GMRCFLD,GMRCSUM,GMRCFLDN,GMRCSUMP,GMRCRTIT,GMRCPRNM,GMRCFLDP,MCC,MCK,MCMFLD,MCMUP
77 K ^TMP("MC",$J)
78 Q
Note: See TracBrowser for help on using the repository browser.