本文整理汇总了PHP中Patient::persist方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::persist方法的具体用法?PHP Patient::persist怎么用?PHP Patient::persist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patient
的用法示例。
在下文中一共展示了Patient::persist方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processNewPatientAction
public function processNewPatientAction()
{
$params = $this->_getParam('patient');
$patient = new Patient();
$patient->populateWithArray($params);
if (!strlen($patient->recordNumber) > 0) {
$patient->recordNumber = WebVista_Model_ORM::nextSequenceId('record_sequence');
}
$patient->persist();
$personId = (int) $patient->personId;
// save addresses and phones
$addresses = $this->_getParam('addresses');
if (is_array($addresses)) {
foreach ($addresses as $row) {
$address = new Address();
$address->populateWithArray($row);
$address->personId = $personId;
$address->persist();
}
}
$phones = $this->_getParam('phones');
if (is_array($phones)) {
foreach ($phones as $row) {
$phone = new PhoneNumber();
$phone->populateWithArray($row);
$phone->personId = $personId;
$phone->persist();
}
}
$ret = array();
$ret['msg'] = 'Record Saved for Patient: ' . ucfirst($patient->firstName) . ' ' . ucfirst($patient->lastName);
$ret['personId'] = $personId;
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($ret);
}
示例2: processDetailsAction
public function processDetailsAction()
{
$retval = false;
$params = $this->_getParam('patient');
$patientId = (int) $params['personId'];
if ($patientId > 0) {
if (!(int) $params['person']['personId'] > 0) {
$params['person']['personId'] = $patientId;
}
if (isset($params['person']['active']) && $params['person']['active']) {
$params['person']['active'] = 1;
} else {
$params['person']['active'] = 0;
}
$patient = new Patient();
$patient->person_id = $patientId;
$patient->populate();
$patient->populateWithArray($params);
$patient->person->person_id = $patientId;
$patient->person->populate();
$patient->person->populateWithArray($params['person']);
$patient->persist();
$retval = true;
}
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$data = __('Record updated successfully.');
if ($retval == false) {
$data = __('There was an error attempting to update patient details.');
}
$json->direct($data);
}
示例3: processSelectAction
public function processSelectAction()
{
$teamId = preg_replace('/[^0-9_a-z-\\.]/i', '', $this->_getParam('teamId', ''));
$patientId = (int) $this->_getParam("patientId");
$patient = new Patient();
$patient->personId = $patientId;
$patient->populate();
$patient->teamId = $teamId;
$patient->persist();
$data = array();
$data['msg'] = __("Record saved successfully");
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($data);
}
示例4: importPatientsAction
public function importPatientsAction()
{
$f = fopen('/tmp/Pacientes.csv', 'r');
$counter = 0;
//"recordNumber","lastName","firstName","middleName","gender (M, F, O)","initials","dateOfBirth (YYY-MM-DD)","email","defaultIdentifier","defaultIdentifierType (SHORT ALL CAPS IDENTIFIED FOR ID)","maritalStatus (S, M, D)"
while (($data = fgetcsv($f)) !== FALSE) {
if ($counter == 0) {
$counter++;
continue;
}
$patient = new Patient();
$patient->_shouldAudit = false;
$patient->confidentiality = "DEFAULT";
$patient->recordNumber = $data[0];
$patient->person->lastName = $data[1];
$patient->person->firstName = $data[2];
$patient->person->middleName = $data[3];
$patient->person->gender = $data[4];
$patient->person->initials = $data[5];
$patient->person->dateOfBirth = $data[6];
$patient->person->email = $data[7];
$patient->person->defaultIdentifier = $data[8];
$patient->person->defaultIdentifierType = $data[9];
$patient->person->maritalStatus = $data[10];
//echo "<pre>" . $patient->toString() . "<br /></pre>";
echo $patient->person->firstName . " " . $patient->person->lastName . "<br />";
$patient->persist();
//echo $user->toString();
$counter++;
}
fclose($f);
exit;
}
示例5: generateTestSsDemoDataAction
public function generateTestSsDemoDataAction()
{
$basePath = Zend_Registry::get('basePath');
$xmlFile = $basePath . 'xml/ss-demo-data.xml';
$xml = new SimpleXMLElement(file_get_contents($xmlFile));
foreach ($xml as $key => $value) {
switch ($key) {
case 'prescriber':
$person = new Person();
$person->active = 1;
$person->lastName = (string) $value->PrescriberLastName;
$person->firstName = (string) $value->PrescriberFirstName;
$person->middleName = (string) $value->PrescriberMiddleName;
$person->suffix = (string) $value->PrescriberNameSuffix;
//$person->initials = (string)$value->PrescriberNamePrefix;
$provider = new Provider();
$provider->person = $person;
$provider->sureScriptsSPI = (string) $value->SPI;
$provider->deaNumber = (string) $value->DEANumber;
$provider->stateLicenseNumber = (string) $value->StateLicenseNumber;
$provider->persist();
//ProviderSpecialty, ClinicName
$phone = new PhoneNumber();
$phone->personId = $provider->personId;
$phone->name = 'Primary';
$phone->type = 4;
$phone->number = str_replace('-', '', (string) $value->PrescriberPhone);
$phone->persist();
$address = new Address();
$address->personId = $provider->personId;
$address->name = 'Main';
$address->type = 4;
$address->active = 1;
$address->line1 = (string) $value->ClinicAddressLine1;
$address->line2 = (string) $value->ClinicAddressLine2;
$address->city = (string) $value->ClinicCity;
$address->state = (string) $value->ClinicState;
$address->postalCode = (string) $value->ClinicZip;
$address->persist();
break;
case 'pharmacy':
$pharmacy = new Pharmacy();
$pharmacy->NCPDPID = (string) $value->NCPDPID;
/*$pharmacy-> = (string)$value->ReferenceQualifier;
$pharmacy-> = (string)$value->PharmacistLastName;
$pharmacy-> = (string)$value->PharmacistFirstName;
$pharmacy-> = (string)$value->PharmacistMiddleName;
$pharmacy-> = (string)$value->PharmacistNamePrefix;
$pharmacy-> = (string)$value->PharmacistNameSuffix;*/
$pharmacy->StoreName = (string) $value->PharmacyName;
$pharmacy->AddressLine1 = (string) $value->PharmacyAddressLine1;
$pharmacy->City = (string) $value->PharmacyCity;
$pharmacy->State = (string) $value->PharmacyState;
$pharmacy->Zip = (string) $value->PharmacyZip;
$pharmacy->PhonePrimary = (string) $value->PharmacyPhone;
$pharmacy->persist();
break;
case 'patient':
$person = new Person();
$person->active = 1;
$person->lastName = (string) $value->PatientLastName;
$person->firstName = (string) $value->PatientFirstName;
$person->middleName = (string) $value->PatientMiddleName;
//$person->initials = (string)$value->PatientNamePrefix;
$person->identifier = (string) $value->PatientSS;
$address = new Address();
$address->name = 'Main';
$address->type = 4;
$address->active = 1;
$address->line1 = (string) $value->PatientAddressLine1;
$address->line2 = (string) $value->PatientAddressLine2;
$address->city = (string) $value->PatientCity;
$address->state = (string) $value->PatientState;
$address->postalCode = (string) $value->PatientZip;
$patient = new Patient();
$patient->person = $person;
$patient->homeAddress = $address;
$patient->persist();
$phone = new PhoneNumber();
$phone->personId = $patient->personId;
$phone->name = 'Primary';
$phone->type = 4;
$phone->number = str_replace('-', '', (string) $value->PatientPhone);
$phone->persist();
break;
case 'medication':
break;
}
}
echo 'Done';
die;
}
示例6: generateTestTetanus
public static function generateTestTetanus()
{
$objects = array();
$person = new Person();
$person->last_name = 'ClearHealth';
$person->first_name = 'Test';
$person->middle_name = 'I';
$person->active = 1;
$person->persist();
$objects['person'] = $person;
$patient = new Patient();
$patient->person->_cascadePersist = false;
// to avoid persist() calls on person
$patient->person_id = $person->person_id;
$patient->recordNumber = 1000;
$patient->persist();
$objects['patient'] = $patient;
$medication = new Medication();
$medication->_shouldAudit = false;
// do not audit
$medication->hipaaNDC = 'hipaaNDC';
$medication->personId = $patient->person_id;
$medication->persist();
$objects['medication'] = $medication;
$audit = new Audit();
$audit->_ormPersist = true;
$audit->objectClass = get_class($medication);
$audit->objectId = $medication->medicationId;
$audit->dateTime = date('Y-m-d H:i:s');
$audit->type = WebVista_Model_ORM::REPLACE;
$audit->userId = (int) Zend_Auth::getInstance()->getIdentity()->personId;
$audit->persist();
$objects['audit'] = $audit;
$handler = new HealthStatusHandler();
$handler->name = 'Tetanus Shots Handler ' . NSDR::create_guid();
$handler->active = 1;
$handler->timeframe = '+1 month';
//$handler->condition = $audit->auditId;
$handlerName = Handler::normalizeHandlerName($handler->name);
$handler->handlerObject = <<<EOL
class {$handlerName}HealthStatusHandlerObject extends HealthStatusHandlerObjectAbstract {
\t//abstract requires at least this method
\tpublic static function matchAudit(HealthStatusHandler \$handler,Audit \$auditOrm) {
\t\t// check if the patientId of the item referenced by the audit is subscribed to the handler, if not return false (no match)
\t\t\$objectClass = \$auditOrm->objectClass;
\t\t\$obj = new \$objectClass();
\t\tforeach (\$obj->_primaryKeys as \$key) {
\t\t\t\$obj->\$key = \$auditOrm->objectId;
\t\t}
\t\t\$obj->populate();
\t\t\$patientId = \$obj->personId;
\t\tif (!HealthStatusHandlerPatient::isPatientSubscribed(\$handler->healthStatusHandlerId,\$patientId)) {
\t\t\treturn false;
\t\t}
\t\tif (\$auditOrm->objectClass == '{$audit->objectClass}' && \$auditOrm->type == '{$audit->type}') {
\t\t\treturn true;
\t\t}
\t\treturn false;
\t}
\tpublic static function fulfill(HealthStatusHandler \$handler,\$patientId) {
\t\t// fulfill sees if current patient has any open alerts linked to this handler
\t\t\$alert = new HealthStatusAlert();
\t\t\$alert->populateByHandlerPatientId(\$handler->healthStatusHandlerId,\$patientId);
\t\t// if there are open alerts then calls patientMatch again
\t\tif (strlen(\$alert->status) > 0) {
\t\t\t// if patientMatch returns FALSE then marks alerts as fulfilled if patientMatch return non-false alerts stay as is
\t\t\t// sees if any alerts exist for the patient that are for this handler and marks then as fulfilled if the same condition in patientMatch is reversed
\t\t\tif (self::patientMatch(\$handler,\$patientId) === false) {
\t\t\t\t\$alert->status = 'fulfilled';
\t\t\t\t\$alert->persist();
\t\t\t}
\t\t}
\t}
\tpublic static function patientMatch(HealthStatusHandler \$handler,\$patientId) {
\t\t// check if the patient does not have any record of a tetanus immunization (preferably by using NSDR)
\t\t// if it has, add the timeframe to the date of that immunization and check if that date is greater than today, if so then return true
\t\t// \$immunization = NSDR::populate(\$patientId.'::com.clearhealth.immunization');
\t\t// temporarily superseded NSDR
\t\t\$alert = new HealthStatusAlert();
\t\t\$alert->populateByHandlerPatientId(\$handler->healthStatusHandlerId,\$patientId);
\t\tif (!strlen(\$alert->status) > 0) {
\t\t\t// no existing alert, return true
\t\t\treturn true;
\t\t}
\t\t// would test to see if the date of a given patients last tetanus shot plus the timeframe is less than today
\t\t// if (strtotime(\$handler->timeframe,strtotime(\$alert->dateTime)) < strtotime(date('m/d/Y h:i A',strtotime('+1 month')))) {
\t\tif (\$alert->status == 'active') {
\t\t\tif (strtotime(\$alert->dateDue) < strtotime(date('m/d/Y h:i A',strtotime('+5 weeks')))) {
\t\t\t\t//self::fulfill(\$handler,\$patientId);
\t\t\t\treturn false;
\t\t\t}
\t\t\t// patientMatch checks if patient 1234 has NOT had a tetanus when date of last tetanus + timeframe < today and generates an alert
\t\t\treturn true;
\t\t}
\t\t/* \$alert->lastOccurence
\t\tif (\$alert->status == 'active' || \$alert->status == 'fulfilled' || \$alert->status == 'ignored') {
\t\t\t// would not match if patient already has an active, fulfilled or ignored alert
//.........这里部分代码省略.........
示例7: generateTestDataAction
public function generateTestDataAction()
{
// Patient Test Data
$person = new Person();
$person->lastName = 'Test';
$person->firstName = 'One';
$person->persist();
$patient = new Patient();
$patient->personId = $person->personId;
$patient->person = $person;
$patient->persist();
// Provider Test Data
$person = new Person();
$person->lastName = 'Provider';
$person->firstName = 'ClearHealth';
$person->persist();
$provider = new Provider();
$provider->personId = $person->personId;
$provider->person = $person;
$provider->persist();
// set provider as user
$user = new User();
$user->username = 'provider';
$user->password = 'provider';
$user->person = $person;
$user->persist();
echo 'Done.';
die;
}
示例8: _generatePatient
protected static function _generatePatient()
{
$objects = array();
$person = new Person();
$person->last_name = 'ClearHealth';
$person->first_name = 'Test';
$person->middle_name = 'I';
$person->active = 1;
$person->persist();
$objects['person'] = $person;
$patient = new Patient();
$patient->person->_cascadePersist = false;
// to avoid persist() calls on person
$patient->person_id = $person->person_id;
$patient->recordNumber = 1000;
$patient->persist();
$objects['patient'] = $patient;
return $objects;
}
示例9: processDetailsAction
public function processDetailsAction()
{
$params = $this->_getParam('patient');
$patientId = (int) $params['personId'];
$data = __('There was an error attempting to update patient details.');
if ($patientId > 0) {
if (!(int) $params['person']['personId'] > 0) {
$params['person']['personId'] = $patientId;
}
if (isset($params['person']['active']) && $params['person']['active']) {
$params['person']['active'] = 1;
} else {
$params['person']['active'] = 0;
}
$patient = new Patient();
$patient->person_id = $patientId;
$patient->populate();
$patient->populateWithArray($params);
if (strlen($patient->recordNumber) > 0 && $patient->hasMRNDuplicates()) {
$data = __('ERROR: MRN number already exists');
} else {
$patient->person->person_id = $patientId;
$patient->person->populate();
$patient->person->populateWithArray($params['person']);
$patient->persist();
$data = __('Record updated successfully.');
}
}
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($data);
}