r5835 - in branches/bmas-staging: data/schema/mysql lib/org/freemedsoftware/module ui/gwt/www/resources/interface

0 views
Skip to first unread message

subve...@svn.freemedsoftware.org

unread,
Sep 1, 2010, 2:36:17 PM9/1/10
to freemed-d...@googlegroups.com
Author: jeff
Date: 2010-09-01 14:36:17 -0400 (Wed, 01 Sep 2010)
New Revision: 5835

Added:
branches/bmas-staging/data/schema/mysql/shimstation.sql
branches/bmas-staging/lib/org/freemedsoftware/module/ShimStation.class.php
branches/bmas-staging/ui/gwt/www/resources/interface/ShimStation.module.xml
Log:
Add basic SHIM station table and interface components.


Added: branches/bmas-staging/data/schema/mysql/shimstation.sql
===================================================================
--- branches/bmas-staging/data/schema/mysql/shimstation.sql (rev 0)
+++ branches/bmas-staging/data/schema/mysql/shimstation.sql 2010-09-01 18:36:17 UTC (rev 5835)
@@ -0,0 +1,83 @@
+# $Id$
+#
+# Authors:
+# Jeff Buchbinder <je...@freemedsoftware.org>
+#
+# FreeMED Electronic Medical Record and Practice Management System
+# Copyright (C) 1999-2010 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.
+
+SOURCE data/schema/mysql/facility.sql
+
+CREATE TABLE IF NOT EXISTS `shimstation` (
+ name VARCHAR (50) NOT NULL
+ , location VARCHAR (150)
+ , facility INT UNSIGNED NOT NULL
+ , username VARCHAR (50)
+ , password VARCHAR (50)
+ , service_url VARCHAR (150)
+ , ip VARCHAR (50)
+
+ ### Capabilities ###
+ , dosing_enabled TINYINT NOT NULL DEFAULT 0
+ , label_enabled TINYINT NOT NULL DEFAULT 0
+ , signature_enabled TINYINT NOT NULL DEFAULT 0
+ , vitals_enabled TINYINT NOT NULL DEFAULT 0
+
+ ### Dosing specific fields ###
+ , dosing_last_close DATE
+ , dosing_open ENUM( 'open', 'closed' ) NOT NULL DEFAULT 'closed'
+ , dosing_bottle INT UNSIGNED
+ , dosing_bottle_quantity INT(10) UNSIGNED NOT NULL DEFAULT 0
+ , dosing_lot INT UNSIGNED
+
+ , id SERIAL
+
+ # Define keys
+ , FOREIGN KEY ( facility ) REFERENCES facility.id ON DELETE CASCADE
+);
+
+DROP PROCEDURE IF EXISTS shimstation_Upgrade;
+DELIMITER //
+CREATE PROCEDURE shimstation_Upgrade ( )
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+
+ #----- Upgrades
+END//
+DELIMITER ;
+CALL shimstation_Upgrade( );
+
+#----- Define specific configuration options -----
+
+CALL config_Register (
+ 'check_pump_status',
+ '1',
+ 'Check Pump Status While Dispensing',
+ 'Dispensing',
+ 'YesNo',
+ ''
+);
+
+CALL config_Register (
+ 'bypass_comm_err',
+ '0',
+ 'Bypass Communication Errors When Opening and Closing Dosing Station',
+ 'Dispensing',
+ 'YesNo',
+ ''
+);
+


Property changes on: branches/bmas-staging/data/schema/mysql/shimstation.sql
___________________________________________________________________
Added: svn:keywords
+ Id Author Revision Date
Added: svn:eol-style
+ native

Added: branches/bmas-staging/lib/org/freemedsoftware/module/ShimStation.class.php
===================================================================
--- branches/bmas-staging/lib/org/freemedsoftware/module/ShimStation.class.php (rev 0)
+++ branches/bmas-staging/lib/org/freemedsoftware/module/ShimStation.class.php 2010-09-01 18:36:17 UTC (rev 5835)
@@ -0,0 +1,112 @@
+<?php
+ // $Id$
+ //
+ // Authors:
+ // Jeff Buchbinder <je...@freemedsoftware.org>
+ //
+ // FreeMED Electronic Medical Record and Practice Management System
+ // Copyright (C) 1999-2010 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 ShimStation extends SupportModule {
+
+ var $MODULE_NAME = "Shim Station";
+ var $MODULE_VERSION = "0.1";
+ var $MODULE_FILE = __FILE__;
+ var $MODULE_UID = "49d646d4-d272-4a48-891a-168847ce7457";
+
+ var $PACKAGE_MINIMUM_VERSION = '0.9.0';
+
+ var $table_name = "shimstation";
+
+ var $acl_category = 'emr';
+
+ var $variables = array (
+ 'name'
+ , 'location'
+ , 'facility'
+ , 'username'
+ , 'password'
+ , 'url'
+ , 'ip'
+ , 'dosing_enabled'
+ , 'label_enabled'
+ , 'signature_enabled'
+ , 'vitals_enabled'
+ , 'dosing_last_close'
+ , 'dosing_open'
+ , 'dosing_bottle'
+ , 'dosing_lot'
+ );
+
+ public function __construct ( ) {
+ // DEBUG TESTING: $this->defeat_acl = true;
+ $this->table_join=array('facility' => 'facility');
+ $this->additional_fields= array (
+ "psrname AS facility"
+ );
+ // Call parent constructor
+ parent::__construct ( );
+ } // end constructor PatientModule
+
+ protected function add_pre ( &$data ) {
+ } // end method add_pre
+
+ public function GetAll ( ) {
+ $today = date('Y-m-d');
+ $q = "SELECT id AS Id, location AS ds_location, name as D_name from shimstation WHERE facility=".((int) HTTP_Session2::get('facility_id'))." AND dsopen='closed' AND dosing_last_close != '".$today."' AND ip='".$_SERVER['REMOTE_ADDR']."';";
+ return $GLOBALS['sql']->queryAll( $q );
+ } // end method GetAll
+
+ public function getStationsByType($type) {
+ switch ($type) {
+ case 'dosing':
+ case 'label':
+ case 'signature':
+ case 'vitals':
+ $c = $type . "_enabled = 1";
+ break;
+
+ default:
+ return NULL;
+ break;
+ }
+ $q = "SELECT id AS Id, location AS ds_location, name as D_name from shimstation WHERE $c AND facility=".((int)HTTP_Session2::get('facility_id'))." AND ip='".$_SERVER['REMOTE_ADDR']."';";
+ syslog(LOG_INFO, $q);
+ return $GLOBALS['sql']->queryAll( $q );
+ }
+
+ public function dateDiff($startDate, $endDate)
+ {
+ // Parse dates for conversion
+ $startArry = date_parse($startDate);
+ $endArry = date_parse($endDate);
+
+ // Convert dates to Julian Days
+ $start_date = gregoriantojd($startArry["month"], $startArry["day"], $startArry["year"]);
+ $end_date = gregoriantojd($endArry["month"], $endArry["day"], $endArry["year"]);
+
+ // Return difference
+ return round(($end_date - $start_date), 0);
+ }
+
+} // end class ShimStation
+
+register_module('ShimStation');
+
+?>


Property changes on: branches/bmas-staging/lib/org/freemedsoftware/module/ShimStation.class.php
___________________________________________________________________
Added: svn:keywords
+ Id Author Revision Date
Added: svn:eol-style
+ native

Added: branches/bmas-staging/ui/gwt/www/resources/interface/ShimStation.module.xml
===================================================================
--- branches/bmas-staging/ui/gwt/www/resources/interface/ShimStation.module.xml (rev 0)
+++ branches/bmas-staging/ui/gwt/www/resources/interface/ShimStation.module.xml 2010-09-01 18:36:17 UTC (rev 5835)
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ $Id$
+
+ Authors:
+ Jeff Buchbinder <je...@freemedsoftware.org>
+
+ FreeMED Electronic Medical Record and Practice Management System
+ Copyright (C) 1999-2010 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.
+ -->
+<SimpleUIBuilder module="ShimStation">
+ <Elements>
+ <Element field="name" title="SHIM Station Name" type="TEXT" options="50" display="1" />
+ <Element field="location" title="Location" type="TEXT" options="75" />
+ <Element field="facility" title="Facility" type="TEXT" options="75" display="1"/>
+ <Element field="username" title="Username" type="TEXT" options="50" />
+ <Element field="password" title="Password" type="TEXT" options="50" />
+ <Element field="url" title="Station WSDL URL" type="TEXT" options="75" display="1" />
+ <Element field="ip" title="Station IP" type="TEXT" options="50" display="1" />
+ <Element field="dosing_enabled" title="Dosing Enabled" type="SELECT" options="True|1,False|0" />
+ <Element field="label_enabled" title="Label Printing Enabled" type="SELECT" options="True|1,False|0" />
+ <Element field="signature_enabled" title="Signature Enabled" type="SELECT" options="True|1,False|0" />
+ <Element field="vitals_enabled" title="Vitals Enabled" type="SELECT" options="True|1,False|0" />
+ <Element field="dosing_open" title="Status" type="SELECT" options="Close|closed,Open|open" />
+ </Elements>
+</SimpleUIBuilder>


Property changes on: branches/bmas-staging/ui/gwt/www/resources/interface/ShimStation.module.xml
___________________________________________________________________
Added: svn:keywords
+ Id Author Revision Date
Added: svn:eol-style
+ native

Reply all
Reply to author
Forward
0 new messages