source: cprs/branches/tmg-cprs/m_files/TMGRPCSR.m@ 949

Last change on this file since 949 was 894, checked in by Kevin Toppenberg, 14 years ago

interval update

File size: 10.5 KB
RevLine 
[796]1TMGRPCSR ;TMG/kst/RPC entry points for Search API ; 6/4/10
2 ;;1.0;TMG-LIB;**1**;05/25/10
3 ;
4 ;"RPC ENTRY POINTS FOR TMG FILEMAN SEARCH API
5 ;
6 ;"Copyright Kevin Toppenberg MD 5/25/10
7 ;"Released under GNU General Public License (GPL)
8 ;"
9 ;"NOTE: this function depends on new version of LIST^DIC, from G. Timpson Patch
10 ;"=======================================================================
11 ;" RPC -- Public Functions.
12 ;"=======================================================================
13 ;"CHANNEL(TMGRESULT,INPUT) -- general purpose channel RPC from a GUI config program
14 ;"LAUNCH(OUT,FILENUM,SRCHSTR) -- launch background search thread, return JOB #
15 ;"STATUS(OUT,JOBNUM) --Return status of background job.
16 ;"RESULTS(OUT,JOBNUM) -- Return results from background search job.
17 ;"
18 ;"=======================================================================
19 ;"PRIVATE API FUNCTIONS
20 ;"=======================================================================
21 ;"
22 ;"=======================================================================
23 ;"=======================================================================
24 ;"Dependencies:
25 ;" ^XLFSTR, ^TMGRPCS0, TMGSRCH1, TMGRPC1B
26 ;"=======================================================================
27 ;"=======================================================================
28 ;
29CHANNEL(TMGRESULT,INPUT) ;
[894]30 ;"Purpose: This will be a general purpose channel RPC from CPRS
[796]31 ;"Input: TMGRESULT -- this is an OUT parameter, and it is always passed by reference
32 ;" INPUT -- this will be array of data sent from the GUI client. Defined below:
33 ;" <Stuff will go here>
34 ;" INPUT("REQUEST")="cmd^params" Valid values for "cmd" are:
35 ;" "LAUNCH" -- Start background task for search
36 ;" params: FileNumber^SearchString <-- See docs for Search String in TMGSRCH.m
37 ;" "STATUS" -- Get status of background task
38 ;" params: JobNumber
39 ;" "IEN LIST" ; was RESULTS
40 ;" params: JobNumber^Fields
41 ;" NOTE: If Fields left blank, then NO FIELDS is assumed
42 ;" "IEN DETAILS" -- Get details of 1 IEN entry
43 ;" params: JobNumber^IEN
44 ;" "PREP SUBSET"
45 ;" params: JobNumber^[Field[;FLD[;FLD...]]]
46 ;" Field -- The desired field number(s).
47 ;" OPTIONAL. DEFAULT is .01
48 ;" If more than one supplied, then output is
49 ;" concatinated. Separate fieldnumbers with ';'
50 ;" "CLEAR" -- clear results from last search.
51 ;" params: JobNumber
52 ;" "ALLOWED FILES ENTRY SUBSET" -- get sublist of list .01 fields for allowed files (those pointing into FileNum)
53 ;" params: FileNum^ListStartValue^direction^MaxCount(optional, def=44)^Simple
54 ;" "FIELD LIST SUBSET" -- get sublist of fields names in file
55 ;" params: FileNum^ListStartValue^direction^MaxCount(optional, def=44)^Simple
56 ;" "RESULTS LIST SUBSET" -- get sublist of search results
57 ;" params: JobNum^ListStartValue^direction^MaxCount(optional, def=44)
[894]58 ;" =================================================================================
59 ;" == Calls for searching TIU DOCUMENTS ==
60 ;" =================================================================================
61 ;" "PT DOCS SEARCH" -- launch a background search in documents for 1 patient
62 ;" params: PatientEIN^SearchString
63 ;" "PT DOCS STATUS" -- Get status of background search
64 ;" params : none
65 ;" "PT DOCS GET RESULTS" -- get result from background search
66 ;" params : none
67 ;" "PT DOCS CLEAR" -- Tell background task to stop, and clear data array
68 ;" params : none
69 ;" "PT DOCS STOP" -- Tell background task to stop searching
70 ;" params : none
71 ;" "PT DOCS CHANGE SEARCH" -- tell background task to change search parameters
72 ;" Note: this can be used to allow the search to begin while the
73 ;" user is still entering the search terms. If the new search is just an
74 ;" extension to the prior search, then the prior search will be added on
75 ;" rather than starting over.
76 ;" params: PatientEIN^SearchString
77 ;" "PT DOCS PREP FOR SUBSET" -- Prep for Subset of List for TORCombobox
78 ;" params : none
79 ;" "PT DOCS SUBSET OF RESULTS" -- Get a subset of list for TORCombobox
80 ;" params : StartFrom^Direction^MaxCount
81 ;" Direction and Maxcount are optional, def=1, 44 respectively
82 ;" =================================================================================
[796]83 ;"Output: results of this function should be put into TMGRESULTS array.
84 ;" For cmd:
85 ;" "LAUNCH"
86 ;" TMGRESULT(0)=1^JobNumber
87 ;" "STATUS"
88 ;" TMGRESULT(0)=1^%Done^Message. <-- Will be '1^100^#DONE#' when task is done.
89 ;" "IEN LIST"
90 ;" TMGRESULT(0)=1 if Success or -1^Message"
91 ;" TMGRESULT(1)=IEN^[Fld Value] <-- Field value returned, if requested
92 ;" TMGRESULT(2)=IEN^[Fld Value]
93 ;" etc ...
94 ;" "PREP SUBSET"
95 ;" TMGRESULT(0)=1^Success or -1^Message
96 ;" "CLEAR"
97 ;" TMGRESULT(0)=1^Success
98 ;" "ALLOWED FILES ENTRY SUBSET"
99 ;" TMGRESULT(0)="1^Success" or "-1^Message"
100 ;" TMGRESULT(1)=FileNum^FileName
101 ;" TMGRESULT(2)=FileNum^FileName
102 ;" etc ...
103 ;" "FIELD LIST SUBSET"
104 ;" TMGRESULT(0)="1^Success" or "-1^Message"
105 ;" TMGRESULT(1)=FLDNum^Name^Info
106 ;" TMGRESULT(2)=FLDNum^Name^Info
107 ;" etc ...
108 ;" "RESULTS LIST SUBSET"
109 ;" TMGRESULT(0)="1^Success" or "-1^Message"
110 ;" TMGRESULT(1)=IENNum^RequestedFieldNames
111 ;" TMGRESULT(2)=IENNum^RequestedFieldNames
112 ;" etc ...
[894]113 ;" =================================================================================
114 ;" == Calls for searching TIU DOCUMENTS ==
115 ;" =================================================================================
116 ;" "PT DOCS SEARCH"
117 ;" TMGRESULT(0)="1^Success", OR -1^ErrorMsg
118 ;" "PT DOCS STATUS"
119 ;" TMGRESULT(0)="1^Status" or -1^ErrorMessage
120 ;" NOTe: will return 1^DONE when done with search.
121 ;" "PT DOCS GET RESULTS"
122 ;" TMGRESULT(0)=FoundCount^Success, or -1^Message
123 ;" TMGRESULT(1)=IEN1
124 ;" TMGRESULT(2)=IEN2 ... etc.
125 ;" "PT DOCS CLEAR"
126 ;" TMGRESULT(0)="1^Success
127 ;" "PT DOCS STOP"
128 ;" TMGRESULT(0)="1^Success
129 ;" "PT DOCS PREP FOR SUBSET"
130 ;" TMGRESULT(0)="1^Success", OR -1^ErrorMsg
131 ;" "PT DOCS SUBSET OF RESULTS"
132 ;" TMGRESULT(0)="1^Success" or "-1^Message"
133 ;" TMGRESULT(1)=IEN^ANoteIdentifier
134 ;" TMGRESULT(2)=IEN^ANoteIdentifier
135 ;" =================================================================================
[796]136 ;"Result: none
137 ;
138 NEW TMGCOMMAND,TMGCOMMAND
139 SET TMGCOMMAND=$$TRIM^XLFSTR($$UP^XLFSTR($PIECE($GET(INPUT("REQUEST")),"^",1)))
140 SET TMGPARAMS=$$UP^XLFSTR($PIECE($GET(INPUT("REQUEST")),"^",2,199))
141 ;
142 ;"MERGE ^TMG("TMP","RPC","TMGRPCSR",$H,"TMGCOMMAND")=TMGCOMMAND
143 ;"MERGE ^TMG("TMP","RPC","TMGRPCSR",$H,"TMGPARAMS")=TMGPARAMS
144 ;
145 SET TMGRESULT(0)="-1^No command requested." ;"default to error state.
146 IF TMGCOMMAND="LAUNCH" DO
147 . DO LAUNCH^TMGRPCS0(.TMGRESULT,TMGPARAMS)
148 IF TMGCOMMAND="STATUS" DO
149 . DO STATUS^TMGRPCS0(.TMGRESULT,TMGPARAMS)
150 ELSE IF TMGCOMMAND="RESULTS" DO
151 . DO IENLIST^TMGRPCS0(.TMGRESULT,TMGPARAMS)
152 ELSE IF TMGCOMMAND="PREP SUBSET" DO
153 . DO PREPSB^TMGRPCS0(.TMGRESULT,TMGPARAMS)
154 ELSE IF TMGCOMMAND="CLEAR" DO
155 . DO CLEAR^TMGRPCS0(.TMGRESULT,TMGPARAMS)
156 ELSE IF TMGCOMMAND="ALLOWED FILES ENTRY SUBSET" DO
157 . DO GETAFSUB^TMGSRCH1(.TMGRESULT,TMGPARAMS)
158 ELSE IF TMGCOMMAND="FIELD LIST SUBSET" DO
159 . DO GETFLDSB^TMGSRCH1(.TMGRESULT,TMGPARAMS)
160 ELSE IF TMGCOMMAND="RESULTS LIST SUBSET" DO
161 . DO GETRSLTSB^TMGRPCS0(.TMGRESULT,TMGPARAMS)
[894]162 ELSE IF TMGCOMMAND="PT DOCS SEARCH" DO
163 . DO PDSRCH^TMGRPCS1(.TMGRESULT,TMGPARAMS)
164 ELSE IF TMGCOMMAND="PT DOCS STATUS" DO
165 . DO PDSTATUS^TMGRPCS1(.TMGRESULT,TMGPARAMS)
166 ELSE IF TMGCOMMAND="PT DOCS GET RESULTS" DO
167 . DO PDRESULT^TMGRPCS1(.TMGRESULT,TMGPARAMS)
168 ELSE IF TMGCOMMAND="PT DOCS CLEAR" DO
169 . DO PDCLEAR^TMGRPCS1(.TMGRESULT,TMGPARAMS)
170 ELSE IF TMGCOMMAND="PT DOCS STOP" DO
171 . DO PDSTOP^TMGRPCS1(.TMGRESULT,TMGPARAMS)
172 ELSE IF TMGCOMMAND="PT DOCS CLEAR" DO
173 . DO PDCLEAR^TMGRPCS1(.TMGRESULT,TMGPARAMS)
174 ELSE IF TMGCOMMAND="PT DOCS PREP FOR SUBSET" DO
175 . DO PDPREPSS^TMGRPCS1(.TMGRESULT,TMGPARAMS)
176 ELSE IF TMGCOMMAND="PT DOCS SUBSET OF RESULTS" DO
177 . DO PDGETSS^TMGRPCS1(.TMGRESULT,TMGPARAMS)
178 ;
[796]179 QUIT
180 ;
181INSTALL ;
182 ;"Purpose: to add the RPC's to the OPTION record OR CPRS GUI CHART
183 DO INSTALL1^TMGRPC1B("TMG SEARCH CHANNEL")
184 QUIT
185 ;
186
Note: See TracBrowser for help on using the repository browser.