示例#1
0
 public function testProblemList()
 {
     $date = date('Y-m-d H:i:s');
     $comments = array();
     $comments[] = 'first comment';
     $comments[] = 'yet another comment';
     $problemInput = 'DMII KETOACD UNCONTROLD  (250.12)';
     $problemList = array();
     $problemList['code'] = '250.12';
     $problemList['dateOfOnset'] = $date;
     $problemList['immediacy'] = 'Chronic';
     $problemList['personId'] = '65650';
     $problemList['providerId'] = '1000172';
     $problemList['status'] = 'Active';
     $problemList['lastUpdated'] = $date;
     $problem = new ProblemList();
     $problemListComments = array();
     $tmpComment = array();
     $tmpComment['authorId'] = (int) Zend_Auth::getInstance()->getIdentity()->personId;
     $tmpComment['date'] = $date;
     foreach ($comments as $comment) {
         $tmpComment['comment'] = $comment;
         $problemListComments[] = $tmpComment;
     }
     $problem->setProblemListComments($problemListComments);
     $problem->populateWithArray($problemList);
     $problem->persist();
     // retrieve problem list id
     $problemListId = $problem->problemListId;
     // check if problem list successfully saved
     $problem = new ProblemList();
     $problem->problemListId = $problemListId;
     $problem->populate();
     // assert individual data
     foreach ($problemList as $fieldName => $value) {
         $this->assertEquals($problem->{$fieldName}, $value, "{$fieldName} not equal.");
     }
     // assert if comments contains the same number of comments
     $this->assertEquals(count($problem->problemListComments), count($comments), "Problem List Comments does not match.");
     // remove problem list by changing the status to Removed
     $status = 'Removed';
     $problem->status = $status;
     $problem->persist();
     $problem = new ProblemList();
     $problem->problemListId = $problemListId;
     $problem->populate();
     $this->assertEquals($problem->status, $status, "Status not equal.");
 }
 public function setFilters(array $filters)
 {
     $db = Zend_Registry::get('dbAdapter');
     $dbSelect = $db->select()->from(array('pl' => 'problemLists'))->joinLeft(array('plc' => 'problemListComments'), "pl.problemListId=plc.problemListId", array('problemListCommentId', 'date', 'authorId', 'comment'));
     if (!isset($filters[0]) || $filters[0] != '*') {
         foreach ($filters as $fieldName => $fieldValue) {
             if (is_array($fieldValue)) {
                 $orWhere = array();
                 foreach ($fieldValue as $val) {
                     $val = preg_replace('/[^a-zA-Z0-9\\%\\.]/', '', $val);
                     $orWhere[] = "pl.{$fieldName} = '{$val}'";
                 }
                 $dbSelect->where(implode(' OR ', $orWhere));
             } else {
                 $dbSelect->where("pl.{$fieldName} = ?", $fieldValue);
             }
         }
     }
     $dbSelect->order("code ASC");
     $rows = $db->fetchAll($dbSelect);
     $dataRows = array();
     foreach ($rows as $row) {
         if (!isset($dataRows[$row['problemListId']])) {
             $problemList = new ProblemList();
             $problemList->populateWithArray($row);
             $dataRows[$row['problemListId']] = $problemList;
         }
         if ((int) $row['problemListCommentId'] > 0) {
             $dataRows[$row['problemListId']]->addComment($row);
         }
     }
     $this->_dataCount = 0;
     $this->_data = array();
     foreach ($dataRows as $row) {
         $this->_dataCount++;
         $this->_data[] = $row;
     }
 }
 public function indexAction()
 {
     $personId = (int) $this->_getParam('personId');
     $clinicalNoteId = (int) $this->_getParam('clinicalNoteId');
     trigger_error('ttpid: ' . $personId, E_USER_NOTICE);
     $cn = new ClinicalNote();
     $cn->clinicalNoteId = (int) $clinicalNoteId;
     $cn->populate();
     $templateId = $cn->clinicalNoteTemplateId;
     $cnTemplate = new ClinicalNoteTemplate();
     $cnTemplate->clinicalNoteTemplateId = (int) $templateId;
     $cnTemplate->populate();
     $xml = simplexml_load_string($cnTemplate->template);
     $objective = '';
     foreach ($xml as $question) {
         foreach ($question as $key => $item) {
             if ($key != "dataPoint") {
                 continue;
             }
             $namespace = (string) $item->attributes()->template;
             // extract the nsdr: format
             preg_match('/{nsdr:(.*)}/', $namespace, $matches);
             if (isset($matches[1])) {
                 $namespace = str_replace('[selectedPatientId]', $personId, $matches[1]);
                 $result = NSDR::populate($namespace);
                 $objective .= $result[$namespace];
             }
         }
     }
     $this->view->objective = $objective;
     $filter = array('personId' => $personId);
     $pl = new ProblemList();
     $pli = $pl->getIterator();
     $pli->setFilters($filter);
     $this->view->problemListIterator = $pli;
 }
 public function processSetFlagsAction()
 {
     $problemListId = (int) $this->_getParam('problemListId');
     $flags = $this->_getParam('flags');
     $data = false;
     if ($problemListId > 0 && strlen($flags) > 0) {
         $problemList = new ProblemList();
         $problemList->problemListId = $problemListId;
         if ($problemList->populate()) {
             $problemList->flags = $flags;
             $problemList->persist();
             $data = true;
         }
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
示例#5
0
    $selectedDiscipline = $_GET['prb_dsc_id'];
}
?>
<br /><div><label for="prb_dsc_id">Filtrar por Disciplina</label>:<?php 
$filter->render("prb_dsc_id", $selectedDiscipline, null, 'discipline-filter');
?>
</div>
		<br /><div>
			<label for="title-filter">Filtrar por Título</label>:
			<input id="title-filter" type="text" size=30 value="<?php 
echo @$_GET['title'];
?>
" />
		</div>
		<?php 
$widget = new ProblemList();
$widget->renderNotDeleted($selectedDiscipline, @$_GET['title']);
?>
</div>

<div id="problems-new-form" style="display:none;">
	<?php 
include "view/ProblemEdit.php";
$widget = new ProblemEdit(null);
$widget->render();
?>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		$("#problems-bt-new").click(function() {
 public function setFilters(array $filters)
 {
     if (isset($filters['context'])) {
         unset($filters['context']);
     }
     $db = Zend_Registry::get('dbAdapter');
     $dbSelect = $db->select()->from(array('pl' => 'problemLists'))->joinLeft(array('plc' => 'problemListComments'), "pl.problemListId=plc.problemListId", array('problemListCommentId', 'date', 'authorId', 'comment'));
     if (!isset($filters[0]) || $filters[0] != '*') {
         foreach ($filters as $fieldName => $fieldValue) {
             if (is_array($fieldValue)) {
                 $orWhere = array();
                 foreach ($fieldValue as $val) {
                     $val = preg_replace('/[^a-zA-Z0-9\\%\\.]/', '', $val);
                     $orWhere[] = "pl.{$fieldName} = '{$val}'";
                 }
                 $dbSelect->where(implode(' OR ', $orWhere));
             } else {
                 switch ($fieldName) {
                     case 'dateRange':
                         $dateRange = explode(';', $fieldValue);
                         $start = isset($dateRange[0]) ? date('Y-m-d 00:00:00', strtotime($dateRange[0])) : date('Y-m-d 00:00:00');
                         $end = isset($dateRange[1]) ? date('Y-m-d 23:59:59', strtotime($dateRange[1])) : date('Y-m-d 23:59:59', strtotime($start));
                         $dbSelect->where("pl.dateOfOnset BETWEEN '{$start}' AND '{$end}'");
                         break;
                     default:
                         $dbSelect->where("pl.{$fieldName} = ?", $fieldValue);
                 }
             }
         }
     }
     $dbSelect->order("code ASC");
     $rows = $db->fetchAll($dbSelect);
     $dataRows = array();
     foreach ($rows as $row) {
         if (!isset($dataRows[$row['problemListId']])) {
             $problemList = new ProblemList();
             $problemList->populateWithArray($row);
             $dataRows[$row['problemListId']] = $problemList;
         }
         if ((int) $row['problemListCommentId'] > 0) {
             $dataRows[$row['problemListId']]->addComment($row);
         }
     }
     $this->_dataCount = 0;
     $this->_data = array();
     foreach ($dataRows as $row) {
         $this->_dataCount++;
         $this->_data[] = $row;
     }
 }
 public function viewProblemAction()
 {
     $problemListId = (int) $this->_getParam('problemListId');
     if (strlen($problemListId) <= 0) {
         throw new Exception(__('Empty Problem List ID'));
     }
     $problemList = new ProblemList();
     $problemList->problemListId = (int) $problemListId;
     $problemList->populate();
     $this->view->problemList = $problemList;
     $this->render('view-problem');
 }