source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMOUTU.m@ 1608

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1PXRMOUTU ; SLC/PKR - Utilites for preparing output. ;10/25/2004
2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
3 ;
4 ;==================================================
5ADDTXT(LM,RM,NTXT,TXT) ;
6 N IND,NOUT,TEXTOUT
7 D FORMATS^PXRMTEXT(LM,RM,.TXT,.NOUT,.TEXTOUT)
8 F IND=1:1:NOUT S NTXT=NTXT+1,^TMP("PXRHM",$J,PXRMITEM,PXRMRNAM,"TXT",NTXT)=TEXTOUT(IND)
9 Q
10 ;
11 ;==================================================
12ADDTXTA(LM,RM,NTXT,NLINES,TXTA) ;Add an array of text.
13 I NLINES=0 Q
14 N IND,NOUT,TEXTOUT
15 D FORMAT^PXRMTEXT(LM,RM,NLINES,.TXTA,.NOUT,.TEXTOUT)
16 F IND=1:1:NOUT S NTXT=NTXT+1,^TMP("PXRHM",$J,PXRMITEM,PXRMRNAM,"TXT",NTXT)=TEXTOUT(IND)
17 Q
18 ;
19 ;==================================================
20COPYTXT(NTXT,NLINES,TEXT) ;Copy NLINES of TEXT into ^TMP output.
21 N IND
22 F IND=1:1:NLINES S NTXT=NTXT+1,^TMP("PXRHM",$J,PXRMITEM,PXRMRNAM,"TXT",NTXT)=TEXT(IND)
23 Q
24 ;
25 ;==================================================
26FERROR(NTXT) ; Check for a fatal error and output a message.
27 I '$D(^TMP(PXRMPID,$J,PXRMITEM,"FERROR")) Q 0
28 N ERROR,TEXT
29 ;Error trap
30 I $D(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","ERROR TRAP")) D
31 . S TEXT="There was an error processing this reminder. It could not be properly evaluated; please notify your Clinical Reminder coordinator."
32 . D ADDTXT(1,PXRMRM,.NTXT,TEXT)
33 ;
34 ;Reminder errors
35 I $D(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","NO REMINDER")) D
36 . S TEXT=^TMP(PXRMPID,$J,PXRMITEM,"FERROR","NO REMINDER")
37 . D ADDTXT(1,PXRMRM,.NTXT,TEXT)
38 ;
39 ;Expanded taxonomy errors
40 I $D(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","EXPANDED TAXONOMY")) D
41 . S ERROR=$O(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","EXPANDED TAXONOMY",""))
42 . I ERROR="NO LOCK" S TEXT="Could not get a lock for expanded taxonomy "_+PXRMXTLK_", try again!"
43 . D ADDTXT(1,PXRMRM,.NTXT,TEXT)
44 ;
45 ;Patient errors
46 I $D(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","PATIENT")) D
47 . S ERROR=$O(^TMP(PXRMPID,$J,PXRMITEM,"FERROR","PATIENT",""))
48 . I ERROR="NOPAT" S TEXT=^TMP(PXRMPID,$J,PXRMITEM,"FERROR","PATIENT","NOPAT")
49 . I ERROR="NO LOCK" S TEXT="Could not get a lock for patient "_PXRMPDEM("DFN")_", try again!"
50 . D ADDTXT(1,PXRMRM,.NTXT,TEXT)
51 Q 1
52 ;
53 ;==================================================
54INFO(PXRMITEM,NTXT) ;Output INFO text. An INFO node has the structure:
55 ;(PXRMPID,$J,PXRMITEM,"INFO",DESCRIPTION)=TEXT
56 I '$D(^TMP(PXRMPID,$J,PXRMITEM,"INFO")) Q
57 N DES,TEXT
58 S TEXT="Information about the reminder evaluation:"
59 D ADDTXT(1,PXRMRM,.NTXT,TEXT)
60 S DES=""
61 F S DES=$O(^TMP(PXRMPID,$J,PXRMITEM,"INFO",DES)) Q:DES="" D
62 . S TEXT=^TMP(PXRMPID,$J,PXRMITEM,"INFO",DES)
63 . D ADDTXT(2,PXRMRM,.NTXT,TEXT)
64 Q
65 ;
66 ;==================================================
67WARN(PXRMITEM,PXRMPDEM) ;Output WARNING text. An WARN node has the structure:
68 ;(PXRMPID,$J,PXRMITEM,"WARN",DESCRIPTION)=TEXT
69 I '$D(^TMP(PXRMPID,$J,PXRMITEM,"WARN")) Q
70 N DES,NL,REMINDER,SUB
71 K ^TMP("PXRMXMZ",$J)
72 S SUB="Reminder evaluation warnings"
73 S REMINDER=$S($G(PXRMITEM)>0:$P(^PXD(811.9,PXRMITEM,0),U,1),1:"?")
74 S ^TMP("PXRMXMZ",$J,1,0)="The following warnings were encountered:",NL=1
75 S DES=""
76 F S DES=$O(^TMP(PXRMPID,$J,PXRMITEM,"WARN",DES)) Q:DES="" D
77 . S TEXT=^TMP(PXRMPID,$J,PXRMITEM,"WARN",DES)
78 . S NL=NL+1 S ^TMP("PXRMXMZ",$J,NL,0)=" "_^TMP(PXRMPID,$J,PXRMITEM,"WARN",DES)
79 S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="While evaluating reminder "_REMINDER
80 S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="For patient DFN="_PXRMPDEM("DFN")
81 S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)="The time of the evaluation was "_$$FMTE^XLFDT($$NOW^XLFDT,"5Z")
82 D SEND^PXRMMSG(SUB)
83 K ^TMP("PXRMXMZ",$J)
84 Q
85 ;
Note: See TracBrowser for help on using the repository browser.