From 29b92e2906823878a7c516dc454d9ae8654de8fb Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 12 Oct 2011 08:08:15 +0200 Subject: Initial work on pcp viewer including a new Praxisd class based on Qt-only components. --- client/client.pro | 2 + client/pcpviewer.cc | 50 +++++++++++++++++++++++++ client/pcpviewer.h | 45 +++++++++++++++++++++++ client/pracro.cc | 20 ++++++++-- client/praxisd.cc | 46 +++++++++++++++++++++++ client/praxisd.h | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 client/pcpviewer.cc create mode 100644 client/pcpviewer.h create mode 100644 client/praxisd.cc create mode 100644 client/praxisd.h (limited to 'client') diff --git a/client/client.pro b/client/client.pro index 44fc02c..445f29f 100644 --- a/client/client.pro +++ b/client/client.pro @@ -61,6 +61,7 @@ HEADERS += \ macrodrawer.h \ messagebox.h \ netcom.h \ + pcpviewer.h \ resumewidget.h \ template.h \ widgets.h \ @@ -100,6 +101,7 @@ SOURCES += \ macrodrawer.cc \ messagebox.cc \ netcom.cc \ + pcpviewer.cc \ resumewidget.cc \ template.cc \ widgets/common.cc \ diff --git a/client/pcpviewer.cc b/client/pcpviewer.cc new file mode 100644 index 0000000..c665cf2 --- /dev/null +++ b/client/pcpviewer.cc @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * pcpviewer.cc + * + * Tue Oct 11 14:13:34 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 "pcpviewer.h" + +PCPViewer::PCPViewer(QString patientid) : praxisd("gargamel", 10000) +{ + this->patientid = patientid; + + std::string j = praxisd.journal_get_by_cpr(patientid.toStdString()); + printf("%s\n", j.c_str()); + + std::vector d = + praxisd.dokmenu_get_all_by_cpr(patientid.toStdString()); + std::vector::iterator di = d.begin(); + while(di != d.end()) { + printf("%s %s %s %d %s\n", + di->group.c_str(), + di->subject.c_str(), + di->filename.c_str(), + di->filesize, + di->date.c_str()); + di++; + } + +} diff --git a/client/pcpviewer.h b/client/pcpviewer.h new file mode 100644 index 0000000..dd86fea --- /dev/null +++ b/client/pcpviewer.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set et sw=2 ts=2: */ +/*************************************************************************** + * pcpviewer.h + * + * Tue Oct 11 14:13:34 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_PCPVIEWER_H__ +#define __PRACRO_PCPVIEWER_H__ + +#include + +#include "../server/src/praxisd.h" + +class PCPViewer : public QWidget { +Q_OBJECT +public: + PCPViewer(QString patientid); + +private: + Praxisd praxisd; + QString patientid; +}; + +#endif/*__PRACRO_PCPVIEWER_H__*/ diff --git a/client/pracro.cc b/client/pracro.cc index 57a8da7..50ec007 100644 --- a/client/pracro.cc +++ b/client/pracro.cc @@ -38,6 +38,7 @@ #include "netcom.h" #include "mainwindow.h" #include "launcherwindow.h" +#include "pcpviewer.h" #include "debug.h" @@ -67,6 +68,7 @@ static void print_usage() printf(" -c, --config FILE The configfile to use. Default is \""CONFIG_DEFAULT"\"\n"); printf(" -u, -U, --user USER Defines the requesting user(not the patient),\n" " defaults to \""USER_DEFAULT"\"\n"); + printf(" -V, --viewer Show PCPraxis viewer.\n"); printf(" -v, --version Print version information and exit.\n"); printf(" -d, --debug Make debug console available.\n"); printf(" Show the viewer only (no pracro editor window) with TEMPLATES.\n"); @@ -95,6 +97,7 @@ int main(int argc, char *argv[]) QString templ; QString course; QString templs; + bool show_viewer = false; QStringList args = app.arguments(); QStringList::iterator arg = args.begin(); @@ -111,6 +114,10 @@ int main(int argc, char *argv[]) print_version(); return 0; } + else if(*arg == "--viewer" || + *arg == "-V") { + show_viewer = true; + } else if(*arg == "--user" || *arg == "-U" || *arg == "-u") { @@ -175,10 +182,15 @@ int main(int argc, char *argv[]) } */ - MainWindow mainwindow(cpr, course, templ, host, port, user); - mainwindow.show(); - - return app.exec(); + if(show_viewer) { + PCPViewer pcpviewer(cpr); + pcpviewer.show(); + return app.exec(); + } else { + MainWindow mainwindow(cpr, course, templ, host, port, user); + mainwindow.show(); + return app.exec(); + } } #endif/*TESTING*/ diff --git a/client/praxisd.cc b/client/praxisd.cc new file mode 100644 index 0000000..2367eb1 --- /dev/null +++ b/client/praxisd.cc @@ -0,0 +1,46 @@ +/* -*- 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" + +#ifdef TEST_PRAXISD +//Additional dependency files +//deps: +//Required cflags (autoconf vars may be used) +//cflags: +//Required link options (autoconf vars may be used) +//libs: +#include "test.h" + +TEST_BEGIN; + +// TODO: Put some testcode here (see test.h for usable macros). +TEST_TRUE(false, "No tests yet!"); + +TEST_END; + +#endif/*TEST_PRAXISD*/ diff --git a/client/praxisd.h b/client/praxisd.h new file mode 100644 index 0000000..dfaac59 --- /dev/null +++ b/client/praxisd.h @@ -0,0 +1,104 @@ +/* -*- 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__ + +class Praxisd { +Q_OBJECT +public; + Praxisd(); + + QString journal_get_by_cpr(QString patientid); + + typedef struct { + QString sogenr; + QString cave; + QString bemaerkning1; + QString bemaerkning2; + QString bemaerkning3; + } cave_t; + QVector diverse_get_cave(QString 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; + 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; + patient_t patient_get_by_cpr(QString cpr); + + typedef struct { + QString group; + QString subject; + QString filename; + size_t filesize; + QString date; + } dokmenu_t; + QVector dokmenu_get_all_by_cpr(QString cpr); + + QString dokmenu_get_by_cpr_and_name(QString cpr, QString name); +}; + +#endif/*__PRACRO_PRAXISD_H__*/ -- cgit v1.2.3