summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-03-12 14:18:42 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2014-03-12 14:18:42 +0100
commitb730250bdd6cd6db4204ea14ba82f2a50e9dcda8 (patch)
tree8cad3c0b6cd01334d767faded03510b1ac0579de
parentde75c48f7c9f8f624947c174ff6686844a28b605 (diff)
Switch to new praxisdif.
-rw-r--r--client/VERSION1
-rw-r--r--client/client.pro18
-rw-r--r--client/docgen/docgen.cc13
-rw-r--r--client/docgen/docgen.pro18
-rw-r--r--client/docgen/highlight.cc1
-rw-r--r--client/lua.cc2
-rw-r--r--client/luapraxisd.cc293
-rw-r--r--client/praxisd.cc585
-rw-r--r--client/praxisd.h238
m---------praxisdif0
10 files changed, 37 insertions, 1132 deletions
diff --git a/client/VERSION b/client/VERSION
new file mode 100644
index 0000000..d3f0c49
--- /dev/null
+++ b/client/VERSION
@@ -0,0 +1 @@
+VERSION="2.2.4"
diff --git a/client/client.pro b/client/client.pro
index 43f568f..f17faf0 100644
--- a/client/client.pro
+++ b/client/client.pro
@@ -5,7 +5,7 @@ CONFIG += debug
TEMPLATE = app
TARGET = pracro
DEPENDPATH += . widgets
-INCLUDEPATH += . widgets
+INCLUDEPATH += . widgets ../praxisdif/qt
RESOURCES += client.qrc
QT += core gui network xml sql svg
@@ -16,7 +16,8 @@ debug {
DEFINES+=USE_DEBUG
}
-DEFINES+=VERSION=\\\"2.2.4\\\"
+include(VERSION)
+DEFINES+=VERSION=\\\"$$VERSION\\\"
# For Qt5
contains(QT_VERSION, ^5.*) {
@@ -46,7 +47,6 @@ HEADERS += \
launcherwindow.h \
lua.h \
luadb.h \
- ../server/src/luapraxisd.h \
luawidget.h \
macro.h \
macrowindow.h \
@@ -54,7 +54,6 @@ HEADERS += \
macrodrawer.h \
messagebox.h \
netcom.h \
- praxisd.h \
resumewidget.h \
template.h \
shortcuttooltip.h \
@@ -85,7 +84,9 @@ HEADERS += \
widgets/checkgroupbox.h \
widgets/window.h \
widgets/altcombobox.h \
- widgets/metawidget.h
+ widgets/metawidget.h \
+ ../praxisdif/curl/luapraxisd.h \
+ ../praxisdif/qt/praxisd.h
SOURCES += \
pracro.cc \
@@ -95,7 +96,6 @@ SOURCES += \
launcherwindow.cc \
lua.cc \
luadb.cc \
- luapraxisd.cc \
luawidget.cc \
macro.cc \
macrowindow.cc \
@@ -103,7 +103,6 @@ SOURCES += \
macrodrawer.cc \
messagebox.cc \
netcom.cc \
- praxisd.cc \
resumewidget.cc \
template.cc \
shortcuttooltip.cc \
@@ -133,6 +132,9 @@ SOURCES += \
widgets/checkgroupbox.cc \
widgets/window.cc \
widgets/altcombobox.cc \
- widgets/metawidget.cc
+ widgets/metawidget.cc \
+ ../praxisdif/qt/luapraxisd.cc \
+ ../praxisdif/qt/praxisd.cc
+
TRANSLATIONS = pracro_dk.ts
diff --git a/client/docgen/docgen.cc b/client/docgen/docgen.cc
index 4eb2e08..181b82c 100644
--- a/client/docgen/docgen.cc
+++ b/client/docgen/docgen.cc
@@ -41,6 +41,7 @@
#include "generate.h"
#define WIDGETS_DIR "../widgets"
+#define PRAXISDIF_DIR "../../praxisdif/curl"
#define SERVER_DIR "../../server/src"
#define CLIENT_DIR ".."
#define OUTPUT "html"
@@ -204,6 +205,18 @@ int main(int argc, char *argv[])
}
}
+ // Praxisdif
+ {
+ QDir dir(PRAXISDIF_DIR);
+ QStringList filter; filter << "*.h";
+ dir.setNameFilters(filter);
+ if(!dir.exists()) return 1;
+ QFileInfoList inflst = dir.entryInfoList(QDir::Files);
+ foreach(QFileInfo inf, inflst) {
+ files.append(inf.absoluteFilePath());
+ }
+ }
+
foreach(QString file, files) {
Doc doc = parse(file);
if(doc.title != "" || doc.tag != "" || doc.classname != "")
diff --git a/client/docgen/docgen.pro b/client/docgen/docgen.pro
index 4521347..73e7ed2 100644
--- a/client/docgen/docgen.pro
+++ b/client/docgen/docgen.pro
@@ -7,12 +7,12 @@ INCLUDEPATH += . .. ../widgets
QT += core gui xml svg network sql
RESOURCES += ../client.qrc
-include(../../VERSION)
+include(../VERSION)
DEFINES+=VERSION=\\\"$$VERSION\\\"
win32 {
LIBPATH += lua/lib
- INCLUDEPATH += lua/include
+ INCLUDEPATH += lua/include ../../praxisdif/qt
LIBS += -llua51
DEFINES += HOST_WIN32
}
@@ -34,8 +34,6 @@ SOURCES += \
../lua.cc \
../luawidget.cc \
../luadb.cc \
- ../luapraxisd.cc \
- ../praxisd.cc \
../messagebox.cc \
../macrowindow.cc \
../collapser.cc \
@@ -46,6 +44,7 @@ SOURCES += \
../header.cc \
../macrodrawer.cc \
../aboutbox.cc \
+ ../shortcuttooltip.cc \
../widgets/common.cc \
../widgets/widget.cc \
../widgets/label.cc \
@@ -64,7 +63,9 @@ SOURCES += \
../widgets/checkgroupbox.cc \
../widgets/window.cc \
../widgets/altcombobox.cc \
- ../widgets/metawidget.cc
+ ../widgets/metawidget.cc \
+ ../../praxisdif/qt/luapraxisd.cc \
+ ../../praxisdif/qt/praxisd.cc
HEADERS += \
genimage.h \
@@ -73,7 +74,6 @@ HEADERS += \
doc.h \
highlight.h \
../expandbutton.h \
- ../praxisd.h \
../template.h \
../debug.h \
../lua.h \
@@ -90,6 +90,7 @@ HEADERS += \
../header.h \
../macrodrawer.h \
../aboutbox.h \
+ ../shortcuttooltip.h \
../widgets.h \
../widgets/common.h \
../widgets/widget.h \
@@ -109,4 +110,7 @@ HEADERS += \
../widgets/checkgroupbox.h \
../widgets/window.h \
../widgets/altcombobox.h \
- ../widgets/metawidget.h
+ ../widgets/metawidget.h \
+ ../../praxisdif/qt/luapraxisd.h \
+ ../../praxisdif/curl/luapraxisd.h \
+ ../../praxisdif/qt/praxisd.h
diff --git a/client/docgen/highlight.cc b/client/docgen/highlight.cc
index 0857320..018cf4f 100644
--- a/client/docgen/highlight.cc
+++ b/client/docgen/highlight.cc
@@ -169,4 +169,5 @@ QString highlight(QString code, lang_t lang)
case xml:
return highlight_xml(code);
}
+ return "";
}
diff --git a/client/lua.cc b/client/lua.cc
index f017986..cec7215 100644
--- a/client/lua.cc
+++ b/client/lua.cc
@@ -32,7 +32,7 @@
#include "luawidget.h"
#include "luadb.h"
-#include "../server/src/luapraxisd.h"
+#include "../praxisdif/curl/luapraxisd.h"
#include "debug.h"
diff --git a/client/luapraxisd.cc b/client/luapraxisd.cc
deleted file mode 100644
index 3b8e430..0000000
--- a/client/luapraxisd.cc
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-/***************************************************************************
- * luapraxisd.cc
- *
- * Thu May 5 11:16:20 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.
- */
-#include "../server/src/luapraxisd.h"
-
-#include "praxisd.h"
-
-#include <lauxlib.h>
-#include <strings.h>
-
-#include "debug.h"
-
-#define luaL_checkbool(L, i) \
- (lua_isboolean(L,i) ? lua_toboolean(L,i) : luaL_checkint(L,i))
-
-typedef struct px_userdata {
- PraxisdSync *px;
-} px_userdata;
-
-int px_addcave(lua_State *L)
-{
- lua_pushstring(L, "Add cave not implemented on client.");
- lua_error(L);
- return 0;
-}
-
-int px_addbehandling(lua_State *L)
-{
- lua_pushstring(L, "Add behandling not implemented on client.");
- lua_error(L);
- return 0;
-}
-
-int px_adddiagnose(lua_State *L)
-{
- lua_pushstring(L, "Add diagnose not implemented on client.");
- lua_error(L);
- return 0;
-}
-
-int px_getcave(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- const char *cpr = luaL_checkstring(L, 2);
-
- QVector<QString> cavelist;
-
- Patient patient = pxu->px->patient_get_by_cpr(cpr);
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
- QVector<sogeord_t>::iterator i = patient.sogeord.begin();
- while(i != patient.sogeord.end()) {
- QString cavesogeord = i->sogenr;//.mid(1, i->sogenr.size() - 1);
- QVector<cave_t> cave = pxu->px->diverse_get_cave(cavesogeord);
- if(cave.size() == 1) {
- if(cave[0].cave != "ANDET") cavelist.push_back(cave[0].cave);
- else cavelist.push_back(i->sogetxt);
- }
- i++;
- }
-
- lua_createtable(L, 0, cavelist.size());
- int top = lua_gettop(L);
-
- for(int i = 0; i < cavelist.size(); i++) {
- QString c = cavelist[i];
- DEBUG(cavelist, "CAVE '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_getbehandling(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- const char *cpr = luaL_checkstring(L, 2);
-
- QVector<QString> behandlinglist;
-
- Patient patient = pxu->px->patient_get_by_cpr(cpr);
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
- QVector<sogeord_t>::iterator i = patient.sogeord.begin();
- while(i != patient.sogeord.end()) {
- QString behandlingsogeord = i->sogenr;//.mid(1, i->sogenr.size() - 1);
- QVector<behandling_t> behandling = pxu->px->diverse_get_behandling(behandlingsogeord);
- if(behandling.size() == 1) behandlinglist.push_back(i->sogetxt);
- i++;
- }
-
- lua_createtable(L, 0, behandlinglist.size());
- int top = lua_gettop(L);
-
- for(int i = 0; i < behandlinglist.size(); i++) {
- QString c = behandlinglist[i];
- DEBUG(behandlinglist, "BEHANDLING '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_getdiagnose(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- const char *cpr = luaL_checkstring(L, 2);
-
- QVector<QString> diagnoselist;
-
- Patient patient = pxu->px->patient_get_by_cpr(cpr);
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
- QVector<sogeord_t>::iterator i = patient.sogeord.begin();
- while(i != patient.sogeord.end()) {
- QString diagnosesogeord = i->sogenr;//.mid(1, i->sogenr.size() - 1);
- QVector<diagnose_t> diagnose = pxu->px->diverse_get_diagnose(diagnosesogeord);
- if(diagnose.size() == 1) diagnoselist.push_back(i->sogetxt);
- i++;
- }
-
- lua_createtable(L, 0, diagnoselist.size());
- int top = lua_gettop(L);
-
- for(int i = 0; i < diagnoselist.size(); i++) {
- QString c = diagnoselist[i];
- DEBUG(diagnoselist, "DIAGNOSE '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_cavelist(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- QVector<cave_t> cavelist = pxu->px->diverse_get_cave("C");
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
-
- lua_createtable(L, 0, cavelist.size());
- int top = lua_gettop(L);
-
- for(size_t i = 0; i < (size_t)cavelist.size(); i++) {
- QString c = cavelist[i].cave;
- DEBUG(cavelist, "CAVE '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_behandlinglist(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- QVector<behandling_t> behandlinglist = pxu->px->diverse_get_behandling("C");
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
-
- lua_createtable(L, 0, behandlinglist.size());
- int top = lua_gettop(L);
-
- for(size_t i = 0; i < (size_t)behandlinglist.size(); i++) {
- QString c = behandlinglist[i].behandling;
- DEBUG(behandlinglist, "BEHANDLING '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_diagnoselist(lua_State *L)
-{
- px_userdata *pxu;
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- QVector<diagnose_t> diagnoselist = pxu->px->diverse_get_diagnose("C");
- if(pxu->px->hasError()) {
- lua_pushstring(L, pxu->px->errorString().toStdString().c_str());
- lua_error(L);
- return 1;
- }
-
- lua_createtable(L, 0, diagnoselist.size());
- int top = lua_gettop(L);
-
- for(size_t i = 0; i < (size_t)diagnoselist.size(); i++) {
- QString c = diagnoselist[i].diagnose;
- DEBUG(diagnoselist, "DIAGNOSE '%s'\n", c.toStdString().c_str());
- lua_pushstring(L, c.toStdString().c_str());
- lua_rawseti(L, top, i);
- }
-
- return 1;
-}
-
-int px_new(lua_State *L)
-{
- const char *host = luaL_checkstring(L, 1);
- int port = luaL_checknumber(L, 2);
-
- px_userdata *pxu;
- pxu = (px_userdata *)lua_newuserdata(L, sizeof(px_userdata));
-
- luaL_getmetatable(L, "Praxisd");
- lua_setmetatable(L, -2);
-
- pxu->px = new PraxisdSync(host, port);
-
- return 1;
-}
-
-int px_gc(lua_State *L)
-{
- px_userdata *pxu;
-
- pxu = (px_userdata *)luaL_checkudata(L, 1, "Praxisd");
- luaL_argcheck(L, pxu, 1, "Praxisd expected");
-
- delete pxu->px;
-
- return 0;
-}
-
-void register_praxisd(lua_State *L)
-{
- luaL_newmetatable(L, "Praxisd");
- lua_pushliteral(L, "__index");
- lua_pushvalue(L, -2);
- lua_rawset(L, -3);
- luaL_register(L, NULL, px_meths);
- luaL_openlib (L, "Praxisd", px_funcs, 0);
-}
diff --git a/client/praxisd.cc b/client/praxisd.cc
deleted file mode 100644
index d0bb280..0000000
--- a/client/praxisd.cc
+++ /dev/null
@@ -1,585 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-/***************************************************************************
- * praxisd.cc
- *
- * Tue Oct 11 15:20:18 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.
- */
-#include "praxisd.h"
-
-#include <stdio.h>
-
-#include <QDomDocument>
-
-#include <QtNetwork>
-
-#define DOCAVE(x) if(element.tagName() == #x) cave.x = element.text()
-static CaveVector getCaveList(QByteArray data)
-{
- QDomDocument doc;
- doc.setContent(data);
-
- CaveVector cavelist;
-
- QDomNode praxisd = doc.documentElement();
- QDomNodeList nodes = praxisd.childNodes();
- for(int i = 0; i < nodes.count(); i++) {
- QDomNode node = nodes.at(i);
- QDomElement element = node.toElement();
- if(element.tagName() == "div_cave") {
-
- cave_t cave;
- cave.sogenr = element.attribute("sogenr");
-
- QDomNodeList nodes = element.childNodes();
- for(int j = 0; j < nodes.count(); j++) {
- QDomNode node = nodes.at(j);
- QDomElement element = node.toElement();
- DOCAVE(cave);
- DOCAVE(bemaerkning1);
- DOCAVE(bemaerkning2);
- DOCAVE(bemaerkning3);
- }
-
- cavelist.push_back(cave);
- }
- }
-
- return cavelist;
-}
-
-#define DOBEHANDLING(x) if(element.tagName() == #x) behandling.x = element.text()
-static BehandlingVector getBehandlingList(QByteArray data)
-{
- QDomDocument doc;
- doc.setContent(data);
-
- BehandlingVector behandlinglist;
-
- QDomNode praxisd = doc.documentElement();
- QDomNodeList nodes = praxisd.childNodes();
- for(int i = 0; i < nodes.count(); i++) {
- QDomNode node = nodes.at(i);
- QDomElement element = node.toElement();
- if(element.tagName() == "div_behandling") {
-
- behandling_t behandling;
- behandling.sogenr = element.attribute("sogenr");
-
- QDomNodeList nodes = element.childNodes();
- for(int j = 0; j < nodes.count(); j++) {
- QDomNode node = nodes.at(j);
- QDomElement element = node.toElement();
- DOBEHANDLING(kode);
- DOBEHANDLING(behandling);
- DOBEHANDLING(bemaerkning);
- DOBEHANDLING(udregning);
- }
-
- behandlinglist.push_back(behandling);
- }
- }
-
- return behandlinglist;
-}
-
-#define DODIAGNOSE(x) if(element.tagName() == #x) diagnose.x = element.text()
-static DiagnoseVector getDiagnoseList(QByteArray data)
-{
- QDomDocument doc;
- doc.setContent(data);
-
- DiagnoseVector diagnoselist;
-
- QDomNode praxisd = doc.documentElement();
- QDomNodeList nodes = praxisd.childNodes();
- for(int i = 0; i < nodes.count(); i++) {
- QDomNode node = nodes.at(i);
- QDomElement element = node.toElement();
- if(element.tagName() == "div_diagnose") {
-
- diagnose_t diagnose;
- diagnose.sogenr = element.attribute("sogenr");
-
- QDomNodeList nodes = element.childNodes();
- for(int j = 0; j < nodes.count(); j++) {
- QDomNode node = nodes.at(j);
- QDomElement element = node.toElement();
- DODIAGNOSE(kode);
- DODIAGNOSE(diagnose);
- DODIAGNOSE(bemaerkning);
- }
-
- diagnoselist.push_back(diagnose);
- }
- }
-
- return diagnoselist;
-}
-
-#define DOPATIENT(x) if(element.tagName() == #x) patient.x = element.text()
-static Patient getPatient(QByteArray data)
-{
- QDomDocument doc;
- doc.setContent(data);
-
- Patient patient;
-
- QDomNode praxisd = doc.documentElement();
- QDomNode patnode = praxisd.firstChild();
-
- QDomElement patelement = patnode.toElement();
- patient.cpr = patelement.attribute("cpr");
-
- QDomNodeList nodes = patnode.childNodes();
- for(int i = 0; i < nodes.count(); i++) {
- QDomNode node = nodes.at(i);
- QDomElement element = node.toElement();
-
- DOPATIENT(fornavne);
- DOPATIENT(efternavn);
- DOPATIENT(stilling);
- DOPATIENT(gade);
- DOPATIENT(by);
- DOPATIENT(telefonnumre);
- DOPATIENT(sikringsgr);
- DOPATIENT(amtsnr);
- DOPATIENT(sygekontor);
- DOPATIENT(henvnr);
- DOPATIENT(frilinie1);
- DOPATIENT(frilinie2);
- DOPATIENT(frilinie3);
- DOPATIENT(frilinie4);
- DOPATIENT(frilinie5);
-
- if(element.tagName() == "sogeords") {
- QDomNodeList nodes = element.childNodes();
- for(int j = 0; j < nodes.count(); j++) {
- sogeord_t sogeord;
- QDomNode node = nodes.at(j);
- QDomElement element = node.toElement();
- sogeord.sogenr = element.attribute("sogenr");
- sogeord.sogedato = element.attribute("sogedato");
- sogeord.sogetxt = element.text();
- patient.sogeord.push_back(sogeord);
- }
- }
-
- DOPATIENT(ydernr);
- DOPATIENT(created);
- DOPATIENT(donottouch);
- DOPATIENT(visus);
- DOPATIENT(labkort);
- DOPATIENT(medkort);
- DOPATIENT(jlock);
- DOPATIENT(unknown1);
- DOPATIENT(henvdato);
- DOPATIENT(aarhund);
- DOPATIENT(fakturadato);
- DOPATIENT(fakturabelob);
- DOPATIENT(betaldato);
- DOPATIENT(betalbelob);
- DOPATIENT(jdato);
- DOPATIENT(unknown250);
- DOPATIENT(unknown251);
- DOPATIENT(jtime);
- }
-
- return patient;
-}
-
-#define DODOKMENU(x) if(element.tagName() == #x) dokmenu.x = element.text()
-static DokMenuVector getDokMenu(QByteArray data)
-{
- QDomDocument doc;
- doc.setContent(data);
-
- DokMenuVector dokmenus;
-
- QDomNode praxisd = doc.documentElement();
- QDomNodeList nodes = praxisd.childNodes();
- for(int i = 0; i < nodes.count(); i++) {
- QDomNode node = nodes.at(i);
- QDomElement element = node.toElement();
- if(element.tagName() == "dokmenu") {
- dokmenu_t dokmenu;
- dokmenu.cpr = element.attribute("cpr");
-
- QDomNodeList nodes = element.childNodes();
- for(int j = 0; j < nodes.count(); j++) {
- QDomNode node = nodes.at(j);
- QDomElement element = node.toElement();
- DODOKMENU(group);
- DODOKMENU(subject);
- if(element.tagName() == "filename") {
- dokmenu.filename = element.text();
- dokmenu.filesize = element.attribute("filesize").toUInt();
- dokmenu.date = element.attribute("date");
- }
- }
-
- dokmenus.push_back(dokmenu);
- }
- }
-
- return dokmenus;
-}
-
-Praxisd::Praxisd(QString host, unsigned short int port)
-{
- qRegisterMetaType<CaveVector>("CaveVector");
- qRegisterMetaType<Patient>("Patient");
- qRegisterMetaType<DokMenuVector>("DokMenuVector");
-
- QUrl url;
- url.setHost(host);
- url.setPort(port);
- url.setScheme("http");
-
- request.setUrl(url);
-
- manager = new QNetworkAccessManager(this);
- connect(manager, SIGNAL(finished(QNetworkReply*)),
- this, SLOT(replyFinished(QNetworkReply*)));
-}
-
-void Praxisd::replyFinished(QNetworkReply *reply)
-{
- if(reply->error() == QNetworkReply::NoError) {
-
- reply_t type = replytypes[reply];
- switch(type) {
- case journal:
- emit gotJournal(reply->readAll());
- break;
-
- case cavelist:
- emit gotCaveList(getCaveList(reply->readAll()));
- break;
-
- case behandlinglist:
- emit gotBehandlingList(getBehandlingList(reply->readAll()));
- break;
-
- case diagnoselist:
- emit gotDiagnoseList(getDiagnoseList(reply->readAll()));
- break;
-
- case patient:
- emit gotPatient(getPatient(reply->readAll()));
- break;
-
- case dokmenu:
- emit gotDokMenu(getDokMenu(reply->readAll()));
- break;
-
- case dokmenufile:
- emit gotDokMenuFile(reply->readAll(), reply->rawHeader("Content-Type"));
- break;
- }
- } else {
- emit networkError(reply->errorString() + " - " + reply->readAll());
- }
- replytypes.erase(replytypes.find(reply));
-}
-
-void Praxisd::makeTransfer(reply_t t, QString uri,
- QMap<QString, QString> params)
-{
- request.setRawHeader("User-Agent", "Pracro Client v"VERSION);
-
- QUrl url;
- url.setHost(request.url().host());
- url.setPort(request.url().port());
- url.setScheme(request.url().scheme());
-
- url.setPath(uri);
-
-#ifdef QT5
- QUrlQuery query;
-#else
- QUrl &query = url;
-#endif
-
- QMap<QString, QString>::iterator i = params.begin();
- while(i != params.end()) {
- query.addQueryItem(i.key(), i.value());
- i++;
- }
-
-#ifdef QT5
- url.setQuery(query);
-#endif
-
- request.setUrl(url);
-
- QNetworkReply* r = manager->get(request);
- replytypes[r] = t;
-}
-
-void Praxisd::journal_get_by_cpr(QString cpr)
-{
- QMap<QString, QString> params;
- params["cpr"] = cpr;
- makeTransfer(journal, "/praxisd/1.0/journal/get_by_cpr", params);
-}
-
-void Praxisd::diverse_get_cave(QString sogenr)
-{
- QMap<QString, QString> params;
- params["sogenr"] = sogenr;
- makeTransfer(cavelist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
-}
-
-void Praxisd::diverse_get_behandling(QString sogenr)
-{
- QMap<QString, QString> params;
- params["sogenr"] = sogenr;
- makeTransfer(behandlinglist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
-}
-
-void Praxisd::diverse_get_diagnose(QString sogenr)
-{
- QMap<QString, QString> params;
- params["sogenr"] = sogenr;
- makeTransfer(diagnoselist, "/praxisd/1.0/diverse/get_all_by_sogenr", params);
-}
-
-void Praxisd::patient_get_by_cpr(QString cpr)
-{
- QMap<QString, QString> params;
- params["cpr"] = cpr;
- makeTransfer(patient, "/praxisd/1.0/patient/get_by_cpr", params);
-}
-
-void Praxisd::dokmenu_get_all_by_cpr(QString cpr)
-{
- QMap<QString, QString> params;
- params["cpr"] = cpr;
- makeTransfer(dokmenu, "/praxisd/1.0/dokmenu/get_all_by_cpr", params);
-}
-
-void Praxisd::dokmenu_get_by_cpr_and_name(QString cpr, QString name)
-{
- cpr = cpr;
- name = name;
- // uri = host + "/praxisd/1.0/dokmenu/get_by_cpr_and_name?cpr=" + cpr + "&name=" + name;
- QMap<QString, QString> params;
- params["cpr"] = cpr;
- params["name"] = name;
- makeTransfer(dokmenufile, "/praxisd/1.0/dokmenu/get_by_cpr_and_name", params);
-}
-
-PraxisdSync::PraxisdSync(QString host, unsigned short int port)
-{
- this->host = host;
- this->port = port;
- this->running = true;
-
- error = false;
- errorStr = "";
-
- start();
-}
-
-PraxisdSync::~PraxisdSync()
-{
- this->running = false;
- wsem.release();
- wait();
-}
-
-void PraxisdSync::run()
-{
- Praxisd praxisd(host, port);
-
- connect(&praxisd, SIGNAL(networkError(QString)),
- this, SLOT(networkError(QString)), Qt::DirectConnection);
-
- connect(&praxisd, SIGNAL(gotCaveList(CaveVector)),
- this, SLOT(gotCaveList(CaveVector)), Qt::DirectConnection);
- connect(&praxisd, SIGNAL(gotBehandlingList(BehandlingVector)),
- this, SLOT(gotBehandlingList(BehandlingVector)), Qt::DirectConnection);
- connect(&praxisd, SIGNAL(gotDiagnoseList(DiagnoseVector)),
- this, SLOT(gotDiagnoseList(DiagnoseVector)), Qt::DirectConnection);
-
- connect(&praxisd, SIGNAL(gotPatient(Patient)),
- this, SLOT(gotPatient(Patient)), Qt::DirectConnection);
-
- connect(&praxisd, SIGNAL(gotDokMenu(DokMenuVector)),
- this, SLOT(gotDokMenu(DokMenuVector)), Qt::DirectConnection);
-
- while(true) {
- wsem.acquire();
-
- // Reset error state
- error = false;
- errorStr = "";
-
- if(this->running == false) break;
-
- switch(request_type) {
- case Praxisd::journal:
- break;
- case Praxisd::cavelist:
- praxisd.diverse_get_cave(request_sogenr);
- break;
- case Praxisd::behandlinglist:
- praxisd.diverse_get_behandling(request_sogenr);
- break;
- case Praxisd::diagnoselist:
- praxisd.diverse_get_diagnose(request_sogenr);
- break;
- case Praxisd::patient:
- praxisd.patient_get_by_cpr(request_cpr);
- break;
- case Praxisd::dokmenu:
- praxisd.dokmenu_get_all_by_cpr(request_cpr);
- break;
- case Praxisd::dokmenufile:
- break;
- }
-
- exec();
- }
-
- rsem.release();
-}
-
-bool PraxisdSync::hasError()
-{
- return error;
-}
-
-QString PraxisdSync::errorString()
-{
- return errorStr;
-}
-
-void PraxisdSync::networkError(QString err)
-{
- error = true;
- errorStr = "Network error: " + err;
- rsem.release();
- quit();
-}
-
-void PraxisdSync::gotCaveList(CaveVector cl)
-{
- cavelist = cl;
- rsem.release();
- quit();
-}
-
-void PraxisdSync::gotBehandlingList(BehandlingVector bl)
-{
- behandlinglist = bl;
- rsem.release();
- quit();
-}
-
-void PraxisdSync::gotDiagnoseList(DiagnoseVector dl)
-{
- diagnoselist = dl;
- rsem.release();
- quit();
-}
-
-void PraxisdSync::gotPatient(Patient p)
-{
- patient = p;
- rsem.release();
- quit();
-}
-
-void PraxisdSync::gotDokMenu(DokMenuVector d)
-{
- dokmenu = d;
- rsem.release();
- quit();
-}
-
-QString PraxisdSync::journal_get_by_cpr(QString cpr)
-{
- return cpr;
-}
-
-CaveVector PraxisdSync::diverse_get_cave(QString sogenr)
-{
- request_type = Praxisd::cavelist;
- request_sogenr = sogenr;
-
- wsem.release();
- rsem.acquire();
-
- return cavelist;
-}
-
-BehandlingVector PraxisdSync::diverse_get_behandling(QString sogenr)
-{
- request_type = Praxisd::behandlinglist;
- request_sogenr = sogenr;
-
- wsem.release();
- rsem.acquire();
-
- return behandlinglist;
-}
-
-DiagnoseVector PraxisdSync::diverse_get_diagnose(QString sogenr)
-{
- request_type = Praxisd::diagnoselist;
- request_sogenr = sogenr;
-
- wsem.release();
- rsem.acquire();
-
- return diagnoselist;
-}
-
-Patient PraxisdSync::patient_get_by_cpr(QString cpr)
-{
- request_type = Praxisd::patient;
- request_cpr = cpr;
-
- wsem.release();
- rsem.acquire();
-
- return patient;
-}
-
-DokMenuVector PraxisdSync::dokmenu_get_all_by_cpr(QString cpr)
-{
- request_type = Praxisd::dokmenu;
- request_cpr = cpr;
-
- wsem.release();
- rsem.acquire();
-
- return dokmenu;
-}
-
-QString PraxisdSync::dokmenu_get_by_cpr_and_name(QString cpr, QString name)
-{
- return cpr + name;
-}
diff --git a/client/praxisd.h b/client/praxisd.h
deleted file mode 100644
index 38404da..0000000
--- a/client/praxisd.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-/***************************************************************************
- * praxisd.h
- *
- * Tue Oct 11 15:20:18 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_PRAXISD_H__
-#define __PRACRO_PRAXISD_H__
-
-#include <QObject>
-#include <QString>
-#include <QVector>
-
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-
-#include <QByteArray>
-#include <QThread>
-#include <QSemaphore>
-
-typedef struct {
- QString sogenr;
- QString cave;
- QString bemaerkning1;
- QString bemaerkning2;
- QString bemaerkning3;
-} cave_t;
-
-typedef struct {
- QString sogenr;
- QString kode;
- QString behandling;
- QString bemaerkning;
- QString udregning;
-} behandling_t;
-//std::vector<behandling_t> diverse_get_behandling(std::string sogenr)
-
-typedef struct {
- QString sogenr;
- QString kode;
- QString diagnose;
- QString bemaerkning;
-} diagnose_t;
-// std::vector<diagnose_t> diverse_get_diagnose(std::string sogenr)
-
-typedef struct {
- QString sogenr;
- QString sogedato;
- QString sogetxt;
-} sogeord_t;
-
-typedef struct {
- QString cpr;
- QString fornavne;
- QString efternavn;
- QString stilling;
- QString gade;
- QString by;
- QString telefonnumre;
- QString sikringsgr;
- QString amtsnr;
- QString sygekontor;
- QString henvnr;
- QString frilinie1;
- QString frilinie2;
- QString frilinie3;
- QString frilinie4;
- QString frilinie5;
- QVector<sogeord_t> sogeord;
- QString ydernr;
- QString created;
- QString donottouch;
- QString visus;
- QString labkort;
- QString medkort;
- QString jlock;
- QString unknown1;
- QString henvdato;
- QString aarhund;
- QString fakturadato;
- QString fakturabelob;
- QString betaldato;
- QString betalbelob;
- QString jdato;
- QString unknown250;
- QString unknown251;
- QString jtime;
-} patient_t;
-
-typedef struct {
- QString cpr;
- QString group;
- QString subject;
- QString filename;
- size_t filesize;
- QString date;
-} dokmenu_t;
-
-typedef QVector<cave_t> CaveVector;
-typedef QVector<behandling_t> BehandlingVector;
-typedef QVector<diagnose_t> DiagnoseVector;
-
-typedef patient_t Patient;
-typedef QVector<dokmenu_t> DokMenuVector;
-
-class Praxisd : public QObject {
-Q_OBJECT
-public:
- typedef enum {
- journal,
- cavelist,
- behandlinglist,
- diagnoselist,
- patient,
- dokmenu,
- dokmenufile
- } reply_t;
-
- Praxisd(QString host, quint16 port);
-
- void journal_get_by_cpr(QString patientid);
-
- void diverse_get_cave(QString sogenr);
- void diverse_get_behandling(QString sogenr);
- void diverse_get_diagnose(QString sogenr);
-
- void patient_get_by_cpr(QString cpr);
-
- void dokmenu_get_all_by_cpr(QString cpr);
-
- void dokmenu_get_by_cpr_and_name(QString cpr, QString name);
-
-signals:
- void gotReply(QByteArray data);
- void networkError(QString text);
-
- void gotJournal(QString data);
-
- void gotCaveList(CaveVector cave);
- void gotBehandlingList(BehandlingVector cave);
- void gotDiagnoseList(DiagnoseVector cave);
-
- void gotPatient(Patient patient);
- void gotDokMenu(DokMenuVector dokmenu);
- void gotDokMenuFile(QByteArray data, QString mimetype);
-
-public slots:
- void replyFinished(QNetworkReply*);
-
-private:
- void makeTransfer(reply_t t, QString uri, QMap<QString, QString> params);
-
- QNetworkAccessManager *manager;
- QNetworkRequest request;
-
- QString host;
- unsigned short int port;
-
- QMap<QNetworkReply*, reply_t> replytypes;
-};
-
-class PraxisdSync : public QThread {
-Q_OBJECT
-public:
- PraxisdSync(QString host, unsigned short int port);
- ~PraxisdSync();
-
- QString journal_get_by_cpr(QString patientid);
-
- CaveVector diverse_get_cave(QString sogenr);
- BehandlingVector diverse_get_behandling(QString sogenr);
- DiagnoseVector diverse_get_diagnose(QString sogenr);
-
- Patient patient_get_by_cpr(QString cpr);
- DokMenuVector dokmenu_get_all_by_cpr(QString cpr);
- QString dokmenu_get_by_cpr_and_name(QString cpr, QString name);
-
- bool hasError();
- QString errorString();
-
- void run();
-
-private slots:
- void networkError(QString);
-
- void gotCaveList(CaveVector);
- void gotBehandlingList(BehandlingVector);
- void gotDiagnoseList(DiagnoseVector);
-
- void gotPatient(Patient);
- void gotDokMenu(DokMenuVector);
-
-private:
- QString host;
- quint16 port;
-
- QSemaphore rsem;
- QSemaphore wsem;
-
- Praxisd::reply_t request_type;
- QString request_sogenr;
- QString request_cpr;
-
- CaveVector cavelist;
- BehandlingVector behandlinglist;
- DiagnoseVector diagnoselist;
-
- Patient patient;
- DokMenuVector dokmenu;
-
- volatile bool running;
-
- bool error;
- QString errorStr;
-};
-
-#endif/*__PRACRO_PRAXISD_H__*/
diff --git a/praxisdif b/praxisdif
-Subproject 66697a015823be0bcb65341ca9c2bbdacf28ea3
+Subproject e1f703f39e09d1989225e15acdc1c5cbad7e7e2