PHP Class PatientMerge

(C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 (C) OpenEyes Foundation, 2011-2013 This file is part of OpenEyes. OpenEyes 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. OpenEyes 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 OpenEyes in a file titled COPYING. If not, see .
Author: OpenEyes ([email protected])
ファイルを表示 Open project: openeyes/openeyes Class Usage Examples

Public Methods

Method Description
addLog ( string $msg ) Adding message to the log array.
comparePatientDetails ( Patient $primary, Patient $secondary ) : array Compare data in the patient table.
getLog ( ) : type Returns the log messages.
getPrimaryPatient ( ) : Patient Returns the Primary patient.
getSecondaryPatient ( ) : Patient Returns the secondary patient.
load ( PatientMergeRequest $request ) Load data from PatientMergeRequest AR record.
merge ( ) : boolean Do the actual merging by calling separated functions to move episodes, events etc.
setPrimaryPatientById ( integer $id ) Set primary patient by id.
setSecondaryPatientById ( integer $id ) Set secondaty patient by id.
updateAllergyAssignments ( $primaryPatient, $secondaryPatient ) Updates the patient id in the Allergy Assigment.
updateEpisodes ( Patient $primaryPatient, Patient $secondaryPatient ) : boolean Updating an episode - if primary has no episodes than we just assign the secondary patient's episodes to the primary - if secondary patient has no episodes we have nothing to do here - if both patiens have episode we have to check if there is any conflicting(same subspeicaly like cataract or glaucoma) episodes - we move the non conflictong episodes from secondary to primary - when two episodes are conflicting we move the events from the secondary patient's episode to the primary patient's episode then delete the secondary empty episode.
updateEpisodesPatientId ( $newPatientId, $episodes ) : boolean Assign episodes to a new paient id.
updateEventsEpisodeId ( integer $newEpisodeId, array $events ) : boolean Moving event from one episode to another.
updateLegacyEpisodes ( type $primaryPatient, type $secondaryPatient ) : boolean Moving Legacy episode from secondary patient to primary.
updateOphthalmicDiagnoses ( Patient $newPatient, type $ophthalmicDiagnoses ) Updates the Ophthalmic Diagnoses' patient_id
updatePreviousOperations ( Patient $newPatient, type $previousOperations ) : boolean Moving previous operations from secondaty patient to primary.
updateRiskAssignments ( integer $newPatientId, $riskAssignments ) Updates patient id in Risk Assignment.
updateSystemicDiagnoses ( Patient $newPatient, type $systemicDiagnoses ) : boolean Update Systemati Diagnoses' patient id

Method Details

addLog() public method

Adding message to the log array.
public addLog ( string $msg )
$msg string

comparePatientDetails() public method

Compare data in the patient table.
public comparePatientDetails ( Patient $primary, Patient $secondary ) : array
$primary Patient
$secondary Patient
return array

getLog() public method

Returns the log messages.
public getLog ( ) : type
return type

getPrimaryPatient() public method

Returns the Primary patient.
public getPrimaryPatient ( ) : Patient
return Patient AR record

getSecondaryPatient() public method

Returns the secondary patient.
public getSecondaryPatient ( ) : Patient
return Patient AR record

load() public method

Load data from PatientMergeRequest AR record.
public load ( PatientMergeRequest $request )
$request PatientMergeRequest

merge() public method

..
public merge ( ) : boolean
return boolean $isMerged success or fail

setPrimaryPatientById() public method

Set primary patient by id.

setSecondaryPatientById() public method

Set secondaty patient by id.

updateAllergyAssignments() public method

Updates the patient id in the Allergy Assigment.
public updateAllergyAssignments ( $primaryPatient, $secondaryPatient )

updateEpisodes() public method

Updating an episode - if primary has no episodes than we just assign the secondary patient's episodes to the primary - if secondary patient has no episodes we have nothing to do here - if both patiens have episode we have to check if there is any conflicting(same subspeicaly like cataract or glaucoma) episodes - we move the non conflictong episodes from secondary to primary - when two episodes are conflicting we move the events from the secondary patient's episode to the primary patient's episode then delete the secondary empty episode.
public updateEpisodes ( Patient $primaryPatient, Patient $secondaryPatient ) : boolean
$primaryPatient Patient
$secondaryPatient Patient
return boolean

updateEpisodesPatientId() public method

Assign episodes to a new paient id.
public updateEpisodesPatientId ( $newPatientId, $episodes ) : boolean
return boolean true if no error thrown

updateEventsEpisodeId() public method

Moving event from one episode to another.
public updateEventsEpisodeId ( integer $newEpisodeId, array $events ) : boolean
$newEpisodeId integer
$events array
return boolean

updateLegacyEpisodes() public method

Moving Legacy episode from secondary patient to primary.
public updateLegacyEpisodes ( type $primaryPatient, type $secondaryPatient ) : boolean
$primaryPatient type
$secondaryPatient type
return boolean

updateOphthalmicDiagnoses() public method

Updates the Ophthalmic Diagnoses' patient_id
public updateOphthalmicDiagnoses ( Patient $newPatient, type $ophthalmicDiagnoses )
$newPatient Patient
$ophthalmicDiagnoses type

updatePreviousOperations() public method

Moving previous operations from secondaty patient to primary.
public updatePreviousOperations ( Patient $newPatient, type $previousOperations ) : boolean
$newPatient Patient
$previousOperations type
return boolean

updateRiskAssignments() public method

Updates patient id in Risk Assignment.
public updateRiskAssignments ( integer $newPatientId, $riskAssignments )
$newPatientId integer

updateSystemicDiagnoses() public method

Update Systemati Diagnoses' patient id
public updateSystemicDiagnoses ( Patient $newPatient, type $systemicDiagnoses ) : boolean
$newPatient Patient
$systemicDiagnoses type
return boolean