summaryrefslogtreecommitdiff
path: root/server/src/luapraxisd.h
blob: 82445e16027a925e8b4a790ef7e36e6a3b0a3c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set et sw=2 ts=2: */
/***************************************************************************
 *            luapraxisd.h
 *
 *  Wed Apr 27 11:59:53 CEST 2011
 *  Copyright 2011 Bent Bisballe Nyeng
 *  deva@aasimon.org
 ****************************************************************************/

/*
 *  This file is part of Pracro.
 *
 *  Pracro is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Pracro is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Pracro; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#ifndef __PRACRO_LUAPRAXISD_H__
#define __PRACRO_LUAPRAXISD_H__

#include <lua.hpp>

/***
 * Praxisd Class
 * @class Praxisd
 * @serverside
 * @clientside
 * The praxisd class connects and handles communication with the praxisd
 * daemon process.
 */

/***
 * @method object Praxisd.new(string host, int port)
 * Create a new Praxisd connection object.
 * @param host The hostname to connect to.
 * @param port The port number to connect to.
 * @return The newly created communication object.
 * @example Create a new praxisd object:
 * px = Praxisd.new('localhost', 10000)
 */
int px_new(lua_State *L);

/***
 * @method stringlist-list praxisd:cavelist()
 * Get server cave list.
 * To retrieve cavelist for a patient see @see praxisd:getcave().
 * @return The complete list of known (possible) cave from the server.
 * The returned stringlist are indexed as follows: 1: cave - 2: bemaerkning1 -
 * 3: bemaerkning2 - 4: bemaerkning3
 * @example Create a new praxisd object, get and print cavelist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:cavelist()
 * for i=0,#lst do
 *   print('cave: ' .. lst[i][1])
 *   print('bemaerkning1: ' .. lst[i][2])
 *   print('bemaerkning2: ' .. lst[i][3])
 *   print('bemaerkning3: ' .. lst[i][4])
 * end
 */
int px_cavelist(lua_State *L);

/***
 * @method stringlist-list praxisd:behandlinglist()
 * Get server behandling list.
 * To retrieve behandlinglist for a patient see @see praxisd:getbehandling().
 * @return The complete list of known (possible) behandling from the server.
 * The returned stringlist are indexed as follows: 1: kode - 2: behandling -
 * 3: bemaerkning - 4: udregning.
 * @example Create a new praxisd object, get and print behandlinglist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:behandlinglist()
 * for i=0,#lst do
 *   print('kode: ' .. lst[i][1])
 *   print('behandling: ' .. lst[i][2])
 *   print('bemaerkning: ' .. lst[i][3])
 *   print('udregning: ' .. lst[i][4])
 * end
 */
int px_behandlinglist(lua_State *L);

/***
 * @method stringlist-list praxisd:diagnoselist()
 * Get server diagnose list.
 * To retrieve diagnoselist for a patient see @see praxisd:getdiagnose().
 * @return The complete list of known (possible) diagnose from the server.
 * The returned stringlist are indexed as follows: 1: kode - 2: diagnose -
 * 3: bemaerkning.
 * @example Create a new praxisd object, get and print diagnoselist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:diagnoselist()
 * for i=0,#lst do
 *   print('kode: ' .. lst[i][1])
 *   print('diagnose: ' .. lst[i][2])
 *   print('bemaerkning: ' .. lst[i][3])
 * end
 */
int px_diagnoselist(lua_State *L);

/***
 * @method stringlist-list praxisd:getcave(string patientid)
 * Get cave list from a patient.
 * To retrieve cavelist from the server see @see praxisd:cavelist(). To add cave
 * to a patient see @see praxisd:addcave().
 * @param patientid A string containing the patientid.
 * @return The list cave registered with the patient.
 * The returned stringlist are indexed as follows: 1: cave - 2: bemaerkning1 -
 * 3: bemaerkning2 - 4: bemaerkning3 - 5: sogetxt - 6: sogedato.
 * @example Create a new praxisd object, get and print cavelist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:getcave('1234567890')
 * for i=0,#lst do
 *   print('cave: ' .. lst[i][1])
 *   print('bemaerkning1: ' .. lst[i][2])
 *   print('bemaerkning2: ' .. lst[i][3])
 *   print('bemaerkning3: ' .. lst[i][4])
 *   print('sogetxt: ' .. lst[i][5])
 *   print('sogedato: ' .. lst[i][6])
 * end
 */
int px_getcave(lua_State *L);

/***
 * @method stringlist-list praxisd:getbehandling(string patientid)
 * Get behandling list from a patient.
 * To retrieve behandlinglist from the server see @see praxisd:behandlinglist(). To add behandling
 * to a patient see @see praxisd:addbehandling().
 * @param patientid A string containing the patientid.
 * @return The list behandling registered with the patient.
 * The returned stringlist are indexed as follows: 1: kode - 2: behandling -
 * 3: bemaerkning - 4: udregning - 5: sogetxt - 6: sogedato.
 * @example Create a new praxisd object, get and print behandlinglist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:getbehandling('1234567890')
 * for i=0,#lst do
 *   print('kode: ' .. lst[i][1])
 *   print('behandling: ' .. lst[i][2])
 *   print('bemaerkning: ' .. lst[i][3])
 *   print('udregning: ' .. lst[i][4])
 *   print('sogetxt: ' .. lst[i][5])
 *   print('sogedato: ' .. lst[i][6])
 * end
 */
int px_getbehandling(lua_State *L);

/***
 * @method stringlist-list praxisd:getdiagnose(string patientid)
 * Get diagnose list from a patient.
 * To retrieve diagnoselist from the server see @see praxisd:diagnoselist(). To add diagnose
 * to a patient see @see praxisd:adddiagnose().
 * @param patientid A string containing the patientid.
 * @return The list diagnose registered with the patient.
 * The returned stringlist are indexed as follows: 1: kode - 2: diagnose -
 * 3: bemaerkning - 4: sogetxt - 5: sogedato.
 * @example Create a new praxisd object, get and print diagnoselist:
 * px = Praxisd.new('localhost', 10000)
 * lst = px:getdiagnose('1234567890')
 * for i=0,#lst do
 *   print('kode: ' .. lst[i][1])
 *   print('diagnose: ' .. lst[i][2])
 *   print('bemaerkning: ' .. lst[i][3])
 *   print('sogetxt: ' .. lst[i][4])
 *   print('sogedato: ' .. lst[i][5])
 * end
 */
int px_getdiagnose(lua_State *L);

/***
 * @method nil praxisd:addcave(string patientid, string cave, string text)
 * Add a cave entry to a patient. To retrieve list of cave from a patient
 * see @see praxisd:getcave().
 * NOTE: This function is only available on the server.
 * @param patientid A string containing the patientid.
 * @param diagnose The cave string.
 * @param text A text to store with the cave entry. NOTE: This is not shown in
 * PCPraxis! The string mat be up to 6 characters long. If longer it will be
 * trunkated.
 * @example Create a new praxisd object and add a cave entry:
 * px = Praxisd.new('localhost', 10000)
 * px:addcave('1234567890', 'AZOPT', '')
 */
int px_addcave(lua_State *L);

/***
 * @method nil praxisd:addbehandling(string patientid, string behandling, string text)
 * Add a behandling to a patient. To retrieve list of behandling from a patient
 * see @see praxisd:getbehandling().
 * NOTE: This function is only available on the server.
 * @param patientid A string containing the patientid.
 * @param diagnose The behandling code.
 * @param text A text to store with the behandling code. The string mat be up to 6
 * characters long. If longer it will be trunkated.
 * @example Create a new praxisd object and add a behandling:
 * px = Praxisd.new('localhost', 10000)
 * px:addbehandling('1234567890', 'B0001', 'o.sin')
 */
int px_addbehandling(lua_State *L);

/***
 * @method nil praxisd:adddiagnose(string patientid, string diagnose, string text)
 * Add a diagnose to a patient. To retrieve list of diagnose from a patient
 * see @see praxisd:getdiagnose().
 * NOTE: This function is only available on the server.
 * @param patientid A string containing the patientid.
 * @param diagnose The diagnose code.
 * @param text A text to store with the diagnose code. The string mat be up to 6
 * characters long. If longer it will be trunkated.
 * @example Create a new praxisd object and add a diagnose:
 * px = Praxisd.new('localhost', 10000)
 * px:adddiagnose('1234567890', 'C0001', 'o.dxt')
 */
int px_adddiagnose(lua_State *L);

/***
 * @method nil __gc()
 * Garbage collector. Closes connection and frees all allocated memory.
 */
int px_gc(lua_State *L);

void register_praxisd(lua_State *L);

const struct luaL_Reg px_meths[] = {
  {"__gc", px_gc},
  {"cavelist", px_cavelist},
  {"behandliglist", px_behandlinglist},
  {"diagnoselist", px_diagnoselist},
  {"getcave", px_getcave},
  {"getbehandling", px_getbehandling},
  {"getdiagnose", px_getdiagnose},
  {"addcave", px_addcave},
  {"addbehandling", px_addbehandling},
  {"adddiagnose", px_adddiagnose},
  {NULL, NULL}
};

const struct luaL_reg px_funcs[] = {
  {"new", px_new},
  {NULL, NULL}
};

#endif/*__PRACRO_LUAPRAXISD_H__*/