source: FOIAVistA/trunk/r/ONCOLOGY-ONC/ONCSAPI1.m@ 1754

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1ONCSAPI1 ;Hines OIFO/SG - COLLABORATIVE STAGING (DD TOOLS) ; 12/7/06 9:10am
2 ;;2.11;ONCOLOGY;**40,41,47**;Mar 07, 1995;Build 19
3 ;
4 Q
5 ;
6 ;***** DISPLAYS THE ERRORS
7ERRORS(MODE,ERRCODE) ;
8 S ERRCODE=+$G(ERRCODE)
9 ;--- Display the explanations (for the user)
10 I MODE="HLP" D:(ERRCODE=-10)
11 . D ERROR^ONCSAPIE(-19,"Please try later.")
12 E I MODE="INP" D:(ERRCODE'=-2)
13 . D ERROR^ONCSAPIE(-20,"Please inform IRM about the problem.")
14 E I MODE="CDN" D:(ERRCODE=-10)
15 . D ERROR^ONCSAPIE(-21,"Please try later.")
16 ;--- Display the error stack (for the IRM)
17 D PRTERRS^ONCSAPIE()
18 Q
19 ;
20 ;***** DISPLAYS THE HELP FOR A FIELD
21 ;
22 ; TABLE Table number (see the ^ONCSAPI routine)
23 ;
24 ; [IEN] IEN of the record in the file #165.5
25 ;
26 ; [SITE] Primary site
27 ; [HIST] Histology
28 ;
29 ; Either the IEN or both the SITE and HIST must be provided.
30 ;
31HELP(TABLE,IEN,SITE,HIST) ;
32 N EXIT,I,MNL,NODE,NOTE,ONCMSG,ONCSAPI,RC,ROW,SHNS,TBLIEN,TMP
33 S SHNS=$S($G(X)="":1,1:X="??")
34 D CLEAR^ONCSAPIE(1)
35 D:$G(IEN)>0
36 . S SITE=$TR($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
37 . S HIST=$$HIST^ONCFUNC(IEN)
38 I ($G(SITE)="")&($G(HIST)="") D Q
39 . S TMP=""
40 . S:$D(IEN)#10 TMP=TMP_", IEN="_IEN
41 . S:$D(SITE)#10 TMP=TMP_", SITE="_SITE
42 . S:$D(HIST)#10 TMP=TMP_", HIST="_HIST
43 . S TMP=$P(TMP,", ",2,999)
44 . D PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,TMP,"IEN, SITE, HIST"))
45 ;---
46 L +^XTMP("ONCSAPI","TABLES","JOB",$J):5 E D Q
47 . D ERROR^ONCSAPIE(-15,,"access control node")
48 . D ERRORS("HLP")
49 ;
50 S RC=0 D
51 . ;--- Get the table IEN
52 . S TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
53 . I TBLIEN<0 S RC=TBLIEN Q
54 . ;--- Initialize constants and variables
55 . S NODE=$NA(^XTMP("ONCSAPI","TABLES",TBLIEN))
56 . S MNL=$S($G(IOSL)>3:IOSL-3,1:20),$Y=0
57 . ;--- Display the title and optional subtitle
58 . S TMP=$G(@NODE@(0))
59 . D WW^ONCSAPIU($P(TMP,U,5))
60 . D:$P(TMP,U,6)'="" WW^ONCSAPIU($P(TMP,U,6))
61 . ;--- Display top notes
62 . I SHNS D I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
63 . . S (EXIT,NOTE)=0
64 . . F S NOTE=$O(@NODE@("TN",NOTE)) Q:NOTE'>0 D Q:EXIT
65 . . . D EN^DDIOL(" ")
66 . . . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
67 . . . S I=0
68 . . . F S I=$O(@NODE@("TN",NOTE,I)) Q:I'>0 D Q:EXIT
69 . . . . D EN^DDIOL(@NODE@("TN",NOTE,I))
70 . . . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
71 . ;--- Display the table
72 . D EN^DDIOL(" ")
73 . S (EXIT,ROW)=0
74 . F S ROW=$O(@NODE@(ROW)) Q:ROW'>0 D Q:EXIT
75 . . D EN^DDIOL($J($P(@NODE@(ROW,1),U),7))
76 . . D:$D(@NODE@(ROW,3,1)) EN^DDIOL(@NODE@(ROW,3,1),,"?9")
77 . . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
78 . . S I=1
79 . . F S I=$O(@NODE@(ROW,3,I)) Q:I="" D Q:EXIT
80 . . . D EN^DDIOL(@NODE@(ROW,3,I),,"!?9")
81 . . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
82 . ;--- Display footnotes
83 . I SHNS D I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
84 . . S (EXIT,NOTE)=0
85 . . F S NOTE=$O(@NODE@("FN",NOTE)) Q:NOTE'>0 D Q:EXIT
86 . . . D EN^DDIOL(" ")
87 . . . I $Y'<MNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
88 . . . S I=0
89 . . . F S I=$O(@NODE@("FN",NOTE,I)) Q:I'>0 D Q:EXIT
90 . . . . D EN^DDIOL(@NODE@("FN",NOTE,I))
91 . . . . S:$Y'<MNL EXIT=$$PAGE^ONCSAPIU()
92 . . D EN^DDIOL(" ")
93 ;
94 L -^XTMP("ONCSAPI","TABLES","JOB",$J)
95 D:RC<0 ERRORS("HLP",RC)
96 Q
97 ;
98 ;***** VALIDATES AND TRANSFORMS THE INPUT (CODES)
99 ;
100 ; X Input value should be assigned to the X local
101 ; variable before calling this procedure. The
102 ; variable is KILL'ed if it has an invalid value.
103 ;
104 ; TABLE Table number (see the ^ONCSAPI routine)
105 ;
106 ; CODELEN Valid length of the code
107 ;
108 ; [IEN] IEN of the record in the file #165.5
109 ;
110 ; [SITE] Primary site
111 ; [HIST] Histology
112 ;
113 ; [SILENT] Silent mode flags (can be combined):
114 ; D Do not display code description
115 ; E Do not display error messages
116 ;
117 ; Either the IEN or both the SITE and HIST must be provided.
118 ;
119INPUT(TABLE,CODELEN,IEN,SITE,HIST,SILENT) ;
120 N CODE,ONCBUF,ONCSAPI,RC,TBLIEN,TMP
121 S X=$$TRIM^XLFSTR($G(X))
122 I X'?@(CODELEN_"N") K X Q
123 S:'($D(SILENT)#10) SILENT=$S($G(DIUTIL)="VERIFY FIELDS":"DE",1:"")
124 D CLEAR^ONCSAPIE(1)
125 ;---
126 D:$G(IEN)>0
127 . S SITE=$TR($$GET1^DIQ(165.5,IEN,20.1,,,"ONCMSG"),".")
128 . S HIST=$$HIST^ONCFUNC(IEN)
129 I ($G(SITE)="")&($G(HIST)="") D K X Q
130 . D PRTERRS^ONCSAPIE($$ERROR^ONCSAPIE(-16,,"IEN, SITE, HIST"))
131 ;---
132 L +^XTMP("ONCSAPI","TABLES","JOB",$J):5 E D K X Q
133 . D ERROR^ONCSAPIE(-15,,"access control node")
134 . D ERRORS("INP")
135 ;
136 S RC=0 D
137 . ;--- Get the table IEN
138 . S TBLIEN=$$GETCSTBL^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE)
139 . I TBLIEN<0 S RC=TBLIEN Q
140 . ;--- Check the single code
141 . S CODE=+$G(X)
142 . Q:$D(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE))
143 . ;--- Check the interval
144 . S TMP=$O(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",CODE),-1)
145 . I TMP'="" D Q:CODE'>$P(TMP,U,2)
146 . . S TMP=$G(^XTMP("ONCSAPI","TABLES",TBLIEN,"C",TMP))
147 . ;--- Invalid value
148 . K X
149 ;
150 I $D(X)&(RC'<0) D:SILENT'["D"
151 . Q:$$CODEDESC^ONCSAPIT(.ONCSAPI,SITE,HIST,TABLE,X,"ONCBUF")<0
152 . S TMP=""
153 . F S TMP=$O(ONCBUF(TMP)) Q:TMP="" S ONCBUF(TMP,"F")="!?2"
154 . D EN^DDIOL(.ONCBUF),EN^DDIOL(" ")
155 ;
156 L -^XTMP("ONCSAPI","TABLES","JOB",$J)
157 I RC<0 D:SILENT'["E" ERRORS("INP",RC) K X
158 Q
Note: See TracBrowser for help on using the repository browser.