FreeMED. EMRModule

Electronic Medical Record module superclass.  It is descended from BaseModule.

Summary
Electronic Medical Record module superclass.
Specifies the format of the widget method.
Whether or not to disable the patient box display at the top of the screen.
Field name that contains the date pertaining to the EMR record fragment in question.
Field name that describes the patient.
Hash describing the format which is used to display the current record by default.
An SQL logical phrase which is used to pare down the results from a summary view query.
Allows another table (or more) to be “linked” via a WHERE clause.
The order in which the EMR summary items are displayed.
Specifies the format of the XML-RPC structures returned by the FreeMED.DynamicModule.picklist method.
Determines if record id is locked or not.
Stub function.
Should be overridden by any module which needs different access checks.
Builds the table used by the add/mod form methods, and returns it as an associative array which is passed to <html_form::form_table>.
Callback to allow additional summary icons to be added.
Produces the text for the EMR summary bar menu.
Generic widget code to allow a picklist-based widget for simple modules.
Return most recent record, possibly qualified by a particular date.
Render internal record for printing directly to a PDF file.
Internal TeX renderer for the record.
Render out ##a:b@c## or ##a## type fields.
Callback to provide information to the TeX renderer about formatting.

Variables

$this->widget_hash

Specifies the format of the widget method.  This is formatted by having SQL field names surrounded by ‘##’s.

Example

$this->widget_hash = ‘##phylname##, ##phyfname##’;

disable_patient_box

var $disable_patient_box

Whether or not to disable the patient box display at the top of the screen.  Defaults to false.

date_field

var $date_field

Field name that contains the date pertaining to the EMR record fragment in question.  This is used by certain routines in FreeMED to guess as to the most accurate piece of information for a particular query.

Example

$this->date_field = ‘rxdtfrom’;

patient_field

var $patient_field

Field name that describes the patient.  This is used by FreeMED’s module handler to determine whether a record should be displayed in the EMR summary screen.

Example

$this->patient_field = ‘eocpatient’;

display_format

var $display_format

Hash describing the format which is used to display the current record by default.  It needs to be overridden by child classes.  It uses ‘##’ seperated values to signify variables.

Example

$this->display_format = ‘##phylname##, ##phyfname##’;

summary_conditional

var $summary_conditional

An SQL logical phrase which is used to pare down the results from a summary view query.

Example

$this->summary_conditional = “ptsex = ‘m’”;

summary_query_link

var $summary_query_link

Allows another table (or more) to be “linked” via a WHERE clause.

Example

$this->summary_query_link = array (‘payrecproc’, ‘procrec’);

See Also

<summary>

summary_order_by

var $summary_order_by

The order in which the EMR summary items are displayed.  This is passed verbatim to an SQL “ORDER BY” clause, so DESC can be used.  Defaults to ‘id’ if nothing else is specified.

Example

$this->summary_order_by = ‘eocdtlastsimilar, eocstate DESC’;

See Also

<summary>

$this->rpc_field_map

Specifies the format of the XML-RPC structures returned by the FreeMED.DynamicModule.picklist method.  These are passed as key => value, where key is the target name of the structure item and value is the name of the SQL field.  “id” is passed as “id” by default, as <$this->patient_field> is passed as “patient”.  If this is not defined, FreeMED.DynamicModule.picklist will fail for the target module.

Example

$this->rpc_field_map = array ( ‘last_name’ => ‘ptlname’ );

Functions

locked

function locked ($id,  
$quiet =  false)

Determines if record id is locked or not.

Parameters

$idRecord id to be checked
$quiet(optional) Boolean.  If set to true, this value will cause a denial screen to be displayed.  Defaults to false.

Returns

Boolean, whether the record is locked or not.

Example

if ($this->locked($id)) return false;

additional_move

function additional_move ($id,
$from,
$to)

Stub function.  Define additional EMR movement functionality per module.  Note that this function does not perform the actual move, but instead moves support files, et cetera.

Parameters

$idId of the record in question
$fromOriginal patient
$toDestination patient

acl_access

function acl_access ($type,
$patient)

Should be overridden by any module which needs different access checks.

form_table

function form_table ()

Builds the table used by the add/mod form methods, and returns it as an associative array which is passed to <html_form::form_table>.  By default this returns NULL and needs to be overridden by child classes.  It is only used if the default <form> method is used.

Returns

Associative array describing form.

See Also

<form>

additional_summary_icons

function additional_summary_icons ($patient,
$id)

Callback to allow additional summary icons to be added.  Each icon should be prefixed with a linefeed (\n) character to be equally spaced in the output.  By default this is just a stub.

Parameters

$patientPatient record id
$idRecord id

Returns

HTML code for additional icons

summary_bar

function summary_bar ($patient)

Produces the text for the EMR summary bar menu.  By default it produces View/Manage and Add links.  Override this function to change the basic EMR summary bar menu.

Parameters

$patientId of current patient

Returns

XHTML formatted text links.

picklist

function picklist ($criteria)

Parameters

$criteriaHash of criteria information.  If this is to be patient specific, ‘patient’ must be passed with the patient id number.

Returns

Array of hashes

See Also

$this->rpc_field_map

widget

function widget ($varname,  
$patient,  
$conditions =  false,
$keyfield =  'id')

Generic widget code to allow a picklist-based widget for simple modules.  Should be overridden for more complex tasks.

This function uses $this->widget_hash, which contains field names surrounded by ‘##’s.

Parameters

$varnameName of the variable that the widget’s data is passed in.
$patientId of patient this deals with.
$conditions(optional) Additional clauses for SQL WHERE. defaults to none.
$keyfield(optional) Field used as key.  Defaults to ‘id’.

Returns

XHTML-compliant picklist widget.

_recent_record

function _recent_record ($patient,  
$recent_date =  NULL)

Return most recent record, possibly qualified by a particular date.

Parameters

$patientId of patient record
$recent_date(optional) Date to qualify this by

Returns

Associative array (hash) of record

_RenderToPDF

function _RenderToPDF ($record)

Render internal record for printing directly to a PDF file.

Parameters

$recordRecord id

Returns

File name of destination PDF file

_RenderTeX

function _RenderTeX ($TeX,
$id)

Internal TeX renderer for the record.  By default this uses the <print_format> class variable to determine the proper format.  If another format is to be used, override this class.

Parameters

$TeXFreeMED.TeX object reference.  Must be prefixed by an amphersand, otherwise changes will be lost!
$idRecord id to be printed

Example

$this->_RenderTeX ( &$TeX, $id );

See Also

_RenderField

_RenderField

function _RenderField ($arg,  
$r =  NULL)

Render out ##a:b@c## or ##a## type fields.  “a” stands for the record, “b” stands for the target field, and “c” stands for the target table.

Parameters

$argFormatted field
$rAssociative array containing record

Returns

Rendered field

Example

$return = $this->_RenderField ( ‘##eocpatient:ptlname@patient##’ );

_TeX_Information

function _TeX_Information ( )

Callback to provide information to the TeX renderer about formatting.

Returns

Array ( title, heading, physician )

function widget ($varname,  
$patient,  
$conditions =  false,
$keyfield =  'id')
Generic widget code to allow a picklist-based widget for simple modules.
var $disable_patient_box
Whether or not to disable the patient box display at the top of the screen.
var $date_field
Field name that contains the date pertaining to the EMR record fragment in question.
var $patient_field
Field name that describes the patient.
var $display_format
Hash describing the format which is used to display the current record by default.
var $summary_conditional
An SQL logical phrase which is used to pare down the results from a summary view query.
var $summary_query_link
Allows another table (or more) to be “linked” via a WHERE clause.
var $summary_order_by
The order in which the EMR summary items are displayed.
function locked ($id,  
$quiet =  false)
Determines if record id is locked or not.
function additional_move ($id,
$from,
$to)
Stub function.
function acl_access ($type,
$patient)
Should be overridden by any module which needs different access checks.
function form_table ()
Builds the table used by the add/mod form methods, and returns it as an associative array which is passed to html_form::form_table.
function additional_summary_icons ($patient,
$id)
Callback to allow additional summary icons to be added.
function summary_bar ($patient)
Produces the text for the EMR summary bar menu.
function picklist ($criteria)
function _recent_record ($patient,  
$recent_date =  NULL)
Return most recent record, possibly qualified by a particular date.
function _RenderToPDF ($record)
Render internal record for printing directly to a PDF file.
function _RenderTeX ($TeX,
$id)
Internal TeX renderer for the record.
function _RenderField ($arg,  
$r =  NULL)
Render out ##a:b@c## or ##a## type fields.
function _TeX_Information ( )
Callback to provide information to the TeX renderer about formatting.
Basic FreeMED module class.
Specifies the format of the XML-RPC structures returned by the FreeMED.DynamicModule.picklist method.
LaTeX rendering class.