// Copyright (C) 1999-2015 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.SupportModule');
class ModuleFieldChecker extends SupportModule
{
    var $MODULE_NAME = "Module Field Checker";
    var $MODULE_VERSION = "0.1";
    var $MODULE_FILE = __FILE__;
    var $MODULE_UID = "04a34310-9737-4aee-9944-47a37d8b3cd7";
    var $MODULE_HIDDEN = true;
    var $PACKAGE_MINIMUM_VERSION = '0.8.0';
    var $record_name = "Module Field Checker";
    var $table_name = "module_field_checker";
    var $order_field = "stamp";
    var $variables = array("stamp", "patient", "user", "module_type", "module_fields", "module_record", "status_completed");
    public function __construct()
    {
        // __("Module Field Checker")
Example #2
0
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('net.php.pear.MDB2');
define('SQL__NOW', "~~~~~NOW~~~~~");
// Class: org.freemedsoftware.core.FreemedDb
//
class FreemedDb extends MDB2
{
    private $db;
    private $data;
    public function __construct()
    {
        $this->init();
    }
    public function __wakeup()
    {
        $this->init();
    }
Example #3
0
// Copyright (C) 1999-2015 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.EMRModule');
class EncounterNotes extends EMRModule
{
    var $MODULE_NAME = "Encounter Notes";
    var $MODULE_VERSION = "0.1";
    var $MODULE_FILE = __FILE__;
    var $MODULE_UID = "a3c06741-e167-49c0-96ba-67de43a7ae0b";
    var $PACKAGE_MINIMUM_VERSION = '0.7.0';
    var $table_name = "enotes";
    var $widget_hash = "##pnotesdt## ##pnotesdescrip##";
    var $acl_category = 'emr';
    var $variables = array('pnotesdt', 'pnotesdtadd', 'pnotesdtmod', 'pnotespat', 'pnotesdescrip', 'pnotestype', 'pnotesdoc', 'pnoteseoc', 'pnotestemplate', 'pnotesuser', 'pnotes_S', 'pnotes_O', 'pnotes_A', 'pnotes_P', 'pnotes_I', 'pnotes_E', 'pnotes_R', 'pnotessbp', 'pnotesdbp', 'pnotestemp', 'pnotesheartrate', 'pnotesresprate', 'pnotesweight', 'pnotesheight', 'pnotesgeneral', 'pnotesbmi', 'pnotescc', 'pnoteshpi', 'pnotesph', 'pnotesrosgenralstatus', 'pnotesrosgenral', 'pnotesrosheadstatus', 'pnotesroshead', 'pnotesroseyesstatus', 'pnotesroseyes', 'pnotesroseyescmnts', 'pnotesrosentstatus', 'pnotesrosent', 'pnotesrosentcmnts', 'pnotesroscvstatus', 'pnotesroscv', 'pnotesroscvsmnts', 'pnotesrosrespstatus', 'pnotesrosresp', 'pnotesrosrespcmnts', 'pnotesrosgistatus', 'pnotesroshgi', 'pnotesrosgicmnts', 'pnotesrosgustatus', 'pnotesrosgu', 'pnotesrosgucmnts', 'pnotesrosmusclestatus', 'pnotesrosmuscles', 'pnotesrosmusclescmnts', 'pnotesrosskinstatus', 'pnotesrosskin', 'pnotesrosskincmnts', 'pnotesrospsychstatus', 'pnotesrospsych', 'pnotesrospsychcmnts', 'pnotesrosendostatus', 'pnotesrosendo', 'pnotesrosendocmnts', 'pnotesroshemlympstatus', 'pnotesroshemlymp', 'pnotesroshemlympcmnts', 'pnotesrosneurostatus', 'pnotesrosneuro', 'pnotesrosneurocmnts', 'pnotesrosimmallrgstatus', 'pnotesrosimmallrg', 'pnotesfh', 'pnotesshalcoholstatus', 'pnotesshalcoholcmnt', 'pnotesshtobaccostatus', 'pnotesshtobaccocmnt', 'pnotesshtcounseled', 'pnotesshilctdrugstatus', 'pnotesshilctdrugscmnt', 'pnotesshliveswithstatus', 'pnotesshliveswithcmnt', 'pnotesshoccupation', 'pnotesshivrskfacstatus', 'pnotesshivrskfaccmnt', 'pnotesshtravelstatus', 'pnotesshtravelcmnt', 'pnotesshpetsstatus', 'pnotesshpetscmnt', 'pnotesshhobbiesstatus', 'pnotesshhobbiescmnt', 'pnotesshhousing', 'pnotespeheadfreecmnt', 'pnotespeeyeclpistatus', 'pnotespeeyeclpicmnt', 'pnotespeeyedesstatus', 'pnotespeeyedescmnt', 'pnotespeeyevpsstatus', 'pnotespeeyevpscmnt', 'pnotespeeyeavnstatus', 'pnotespeeyeavncmnt', 'pnotespeeyehemstatus', 'pnotespeeyehemcmnt', 'pnotespeeyeexustatus', 'pnotespeeyeexucmnt', 'pnotespeeyecupdiscratio', 'pnotespeeyefreecmnt', 'pnotespeentectstatus', 'pnotespeentectcmnt', 'pnotespeentnmsstatus', 'pnotespeentnmscmnt', 'pnotespeentlgtstatus', 'pnotespeentlgtcmnt', 'pnotespeentomsgstatus', 'pnotespeentomsgcmnt', 'pnotespeenthttpstatus', 'pnotespeenthttpcmnt', 'pnotespeentthyrostatus', 'pnotespeentthyrocmnt', 'pnotespeentfreecmnt', 'pnotespeneckbrjvdstatus', 'pnotespeneckbrjvdcmnt', 'pnotespeneckfreecmnt', 'pnotespebrstddmstatus', 'pnotespebrstddmcmnt', 'pnotespebrstfreecmnt', 'pnotesperespeffstatus', 'pnotesperespeffcmnt', 'pnotesperesplungstatus', 'pnotesperesplungcmnt', 'pnotesperespfreecmnt', 'pnotespecvregrhystatus', 'pnotespecvregrhycmnt', 'pnotespecvs1consstatus', 'pnotespecvs1conscmnt', 'pnotespecvs2physplstatus', 'pnotespecvs2physplcmnt', 'pnotespecvmurstatus', 'pnotespecvmurcmnt', 'pnotespecvpalhrtstatus', 'pnotespecvpalhrtcmnt', 'pnotespecvabdaorstatus', 'pnotespecvabdaorcmnt', 'pnotespecvfemartstatus', 'pnotespecvfemartcmnt', 'pnotespecvpedpulstatus', 'pnotespecvpadpulcmnt', 'pnotespecvfreecmnt', 'pnotespegiscarsstatus', 'pnotespegiscarscmnt', 'pnotespegibruitstatus', 'pnotespegibruitcmnt', 'pnotespegimassstatus', 'pnotespegimasscmnt', 'pnotespegitendstatus', 'pnotespegitendcmnt', 'pnotespegiheptstatus', 'pnotespegiheptcmnt', 'pnotespegisplenstatus', 'pnotespegisplencmnt', 'pnotespegiaprsstatus', 'pnotespegiaprscmnt', 'pnotespegibowsndstatus', 'pnotespegibowsndcmnt', 'pnotespegifreecmnt', 'pnotespegistoolstatus', 'pnotespegistoolcmnt', 'pnotespegugender', 'pnotespegupenisstatus', 'pnotespegupeniscmnt', 'pnotespegutestesstatus', 'pnotespegutestescmnt', 'pnotespeguproststatus', 'pnotespeguprostcmnt', 'pnotespeguextgenstatus', 'pnotespeguextgencmnt', 'pnotespegucervixstatus', 'pnotespegucervixcmnt', 'pnotespeguutadnstatus', 'pnotespeguutadncmnt', 'pnotespegufreecmnt', 'pnotespelympnodesstatus', 'pnotespelympnodescmnt', 'pnotespelympfreecmnt', 'pnotespeskintissuestatus', 'pnotespeskintissuecmnt', 'pnotespeskinfreecmnt', 'pnotespemsgaitststatus', 'pnotespemsgaitstcmnt', 'pnotespemsdignlsstatus', 'pnotespemsdignlscmnt', 'pnotespemsromstbstatus', 'pnotespemsromstbcmnt', 'pnotespemsjntbnsmusstatus', 'pnotespemsjntbnsmuscmnt', 'pnotespemsmusstrtnstatus', 'pnotespemsmusstrtncmnt', 'pnotespemsfreecmnt', 'pnotespeneurocrnervstatus', 'pnotespeneurocrnervcmnt', 'pnotespeneurodtrsstatus', 'pnotespeneurodtrscmnt', 'pnotespeneuromotorstatus', 'pnotespeneuromotorcmnt', 'pnotespeneurosnststatus', 'pnotespeneurosnstcmnt', 'pnotespeneurofreecmnt', 'pnotespepsychjudinsstatus', 'pnotespepsychjudinscmnt', 'pnotespepsychmoodeffstatus', 'pnotespepsychmoodeffcmnt', 'pnotespepsychorntppstatus', 'pnotespepsychorntppcmnt', 'pnotespepsychmemorystatus', 'pnotespepsychmemorycmnt', 'pnotespepsychfreecmnt', 'pnotesbillable', 'pnoteshandp');
    protected function add_pre(&$data)
    {
        $data['pnotesuser'] = freemed::user_cache()->user_number;
    }
Example #4
0
 protected function GenerateReport_Graph($param, $format, $query, $params = NULL)
 {
     freemed::acl_enforce('reporting', 'write');
     // Execute query
     $res = $GLOBALS['sql']->queryAllStoredProc($query);
     // Get keys
     foreach ($res[0] as $k => $v) {
         if (!is_integer($k)) {
             $ks[] = $k;
         }
     }
     $primary_key = $ks[0];
     unset($ks[0]);
     foreach ($ks as $v) {
         $keys[] = $v;
     }
     // Create Image_Graph
     LoadObjectDependency('net.php.pear.Image_Graph');
     $g =& Image_Graph::factory('graph', array(800, 600));
     $f =& $g->addNew('ttf_font', dirname(__FILE__) . '/../data/fonts/FreeSans.ttf');
     $f->setSize(10);
     $g->setFont($f);
     $g->add(Image_Graph::vertical(Image_Graph::vertical(Image_Graph::factory('title', array($param['report_name'], 12)), Image_Graph::factory('title', array(__('Generated') . ' ' . date('r'), 8)), 80), Image_Graph::vertical($plotarea = Image_Graph::factory('plotarea'), $legend = Image_Graph::factory('legend'), 85), 5));
     $legend->setPlotarea($plotarea);
     // Fancy background stuff
     $FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
     $FillArray->addColor('blue@0.2');
     $FillArray->addColor('yellow@0.2');
     $FillArray->addColor('green@0.2');
     $plotarea->setFillStyle($FillArray);
     $plotarea->setFillColor('silver@0.3');
     $Grid =& $plotarea->addNew('line_grid', IMAGE_GRAPH_AXIS_X);
     $Grid->setLineColor('silver');
     foreach ($keys as $k => $v) {
         $data[$k] =& Image_Graph::factory('dataset');
         $data[$k]->setName($v);
         // Load data
         foreach ($res as $r) {
             $data[$k]->addPoint($r[$primary_key], $r[$v]);
         }
         $plot[$k] =& $plotarea->addNew('line', array($data[$k]));
         //$plot[$k] =& $plotarea->addNew( 'Image_Graph_Plot_Smoothed_Area', array( $data[ $k ] ) );
     }
     // Check plot colors
     $colors = array('red', 'blue', 'green', 'yellow', 'purple', 'black', 'orange');
     foreach ($plot as $k => $v) {
         $plot[$k]->setLineColor($colors[$k]);
         //$plot[ $k ]->setFillColor( $colors[ $k ].'@0.3' );
     }
     $g->setPadding(10);
     $g->done();
 }
Example #5
0
// 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include_once dirname(__FILE__) . '/php-gettext/gettext.inc';
include_once dirname(__FILE__) . '/iso-set.php';
if (!defined('SESSION_DISABLE')) {
    LoadObjectDependency('net.php.pear.HTTP_Session2');
    $lang = HTTP_Session2::get('language', DEFAULT_LANGUAGE);
} else {
    $lang = DEFAULT_LANGUAGE;
}
$locale_dir = dirname(dirname(__FILE__)) . '/locale';
$__domains = array('freemed', UI);
_setlocale(LC_MESSAGES, $lang);
$GLOBALS['ISOSET'] = language2isoset($lang);
foreach ($__domains as $_v) {
    _bindtextdomain($_v, $locale_dir);
    _bind_textdomain_codeset($_v, language2isoset($lang));
    _textdomain($_v);
}
function get_translation_matrix($domain)
{
Example #6
0
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.Handler_HL7v2');
class Handler_HL7v2_S12 extends Handler_HL7v2
{
    public function Handle()
    {
        syslog(LOG_INFO, 'HL7 parser| Entered S12 parser');
        if (!is_object($this->parser)) {
            die('Handler_HL7v2_S12: parser object not present');
        }
        // FIXME: SHOULD HANDLE AIL SEGMENT FOR LOCATION
        // For now, one PID per message - FIXME
        $p = $this->parser->message['PID'][0];
        foreach ($this->parser->message['SCH'] as $k => $v) {
            $pr = $this->parser->message['AIP'][$k];
            // Use scheduler API
            $c = CreateObject('org.freemedsoftware.api.Scheduler');
Example #7
0
printHeader("Install ACL tables");
loadSchema('acl');
// Add the administrative account
printHeader("Add an administrative account");
print "\nPlease enter an username for your administrative account [root] : ";
$username = getInput('%s');
if ($username == "") {
    $username = "******";
}
print "\nPlease enter a password for your administrative account : ";
$password = getInput('%s');
if ($nimode) {
    $username = '******';
    $password = '******';
}
LoadObjectDependency("org.freemedsoftware.public.Installation");
Installation::CreateAdministrationAccount($username, $password);
print "\n\n";
printHeader("Form ACL rules for users");
include_once dirname(__FILE__) . '/../lib/acl.php';
include_once dirname(__FILE__) . '/../lib/org/freemedsoftware/module/ACL.class.php';
$a = new ACL();
$q = "SELECT username, id FROM user WHERE id > 0";
$r = $GLOBALS['sql']->queryAll($q);
foreach ($r as $user) {
    print " - Adding ACL record for user " . $user['username'] . " (" . $user['id'] . ") \n";
    $a->UserAdd($r['id']);
}
printHeader("Create 'healthy system' status");
`touch ./data/cache/healthy`;
printHeader("Force module definition upgrades");
Example #8
0
function InstantiateClass($path, $class_name)
{
    static $shared;
    $session_id = session_id();
    // Check for global SHM_CACHE setting
    if (!defined('SHM_CACHE') or !SHM_CACHE) {
        //syslog( LOG_DEBUG, "InstantiateClass : not caching {$class_name} for session {$session_id}" );
        include_once $path;
        $x = new ${class_name}();
        return $x;
    }
    if (!isset($shared)) {
        LoadObjectDependency('net.php.pear.System_SharedMemory');
        $shared =& System_SharedMemory::factory();
    }
    include_once $path;
    $x = $shared->get("object-{$class_name}-{$session_id}");
    if (isset($x)) {
        syslog(LOG_DEBUG, 'InstantiateClass : loaded object-' . $class_name . '-' . $session_id . ' from SHM');
        return $x;
    } else {
        $x = new ${class_name}();
        syslog(LOG_DEBUG, 'InstantiateClass : stored object-' . $class_name . '-' . $session_id . ' in SHM');
        $shared->set("object-{$class_name}-{$session_id}", $x);
        return $x;
    }
}
Example #9
0
 private function acl_object()
 {
     static $_obj;
     if (!isset($_obj)) {
         LoadObjectDependency('org.freemedsoftware.acl.gacl');
         $_obj = CreateObject('org.freemedsoftware.acl.gacl_api', array('db_type' => 'mysql', 'db_host' => DB_HOST, 'db_user' => DB_USER, 'db_password' => DB_PASSWORD, 'db_name' => DB_NAME, 'db_table_prefix' => 'acl_', 'debug' => false, 'caching' => true, 'force_cache_expire' => true, 'cache_expire_time' => 600));
     }
     return $_obj;
 }
Example #10
0
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.Relay');
// Class: org.freemedsoftware.core.Relay_Json
//
//	JSON data relay methods.
//
class Relay_Json extends Relay
{
    // Method: deserialize_request
    //
    //	Deserialize the incoming request
    //
    // Parameters:
    //
    //	$request - Request, as received by the relay
    //
    // Returns:
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.BillingModule');
class RemittBillingTransport extends BillingModule
{
    var $MODULE_NAME = "Remitt Billing System";
    var $MODULE_VERSION = "0.1";
    var $MODULE_FILE = __FILE__;
    var $MODULE_UID = "5ed9be92-fd93-40b4-8f4d-1858be548e02";
    public function __construct()
    {
        //	__("Remitt Billing System")
        // Set configuration variables (username/password)
        $this->_SetMetaInformation('global_config_vars', array('remitt_url', 'remitt_user', 'remitt_pass'));
        // Set appropriate associations
        $this->_SetHandler('BillingFunctions', 'transport');
        $this->_SetMetaInformation('BillingFunctionName', __("Remitt Billing System"));
        $this->_SetMetaInformation('BillingFunctionDescription', __("Use the Remitt formatting and transport system to send insurance claims electronically or generate paper claims."));
Example #12
0
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.FPDF');
// Class: org.freemedsoftware.core.FPDF_Report
//
//	FPDF derived class for report generation
//
class FPDF_Report extends FPDF
{
    private $_keys;
    private $_maxlength;
    private $_totalsize;
    private $_reportName;
    private $_aSize;
    private $_timestamp;
    // Method: LoadData
    //
    //	Import a query from an SQL statement
Example #13
0
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
if (!$_SERVER['argc']) {
    die("cannot be called via web");
}
ini_set('include_path', dirname(dirname(__FILE__)) . ':' . ini_get('include_path'));
define('SESSION_DISABLE', true);
include_once 'lib/freemed.php';
LoadObjectDependency('net.php.pear.Console_Getopt');
print "Upgrade from 0.8.x Tool\n";
print "(c) 2008-2015 FreeMED Software Foundation\n\n";
function getInput($mask)
{
    fscanf(STDIN, "{$mask}\n", $x);
    return $x;
}
function execSql($s)
{
    print " - Executing \"{$s}\" : ";
    $GLOBALS['sql']->query($s);
    print " ... [done]\n";
}
function printHeader($x)
{
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
LoadObjectDependency('org.freemedsoftware.core.Generator');
class Generator_HL7v2_A04 implements Generator
{
    public $EVENT_TYPE = "A04";
    public $EOS = "\r\n";
    public function generate($data)
    {
        $p = $GLOBALS['sql']->queryRow("SELECT pt.* " . "FROM patient pt " . "WHERE pt.ptarchive = 0 " . " AND pt.id=" . $GLOBALS['sql']->quote($data));
        $stamp = date('YmdHi');
        $gender = strtoupper($pt['ptsex']);
        $dob = str_replace("-", "", $p['ptdob']);
        $fullstamp = mktime();
        // TODO
        $addresstype = "";
        $country = "";
        $maritalstatus = "";