Permalink
Browse files

Latest meaningful use changes

Signed-off-by: Vinish K <vinish@zhservices.com>
  • Loading branch information...
1 parent 7c702dc commit 9f7e1dcfd6fb3f62cdd8f05ce50cdcb696fdcff8 @vinish vinish committed with bradymiller Dec 20, 2016
@@ -51,6 +51,11 @@
}
$check_res = $formid ? $check_res : array();
+$sql1 = "SELECT option_id AS `value`, title FROM `list_options` WHERE list_id = ?";
+$result = sqlStatement($sql1, array('Plan_of_Care_Type'));
+foreach($result as $value):
+ $care_plan_type[] = $value;
+endforeach;
?>
<html>
<head>
@@ -78,6 +83,7 @@ function duplicateRow(e) {
changeIds('img_code_date');
changeIds('code_date');
changeIds('displaytext');
+ changeIds('care_plan_type');
changeIds('count');
removeVal(newRow.id);
}
@@ -91,6 +97,7 @@ function removeVal(rowid)
document.getElementById("img_code_date_" + rowid1[1]).value = '';
document.getElementById("code_date_" + rowid1[1]).value = '';
document.getElementById("displaytext_" + rowid1[1]).innerHTML = '';
+ document.getElementById("care_plan_type_" + rowid1[1]).value = '';
}
function changeIds(class_val) {
@@ -124,7 +131,7 @@ function sel_code(id)
id = id.split('tb_row_');
var checkId = '_' + id[1];
document.getElementById('clickId').value = checkId;
- dlgopen('<?php echo $GLOBALS['webroot'] . "/interface/patient_file/encounter/" ?>find_code_popup.php?codetype=SNOMED-CT', '_blank', 700, 400);
+ dlgopen('<?php echo $GLOBALS['webroot'] . "/interface/patient_file/encounter/" ?>find_code_popup.php?codetype=SNOMED-CT,LOINC,CPT4', '_blank', 700, 400);
}
function set_related(codetype, code, selector, codedesc) {
@@ -144,31 +151,42 @@ function set_related(codetype, code, selector, codedesc) {
if (!empty($check_res)) {
foreach ($check_res as $key => $obj) {
?>
- <tr class="tb_row" id="tb_row_<?php echo $key + 1; ?>">
+ <tr class="tb_row" id="tb_row_<?php echo attr($key) + 1; ?>">
<td align="left" class="forms"><?php echo xlt('Code'); ?>:</td>
<td class="forms">
- <input type="text" id="code_<?php echo $key + 1; ?>" style="width:210px" name="code[]" class="code" value="<?php echo text($obj{"code"}); ?>" onclick='sel_code(this.parentElement.parentElement.id);'><br>
- <span id="displaytext_<?php echo $key + 1; ?>" style="width:210px !important;display: block;font-size:13px;color: blue;" class="displaytext"><?php echo text($obj{"codetext"}); ?></span>
- <input type="hidden" id="codetext_<?php echo $key + 1; ?>" name="codetext[]" class="codetext" value="<?php echo text($obj{"codetext"}); ?>">
+ <input type="text" id="code_<?php echo attr($key) + 1; ?>" style="width:210px" name="code[]" class="code" value="<?php echo text($obj{"code"}); ?>" onclick='sel_code(this.parentElement.parentElement.id);'><br>
+ <span id="displaytext_<?php echo attr($key) + 1; ?>" style="width:210px !important;display: block;font-size:13px;color: blue;" class="displaytext"><?php echo text($obj{"codetext"}); ?></span>
+ <input type="hidden" id="codetext_<?php echo attr($key) + 1; ?>" name="codetext[]" class="codetext" value="<?php echo text($obj{"codetext"}); ?>">
</td>
<td align="left" class="forms"><?php echo xlt('Description'); ?>:</td>
<td class="forms">
- <textarea rows="4" id="description_<?php echo $key + 1; ?>" cols="30" name="description[]" class="description"><?php echo text($obj{"description"}); ?></textarea>
+ <textarea rows="4" id="description_<?php echo attr($key) + 1; ?>" cols="30" name="description[]" class="description"><?php echo text($obj{"description"}); ?></textarea>
</td>
<td align="left" class="forms"><?php echo xlt('Date'); ?>:</td>
<td class="forms">
- <input type='text' id="code_date_<?php echo $key + 1; ?>" size='10' name='code_date[]' class="code_date" <?php echo attr($disabled) ?> value='<?php echo attr($obj{"date"}); ?>' title='<?php echo xla('yyyy-mm-dd Date of service'); ?>' onkeyup='datekeyup(this, mypcc)' onblur='dateblur(this, mypcc)' />
- <img src='../../pic/show_calendar.gif' align='absbottom' id="img_code_date_<?php echo $key + 1; ?>" width='24' height='22' class="img_code_date" border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to choose a date'); ?>'>
+ <input type='text' id="code_date_<?php echo attr($key) + 1; ?>" size='10' name='code_date[]' class="code_date" <?php echo attr($disabled) ?> value='<?php echo attr($obj{"date"}); ?>' title='<?php echo xla('yyyy-mm-dd Date of service'); ?>' onkeyup='datekeyup(this, mypcc)' onblur='dateblur(this, mypcc)' />
+ <img src='../../pic/show_calendar.gif' align='absbottom' id="img_code_date_<?php echo attr($key) + 1; ?>" width='24' height='22' class="img_code_date" border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to choose a date'); ?>'>
+ </td>
+ <td align="left" class="forms"><?php echo xlt('Type'); ?>:</td>
+ <td>
+ <select name="care_plan_type[]" id="care_plan_type_<?php echo attr($key) + 1; ?>" class="care_plan_type">
+ <option value=""></option>
+ <?php foreach($care_plan_type as $value):
+ $selected = ($value['value'] == $obj{"care_plan_type"}) ? 'selected="selected"' : '';
+ ?>
+ <option value="<?php echo attr($value['value']);?>" <?php echo $selected;?>><?php echo text($value['title']);?></option>
+ <?php endforeach;?>
+ </select>
</td>
<td>
<img src='../../pic/add.png' onclick="duplicateRow(this.parentElement.parentElement);" align='absbottom' width='27' height='24' border='0' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to duplicate the row'); ?>'>
<img src='../../pic/remove.png' onclick="deleteRow(this.parentElement.parentElement.id);" align='absbottom' width='24' height='22' border='0' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to delete the row'); ?>'>
</td>
<script language="javascript">
/* required for popup calendar */
- Calendar.setup({inputField: "code_date_<?php echo $key + 1; ?>", ifFormat: "%Y-%m-%d", button: "img_code_date_<?php echo $key + 1; ?>"});
+ Calendar.setup({inputField: "code_date_<?php echo attr($key) + 1; ?>", ifFormat: "%Y-%m-%d", button: "img_code_date_<?php echo $key + 1; ?>"});
</script>
- <input type="hidden" name="count[]" id="count_<?php echo $key + 1; ?>" class="count" value="<?php echo $key + 1;?>">
+ <input type="hidden" name="count[]" id="count_<?php echo attr($key) + 1; ?>" class="count" value="<?php echo attr($key) + 1;?>">
</tr>
<?php
}
@@ -188,7 +206,18 @@ function set_related(codetype, code, selector, codedesc) {
<td align="left" class="forms"><?php echo xlt('Date'); ?>:</td>
<td class="forms">
<input type='text' id="code_date_1" size='10' name='code_date[]' class="code_date" <?php echo attr($disabled) ?> value='<?php echo attr($obj{"date"}); ?>' title='<?php echo xla('yyyy-mm-dd Date of service'); ?>' onkeyup='datekeyup(this, mypcc)' onblur='dateblur(this, mypcc)' />
- <img src='../../pic/show_calendar.gif' align='absbottom' id="img_code_date_<?php echo $key + 1; ?>" width='24' height='22' class="img_code_date" border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to choose a date'); ?>'>
+ <img src='../../pic/show_calendar.gif' align='absbottom' id="img_code_date_<?php echo attr($key) + 1; ?>" width='24' height='22' class="img_code_date" border='0' alt='[?]' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to choose a date'); ?>'>
+ </td>
+ <td align="left" class="forms"><?php echo xlt('Type'); ?>:</td>
+ <td>
+ <select name="care_plan_type[]" id="care_plan_type_1" class="care_plan_type">
+ <option value=""></option>
+ <?php foreach($care_plan_type as $value):
+ $selected = ($value['value'] == $obj{"care_plan_type"}) ? 'selected="selected"' : '';
+ ?>
+ <option value="<?php echo attr($value['value']);?>" <?php echo $selected;?>><?php echo text($value['title']);?></option>
+ <?php endforeach;?>
+ </select>
</td>
<td>
<img src='../../pic/add.png' onclick="duplicateRow(this.parentElement.parentElement);" align='absbottom' width='27' height='24' border='0' style='cursor:pointer;cursor:hand' title='<?php echo xla('Click here to duplicate the row'); ?>'>
@@ -47,6 +47,7 @@
$code_date = $_POST["code_date"];
$code_des = $_POST["description"];
$count = $_POST["count"];
+$care_plan_type = $_POST['care_plan_type'];
if ($id && $id != 0) {
sqlStatement("DELETE FROM `form_care_plan` WHERE id=? AND pid = ? AND encounter = ?", array($id, $_SESSION["pid"], $_SESSION["encounter"]));
@@ -68,6 +69,7 @@
$code_val = $code[$key] ? $code[$key] : 0;
$codetext_val = $code_text[$key] ? $code_text[$key] :'NULL';
$description_val = $code_des[$key] ? $code_des[$key] : 'NULL';
+ $care_plan_type_val = $care_plan_type[$key] ? $care_plan_type[$key] : 'NULL';
$sets = "id = ". add_escape_custom($newid) .",
pid = ". add_escape_custom($_SESSION["pid"]) .",
groupname = '" . add_escape_custom($_SESSION["authProvider"]) . "',
@@ -78,7 +80,8 @@
code = '" . add_escape_custom($code_val) . "',
codetext = '" . add_escape_custom($codetext_val) . "',
description= '" . add_escape_custom($description_val) . "',
- date = '" . add_escape_custom($code_date[$key]) . "'";
+ date = '" . add_escape_custom($code_date[$key]) . "',
+ care_plan_type = '" .add_escape_custom($care_plan_type_val). "'";
sqlInsert("INSERT INTO form_care_plan SET $sets");
endforeach;
}
@@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS `form_care_plan` (
`code` varchar(255) DEFAULT NULL,
`codetext` text,
`description` text,
- `external_id` VARCHAR(30) DEFAULT NULL
+ `external_id` VARCHAR(30) DEFAULT NULL,
+ `care_plan_type` varchar(30) DEFAULT NULL
) ENGINE=InnoDB;
@@ -156,6 +156,10 @@ $download_format = $this->download_format;
</div>
</div>
<div id="componentsForCCDA" style="height:160px!important;display:none;" class="ap-st-st-13">
+ <div>
+ <input type="checkbox" id="latest_ccda"/>
+ <?php echo $this->listenerObject->z_xlt('Latest Medical Records');?>
+ </div>
<?php if(count($this->ccda_components) > 0) {?>
<div id="chkall_cmp_div1" style="margin-left: 70%;">
<input type="checkbox" id="chkall_cmp1" checked="true" /><?php echo $this->listenerObject->z_xlt('Check All - Components');?>
@@ -51,6 +51,8 @@ class EncounterccdadispatchController extends AbstractActionController
protected $referral_reason;
+ protected $latest_ccda;
+
public function __construct($serviceManager = null)
{
$this->listenerObject = new Listener;
@@ -271,6 +273,7 @@ public function indexAction()
$this->referral_reason = $this->getRequest()->getQuery('referral_reason');
$this->components = $this->getRequest()->getQuery('components') ? $this->getRequest()->getQuery('components') :$this->params('components');
$downloadccda = $this->params('downloadccda');
+ $this->latest_ccda = $this->getRequest()->getQuery('latest_ccda') ? $this->getRequest()->getQuery('latest_ccda') : $this->params('latest_ccda');
if($downloadccda == 'download_ccda') {
$combination = $this->params('pids');
$view = $this->params('view');
@@ -301,6 +304,9 @@ public function indexAction()
$arr = explode('_',$row);
$this->patient_id = $arr[0];
$this->encounter_id = ($arr[1] > 0 ? $arr[1] : NULL);
+ if($this->latest_ccda)
+ $this->encounter_id = $this->getEncounterccdadispatchTable()->getLatestEncounter($this->patient_id);
+
$this->create_data($this->patient_id, $this->encounter_id, $this->sections, $send,$this->components);
$content = $this->socket_get("$mirth_ip", "6661", $this->data);
@@ -526,8 +532,8 @@ public function getContinuityCareDocument($pid,$encounter,$components_list)
$ccd .= $this->getEncounterccdadispatchTable()->getFunctionalCognitiveStatus($pid,$encounter);
if(in_array('instructions',$components_list))
$ccd .= $this->getEncounterccdadispatchTable()->getClinicalInstructions($pid,$encounter);
- if(in_array('referral',$components_list))
- $ccd .= $this->getEncounterccdadispatchTable()->getRefferals($pid,$encounter);
+// if(in_array('referral',$components_list))
+// $ccd .= $this->getEncounterccdadispatchTable()->getRefferals($pid,$encounter);
return $ccd;
}
@@ -64,6 +64,8 @@ public function indexAction()
$form_sl_no = $request->getPost('form_sl_no', 0);
$downloadccda = $request->getPost('downloadccda') ? $request->getPost('downloadccda') : $request->getQuery()->downloadccda;
+ $latest_ccda = $request->getPost('latestccda') ? $request->getPost('latestccda') : $this->getRequest()->getQuery('latest_ccda');
+
if($downloadccda == 'download_ccda') {
$pids = '';
if($request->getQuery('pid_ccda')) {
@@ -91,7 +93,9 @@ public function indexAction()
'pids' => $pids,
'view' => 1,
'downloadccda' => $downloadccda,
- 'components' => $components));
+ 'components' => $components,
+ 'latest_ccda' => $latest_ccda,
+ ));
}
$params = array(
@@ -185,9 +189,10 @@ public function downloadallAction()
$arr = explode('|', $pids);
foreach($arr as $row){
$pid = $row;
- $id = $this->getEncountermanagerTable()->getFileID($pid);
- $dir = $parent_dir."/CCDA_$id/";
- $filename = "CCDA_$id.xml";
+ $row = $this->getEncountermanagerTable()->getFileID($pid);
+ $id = $row['id'];
+ $dir = $parent_dir."/CCDA_{$row['lname']}_{$row['fname']}/";
+ $filename = "CCDA_{$row['lname']}_{$row['fname']}.xml";
if(!is_dir($dir)){
mkdir($dir, true);
chmod($dir, 0777);
@@ -3843,4 +3843,16 @@ public function getMonthString($m){
return "Dec";
}
}
+
+ public function getListCodes($option_id, $list_id) {
+ $appTable = new ApplicationTable();
+ if ($option_id) {
+ $query = "SELECT codes
+ FROM list_options
+ WHERE list_id=? AND option_id=?";
+ $result = $appTable->zQuery($query, array($list_id, $option_id));
+ $res_cur = $result->current();
+ }
+ return $res_cur['codes'];
+ }
}
Oops, something went wrong.

0 comments on commit 9f7e1dc

Please sign in to comment.