Permalink
Browse files

Added transmit timestamp to orders and logic to set and check it.

  • Loading branch information...
1 parent 3d0c9ef commit 83ea26eb5679c307ae9eac2f0eeeff2a00969187 @sunsetsystems sunsetsystems committed Mar 21, 2013
Showing with 46 additions and 10 deletions.
  1. +25 −6 interface/forms/procedure_order/new.php
  2. +11 −3 interface/orders/list_reports.php
  3. +8 −0 sql/4_1_1-to-4_1_2_upgrade.sql
  4. +1 −0 sql/database.sql
  5. +1 −1 version.php
@@ -158,11 +158,12 @@ function QuotedOrNull($fld) {
if (empty($alertmsg)) {
$alertmsg = send_hl7_order($ppid, $hl7);
}
+ if (empty($alertmsg)) {
+ sqlStatement("UPDATE procedure_order SET date_transmitted = NOW() WHERE " .
+ "procedure_order_id = ?", array($formid));
+ }
}
- // TBD: Implement and set a transmit date in the order.
- // Add code elsewhere to show a warning if a previously transmitted order is opened.
-
formHeader("Redirecting....");
if ($alertmsg) {
echo "\n<script language='Javascript'>alert('";
@@ -329,13 +330,31 @@ function sel_related(varname) {
dlgopen('find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
}
+var transmitting = false;
+
+// Issue a Cancel/OK warning if a previously transmitted order is being transmitted again.
+function validate(f) {
+<?php if (!empty($row['date_transmitted'])) { ?>
+ if (transmitting) {
+ if (!confirm('<?php echo xls('This order was already transmitted on') . ' ' .
+ addslashes($row['date_transmitted']) . '. ' .
+ xls('Are you sure you want to transmit it again?'); ?>')) {
+ return false;
+ }
+ }
+<?php } ?>
+ top.restoreSession();
+ return true;
+}
+
</script>
</head>
<body class="body_top">
-<form method="post" action="<?php echo $rootdir ?>/forms/procedure_order/new.php?id=<?php echo $formid ?>" onsubmit="return top.restoreSession()">
+<form method="post" action="<?php echo $rootdir ?>/forms/procedure_order/new.php?id=<?php echo $formid ?>"
+ onsubmit="return validate(this)">
<p class='title' style='margin-top:8px;margin-bottom:8px;text-align:center'>
<?php
@@ -517,9 +536,9 @@ function sel_related(varname) {
<p>
<input type='button' value='<?php echo xla('Add Procedure'); ?>' onclick="addProcLine()" />
&nbsp;
-<input type='submit' name='bn_save' value='<?php echo xla('Save'); ?>' />
+<input type='submit' name='bn_save' value='<?php echo xla('Save'); ?>' onclick='transmitting = false;' />
&nbsp;
-<input type='submit' name='bn_xmit' value='<?php echo xla('Save and Transmit'); ?>' />
+<input type='submit' name='bn_xmit' value='<?php echo xla('Save and Transmit'); ?>' onclick='transmitting = true;' />
&nbsp;
<input type='button' value='<?php echo xla('Cancel'); ?>' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
</p>
@@ -161,8 +161,13 @@ function openResults(orderid) {
&nbsp;
<select name='form_reviewed'>
<?php
-foreach (array('1' => xl('All'), '2' => xl('Reviewed'), '3' => xl('Unreviewed'),
- '4' => xl('Unreceived')) as $key => $value) {
+foreach (array(
+ '1' => xl('All'),
+ '2' => xl('Reviewed'),
+ '3' => xl('Received, not reviewed'),
+ '4' => xl('Sent, not received'),
+ '5' => xl('Not sent'),
+ ) as $key => $value) {
echo "<option value='$key'";
if ($key == $form_reviewed) echo " selected";
echo ">" . text($value) . "</option>\n";
@@ -259,7 +264,10 @@ function openResults(orderid) {
$where .= " AND pr.procedure_report_id IS NOT NULL AND pr.review_status != 'reviewed'";
}
else if ($form_reviewed == 4) {
- $where .= " AND pr.procedure_report_id IS NULL";
+ $where .= " AND po.date_transmitted IS NOT NULL AND pr.procedure_report_id IS NULL";
+}
+else if ($form_reviewed == 5) {
+ $where .= " AND po.date_transmitted IS NULL AND pr.procedure_report_id IS NULL";
}
$query = "SELECT po.patient_id, " .
@@ -352,3 +352,11 @@ UPDATE code_types SET ct_problem = 1 WHERE ct_key='ICD10';
UPDATE code_types SET ct_problem = 1 WHERE ct_key='SNOMED';
#EndIf
+#IfMissingColumn procedure_order date_transmitted
+ALTER TABLE `procedure_order`
+ ADD COLUMN `date_transmitted` datetime DEFAULT NULL COMMENT
+ 'time of order transmission, null if unsent';
+UPDATE procedure_order SET date_transmitted = date_ordered WHERE
+ date_transmitted IS NULL AND date_ordered IS NOT NULL;
+#EndIf
+
View
@@ -5465,6 +5465,7 @@ CREATE TABLE `procedure_order` (
`specimen_type` varchar(31) NOT NULL DEFAULT '' COMMENT 'from the Specimen_Type list',
`specimen_location` varchar(31) NOT NULL DEFAULT '' COMMENT 'from the Specimen_Location list',
`specimen_volume` varchar(30) NOT NULL DEFAULT '' COMMENT 'from a text input field',
+ `date_transmitted` datetime DEFAULT NULL COMMENT 'time of order transmission, null if unsent',
PRIMARY KEY (`procedure_order_id`),
KEY datepid (date_ordered, patient_id),
KEY `patient_id` (`patient_id`)
View
@@ -17,7 +17,7 @@
// is a database change in the course of development. It is used
// internally to determine when a database upgrade is needed.
//
-$v_database = 90;
+$v_database = 91;
// Access control version identifier, this is to be incremented whenever there
// is a access control change in the course of development. It is used

0 comments on commit 83ea26e

Please sign in to comment.