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); }
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); }
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); }