This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .
Esempio n. 1
0
 /**
  * @param $rule
  * @return bool
  */
 private function ckSocialHistory($rule)
 {
     if (isset($rule['concepts']['SOCI']) && !empty($rule['concepts']['SOCI'])) {
         $count = 0;
         foreach ($rule['concepts']['SOCI'] as $concept) {
             $socials = $this->SocialHistory->getSocialHistoryByPidAndCode($this->Patient->getPatientPid(), $concept['concept_code']);
             if ($concept['frequency_interval'] == '') {
                 if ($this->compare(count($socials), $concept['frequency_operator'], $concept['frequency'])) {
                     return true;
                 }
             } else {
                 $frequency = 0;
                 foreach ($socials as $social) {
                     $starDate = isset($social['create_date']) ? $social['create_date'] : $social['start_date'];
                     if ($this->isWithInterval($starDate, $concept['frequency_interval'], $concept['frequency_operator'], 'Y-m-d H:i:s')) {
                         $frequency++;
                         if ($concept['frequency'] == $frequency) {
                             break;
                         }
                     }
                 }
                 if ($concept['frequency_operator'] == '' || $this->compare($frequency, $concept['frequency_operator'], $concept['frequency'])) {
                     $count++;
                 }
             }
         }
         return $count == count($rule['concepts']['SOCI']);
     }
     return true;
 }
 public function actionEditSocialHistory()
 {
     if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) {
         throw new Exception("Patient not found:" . @$_POST['patient_id']);
     }
     if (!($social_history = SocialHistory::model()->find('patient_id=?', array($patient->id)))) {
         $social_history = new SocialHistory();
     }
     $social_history->patient_id = $patient->id;
     $social_history->attributes = $_POST['SocialHistory'];
     if (!$social_history->save()) {
         throw new Exception("Unable to save social history: " . print_r($social_history->getErrors(), true));
     } else {
         $this->redirect(array('patient/view/' . $patient->id));
     }
 }
Esempio n. 3
0
    }
    ?>
		</tbody>
	</table>
	<div class="box-actions">
		<button  id="btn-add_social_history" class="secondary small">
			Edit
		</button>
	</div>

	<div id="add_social_history" style="display: none;">

		<?php 
    $form = $this->beginWidget('FormLayout', array('id' => 'add-social_history', 'enableAjaxValidation' => false, 'htmlOptions' => array('class' => 'form add-data'), 'action' => array('patient/editSocialHistory'), 'layoutColumns' => array('label' => 3, 'field' => 9)));
    if (!$social_history) {
        $social_history = new SocialHistory();
    }
    ?>
		<fieldset class="field-row">
			<legend><strong>Social History</strong></legend>
			<input type="hidden" name="edit_operation_id" id="edit_operation_id" value="" />
			<input type="hidden" name="patient_id" value="<?php 
    echo $this->patient->id;
    ?>
" />
			<div class="field-row row">
				<div class="<?php 
    echo $form->columns('label');
    ?>
">
					<label for="occupation_id"><?php 
Esempio n. 4
0
 /**
  * Method setSocialHistorySection()
  */
 private function setSocialHistorySection()
 {
     $SocialHistory = new SocialHistory();
     if ($this->isExcluded('social')) {
         $socialHistory['@attributes'] = ['nullFlavor' => 'NI'];
         $this->addSection(['section' => $socialHistory]);
         return;
     }
     /**
      * Smoking Status Observation - This clinical statement represents a patient's current smoking
      * status. The vocabulary selected for this clinical statement is the best approximation of the
      * statuses in Meaningful Use (MU) Stage 1.
      *
      * If the patient is a smoker (77176002), the effectiveTime/low element must be present. If the patient
      * is an ex-smoker (8517006), both the effectiveTime/low and effectiveTime/high element must be present.
      *
      * The smoking status value set includes a special code to communicate if the smoking status is unknown
      * which is different from how Consolidated CDA generally communicates unknown information.
      */
     $smokingStatus = $SocialHistory->getSocialHistoryByPidAndCode($this->pid, 'smoking_status');
     if (count($smokingStatus) > 0) {
         $smokingStatus = end($smokingStatus);
         $socialHistory = ['templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.2.17']], 'code' => ['@attributes' => ['code' => '29762-2', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => "Social History"]], 'title' => 'Social History', 'text' => $smokingStatus['note']];
         $socialHistory['entry'][] = ['@attributes' => ['typeCode' => 'DRIV'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.38.2']], 'code' => ['@attributes' => ['code' => 'ASSERTION', 'codeSystemName' => 'ActCode', 'codeSystem' => '2.16.840.1.113883.5.4']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['low' => ['@attributes' => ['value' => $this->parseDate($smokingStatus['create_date'])]]], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'code' => $smokingStatus['status_code'], 'displayName' => $smokingStatus['status'], 'codeSystemName' => $smokingStatus['status_code_type'], 'codeSystem' => $this->codes($smokingStatus['status_code_type'])]]]];
     }
     unset($smokingStatus);
     /**
      * This Social History Observation defines the patient's occupational, personal (e.g., lifestyle),
      * social, and environmental history and health risk factors, as well as administrative data such
      * as marital status, race, ethnicity, and religious affiliation.
      */
     $socialHistories = $SocialHistory->getSocialHistoryByPidAndCode($this->pid);
     if (count($socialHistories) > 0) {
         $socialHistory['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@value' => 'Social History Element'], ['@value' => 'Description'], ['@value' => 'Effective Dates']]]]], 'tbody' => ['tr' => []]]];
     }
     foreach ($socialHistories as $socialHistoryEntry) {
         $dateText = $this->parseDate($socialHistoryEntry['start_date']) . ' - ';
         if ($socialHistoryEntry['end_date'] != '0000-00-00 00:00:00') {
             $dateText .= $this->parseDate($socialHistoryEntry['end_date']);
         }
         $socialHistory['text']['table']['tbody']['tr'][] = ['td' => [['@value' => $socialHistoryEntry['category_code_text']], ['@value' => $socialHistoryEntry['observation']], ['@value' => $dateText]]];
         $entry = ['@attributes' => ['typeCode' => 'DRIV'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.38']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => $socialHistoryEntry['category_code'], 'codeSystem' => $this->codes($socialHistoryEntry['category_code_type']), 'codeSystemName' => $socialHistoryEntry['category_code_text'], 'displayName' => $socialHistoryEntry['category_code_text']]], 'statusCode' => ['@attributes' => ['code' => 'completed']]]];
         $entry['observation']['effectiveTime'] = ['@attributes' => ['xsi:type' => 'IVL_TS']];
         $entry['observation']['effectiveTime']['low'] = ['@attributes' => ['value' => $this->parseDate($socialHistoryEntry['start_date'])]];
         if ($socialHistoryEntry['end_date'] != '0000-00-00 00:00:00') {
             $entry['observation']['effectiveTime']['high'] = ['@attributes' => ['value' => $this->parseDate($socialHistoryEntry['end_date'])]];
         } else {
             $entry['observation']['effectiveTime']['high'] = ['@attributes' => ['nullFlavor' => 'NI']];
         }
         $entry['observation']['value'] = ['@attributes' => ['xsi:type' => 'ST'], '@value' => $socialHistoryEntry['observation']];
         $socialHistory['entry'][] = $entry;
         unset($entry);
     }
     unset($socialHistories);
     //		/***************************************************************************************************************
     //		 * Pregnancy Observation - This clinical statement represents current and/or
     //		 * prior pregnancy dates enabling investigators to determine if the subject
     //		 * of the case report* was pregnant during the course of a condition.
     //		 */
     //		$socialHistory['text']['table']['tbody']['tr'][] = array(
     //			'td' => array(
     //				array(
     //					'@value' => 'Social History Element Data'
     //				),
     //				array(
     //					'@value' => 'ReactiDescriptionon Data'
     //				),
     //				array(
     //					'@value' => 'Effective Data'
     //				)
     //			)
     //		);
     //		$socialHistory['entry'][] = array(
     //			'@attributes' => array(
     //				'typeCode' => 'DRIV'
     //			),
     //			'observation' => array(
     //				'@attributes' => array(
     //					'classCode' => 'OBS',
     //					'moodCode' => 'EVN'
     //				),
     //				'templateId' => array(
     //					'@attributes' => array(
     //						'root' => '2.16.840.1.113883.10.20.15.3.8'
     //					)
     //				),
     //				'code' => array(
     //					'@attributes' => array(
     //						'code' => 'ASSERTION',
     //						'codeSystem' => '2.16.840.1.113883.5.4'
     //					)
     //				),
     //				'statusCode' => array(
     //					'@attributes' => array(
     //						'code' => 'completed',
     //					)
     //				),
     //				'value' => array(
     //					'@attributes' => array(
     //						'xsi:type' => 'CD',
     //						'code' => '77386006',
     //						'codeSystem' => '2.16.840.1.113883.6.96'
     //					)
     //				),
     //				'entryRelationship' => array(
     //					'@attributes' => array(
     //						'typeCode' => 'REFR'
     //					),
     //					'observation' => array(
     //						'@attributes' => array(
     //							'classCode' => 'OBS',
     //							'moodCode' => 'EVN'
     //						),
     //						'templateId' => array(
     //							'@attributes' => array(
     //								'root' => '2.16.840.1.113883.10.20.15.3.1'
     //							)
     //						),
     //						'code' => array(
     //							'@attributes' => array(
     //								'code' => '11778-8',
     //		                        'codeSystemName' => 'LOINC',
     //								'codeSystem' => '2.16.840.1.113883.6.1'
     //							)
     //						),
     //						'statusCode' => array(
     //							'@attributes' => array(
     //								'code' => 'completed'
     //							)
     //						),
     //						/**
     //						 * Estimated Date Of Delivery
     //						 */
     //						'value' => array(
     //							'@attributes' => array(
     //								'xsi:type' => 'TS',
     //								'value' => '20150123' // TODO
     //							)
     //						)
     //					)
     //				)
     //			)
     //		);
     $this->addSection(['section' => $socialHistory]);
     unset($socialHistoryData, $socialHistory);
 }
Esempio n. 5
0
 *
 * @package OpenEyes
 * @link http://www.openeyes.org.uk
 * @author OpenEyes <*****@*****.**>
 * @copyright Copyright (C) 2014, OpenEyes Foundation
 * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
 */
$this->renderPartial('//base/_messages');
?>
<div class="box admin">
	<h2>Social History</h2>
	<ul>
		<li><a href="/admin/socialHistoryOccupation"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('occupation_id'));
?>
</a></li>
		<li><a href="/admin/socialHistoryDrivingStatus"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('driving_status_id'));
?>
</a></li>
		<li><a href="/admin/socialHistorySmokingStatus"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('smoking_status_id'));
?>
</a></li>
		<li><a href="/admin/socialHistoryAccommodation"><?php 
echo CHtml::encode(SocialHistory::model()->getAttributeLabel('accommodation_id'));
?>
</a></li>
	</ul>
</div>
Esempio n. 6
0
		<span class="icon-patient-clinician-hd_flag"></span>
		Social History
	</h3>
	<a href="#" class="toggle-trigger toggle-hide js-toggle">
			<span class="icon-showhide">
			Show/hide this section
			</span>
	</a>
</header>
<div class="js-toggle-body">
<?php 
if ($this->checkAccess('OprnEditSocialHistory')) {
    ?>
	<?php 
    $this->patient->id;
    $social_history = SocialHistory::model()->find('patient_id=?', array($this->patient->id));
    ?>
	<table class="plain patient-data">
		<thead>
		<tr>
			<th>Social History</th>
			<th>Status</th>
		</tr>
		</thead>
		<tbody>
		<?php 
    if (isset($social_history->occupation)) {
        ?>
			<tr>
				<td>Occupation</td>
				<td><?php 
 public function actionSocialHistoryAccommodation()
 {
     $this->genericAdmin(SocialHistory::model()->getAttributeLabel('accommodation_id'), 'SocialHistoryAccommodation');
 }