Skip to content

Commit

Permalink
amc revision changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Saravanan Rathinakumar authored and bradymiller committed Jul 24, 2016
1 parent 999017e commit f23541d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 13 deletions.
60 changes: 60 additions & 0 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,24 @@ function view_action($patient_id="",$doc_id) {

$this->assign("notes",$notes);

$this->assign("IMG_PROCEDURE_TAG_ACTION",$this->_link("image_procedure") . "document_id=" . $d->get_id());
// Populate the dropdown with image procedure order list
$imgOptions = "<option value='0'>-- " . xlt('Select Image Procedure') . " --</option>";
$imgOrders = sqlStatement("select procedure_name,po.procedure_order_id,procedure_code from procedure_order po inner join procedure_order_code poc on poc.procedure_order_id = po.procedure_order_id where po.patient_id = ? and poc.procedure_order_title = 'imaging'",array($patient_id));
$mapping = $this->get_mapped_procedure($d->get_id());
if(sqlNumRows($imgOrders) > 0){
while($row = sqlFetchArray($imgOrders)) {
$sel_proc = '';
if((isset($mapping['procedure_code']) && $mapping['procedure_code'] == $row['procedure_code']) && (isset($mapping['procedure_code']) && $mapping['procedure_order_id'] == $row['procedure_order_id']))
$sel_proc = 'selected';
$imgOptions .= "<option value='". attr($row['procedure_order_id']). "' data-code='".attr($row['procedure_code'])."' $sel_proc>".text($row['procedure_name'].' - '.$row['procedure_code'])."</option>";
}
}

$this->assign('IMAGE_PROCEDURE_LIST',$imgOptions);

$this->assign('clear_procedure_tag',$this->_link('clear_procedure_tag')."document_id=" . $d->get_id());

$this->_last_node = null;

$menu = new HTML_TreeMenu();
Expand Down Expand Up @@ -1223,5 +1241,47 @@ function tag_action_process($patient_id="", $document_id) {
return $this->view_action($patient_id, $document_id);
}

function image_procedure_action($patient_id="",$document_id){

$img_procedure_id = $_POST['image_procedure_id'];
$proc_code = $_POST['procedure_code'];

if(is_numeric($document_id)){

$img_order = sqlQuery("select * from procedure_order_code where procedure_order_id = ? and procedure_code = ? ",array($img_procedure_id,$proc_code));
$img_report = sqlQuery("select * from procedure_report where procedure_order_id = ? and procedure_order_seq = ? ",array($img_procedure_id,$img_order['procedure_order_seq']));
$img_report_id = !empty($img_report['procedure_report_id']) ? $img_report['procedure_report_id'] : 0;
if($img_report_id == 0){
$report_date = date('Y-m-d H:i:s');
$img_report_id = sqlInsert("INSERT INTO procedure_report(procedure_order_id,procedure_order_seq,date_collected,date_report,report_status) values(?,?,?,?,'final')",array($img_procedure_id,$img_order['procedure_order_seq'],$img_order['date_collected'],$report_date));
}

$img_result = sqlQuery("select * from procedure_result where procedure_report_id = ? and document_id = ?",array($img_report_id,$document_id));
if(empty($img_result)){
sqlInsert("INSERT INTO procedure_result(procedure_report_id,date,document_id,result_status) values(?,?,?,'final')",array($img_report_id,date('Y-m-d H:i:s'),$document_id));
}
}
return $this->view_action($patient_id, $document_id);
}

function clear_procedure_tag_action($patient_id="",$document_id){
if(is_numeric($document_id)){
sqlStatement("delete from procedure_result where document_id = ?",$document_id);
}
return $this->view_action($patient_id, $document_id);
}

function get_mapped_procedure($document_id){
$map = array();
if(is_numeric($document_id)){
$map = sqlQuery("select poc.procedure_order_id,poc.procedure_code from procedure_result pres
inner join procedure_report pr on pr.procedure_report_id = pres.procedure_report_id
inner join procedure_order_code poc on (poc.procedure_order_id = pr.procedure_order_id and poc.procedure_order_seq = pr.procedure_order_seq)
inner join procedure_order po on po.procedure_order_id = poc.procedure_order_id
where pres.document_id = ?",array($document_id));
}
return $map;
}

}
?>
2 changes: 1 addition & 1 deletion library/classes/Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,4 @@ function postPatientNote($provider, $category_id, $message='') {
}

} // end of Document
?>
?>
19 changes: 7 additions & 12 deletions library/classes/rulesets/Amc/reports/AMC_314g_1_2_14/Numerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@ public function test( AmcPatient $patient, $beginDate, $endDate )
// Still TODO
// AMC MU2 TODO :
// This needs to be converted to the Z&H offsite portal solution.
//
//$portalQry = "SELECT count(*) as cnt FROM patient_data pd ".
//"INNER JOIN ccda_log cl ON pd.pid = cl.patient_id AND cl.user_type = 2 AND cl.event IN ('patient-record-view', 'patient-record-download', 'patient-record-transmit') ".
//"WHERE pd.pid = ? AND cl.date BETWEEN ? AND ?";
//$check = sqlQuery( $portalQry, array($patient->id, $beginDate, $endDate) );
//if ($check['cnt'] > 0){
//return true;
//}else{

return false;

//}

$check = sqlQuery('select count(id) as count from ccda where pid = ? and (view = 1 or emr_transfer = 1) and user_id is null and updated_date >= ? and updated_date <= ?',array($patient->id,$beginDate,$endDate));
if($check['count'] > 0)
return true;
else
return false;

}
}
?>
28 changes: 28 additions & 0 deletions templates/documents/general_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
{literal}}{/literal}
{literal}}{/literal}

// For tagging it with image procedure
function ImgProcedure() {literal}{{/literal}
var f = document.forms['img_procedure_tag'];
if(f.image_procedure_id.value == 0 ) {literal}{{/literal}
alert("{xl t='Please select image procedure'}");
return false;
{literal}}{/literal}
f.procedure_code.value = f.image_procedure_id.options[f.image_procedure_id.selectedIndex].getAttribute('data-code');
document.forms['img_procedure_tag'].submit();
{literal}}{/literal}
// Process click on Import link.
function import_ccr(docid) {literal}{
top.restoreSession();
Expand Down Expand Up @@ -219,6 +229,24 @@
</div>
</form>
</div>
<br/>
<div class="text">
<form method="post" name="img_procedure_tag" id="img_procedure_tag" action="{$IMG_PROCEDURE_TAG_ACTION}" onsubmit="return top.restoreSession()">
<input type='hidden' name='procedure_code' value=''>
<div>
<div style="float:left">
<b>{xl t='Tag to Image Procedure'}</b>&nbsp;
</div>
<div style="float:none">
<a href="javascript:;" onclick="ImgProcedure();">(<span>{xl t='submit'})</span></a>
</div>
</div>
<div>
<select id="image_procedure_id" name="image_procedure_id">{$IMAGE_PROCEDURE_LIST}</select>&nbsp;
<a href="{$clear_procedure_tag}">(<span>{xl t='clear'})</span></a>
</div>
</form>
</div>

<br/>

Expand Down

0 comments on commit f23541d

Please sign in to comment.