PHP Class Patient

Inheritance: extends Object
Mostrar archivo Open project: openeyes/openeyes Class Usage Examples

Public Properties

Property Type Description
$use_pas

Protected Properties

Property Type Description
$_clinical_warnings storage of warning data
$_nonclinical_warnings

Public Methods

Method Description
__get ( string $prop ) : mixed | null I think this override is here to enforce the override of the medications relation and merge in the prescription items as appropriate.
__isset ( string $prop ) : boolean I think this override is here to enforce the override of the medications relation and merge in the prescription items as appropriate.
addAllergy ( Allergy $allergy, string $other = null, $comments = null, $startTransaction = true ) adds an allergy to the patient.
addDiagnosis ( $disorder_id, $eye_id = false, $date = false )
addEpisode ( $firm ) : Episode add an episode to the patient for the given Firm.
addFamilyHistory ( $relative_id, $other_relative, $side_id, $condition_id, $other_condition, $comments ) Adds FamilyHistory entry to the patient if it's not a duplicate.
addPreviousOperation ( $operation, $side_id, $date )
addRisk ( Risk $risk, string $other = null, $comments = null ) adds a risk to the patient.
ageOn ( string $check_date ) : string Calculate the patient's age.
attributeLabels ( ) : array
audit ( $target, $action, $data = null, $log = false, $properties = [] )
beforeSave ( )
beforeValidate ( )
behaviors ( )
cmp ( $a, $b ) sort the remainder
currentContactIDS ( )
editOphInfo ( PatientOphInfoCviStatus $cvi_status, string $cvi_status_date ) : true | array update the patient's ophthalmic information.
getAge ( ) : string Get the patient's age.
getAllDisorders ( $eye_id = null ) * returns all disorders for the patient.
getAllergiesString ( ) : string returns a standard allergy string for the patient.
getBecomesAdultDate ( ) : null | string Returns the date on which the patient will become an adult.
getCataractEpisodeId ( ) : mixed Get the episode ID of the patient's cataract if it exists.
getChildPrefix ( )
getCommissioningBodyOfType ( CommissioningBodyType $type ) : CommissioningBody get the CommissioningBody of the CommissioningBodyType $type currently assumes there would only ever be one commissioning body of a given type.
getContactAddress ( $contact_id, $location_type = false, $location_id = false )
getCorrespondenceName ( ) : string
getDiabetes ( ) : Disorder | null Get the patient diabetes type as Disorder instance - will return generic Diabetes if no specific type available, but patient has diabetes.
getDiabetesType ( ) : Disorder | null Get the Diabetes Type as a Disorder instance.
getDisordersOfType ( int[] $snomeds ) : Disorder[] get the patient disorders that are of the type in the list of disorder ids provided.
getDisplayName ( )
getDistinctCommissioningBodiesByType ( ) : array[string][CommissioningBody] get an associative array of CommissioningBody for this patient and the patient's practice indexed by CommissioningBodyType id.
getDmt ( ) : string Diabetes mellitus as a letter string.
getEdl ( )
getEdr ( )
getEmail ( ) : mixed Returns the contact address email
getEpc ( )
getEpd ( )
getEpisodeForCurrentSubspecialty ( ) : Episode Get the episode for the subspecialty of the firm (or no subspecialty when the firm doesn't have one).
getEps ( )
getEpv ( )
getEthnicGroupString ( )
getFirst_name ( )
getFullName ( ) : string
getGenderString ( )
getHSCICName ( $bold = false ) : string get the Patient name according to HSCIC guidelines.
getLast_name ( )
getLatestEvent ( )
getLatestOperationNoteEventUniqueCode ( )
getNhsnum ( )
getNick_name ( )
getObj ( )
getOpenEpisodeOfSubspecialty ( $subspecialty_id ) : CActiveRecord | null return the open episode of the given subspecialty if there is one, null otherwise.
getOphInfo ( ) : PatientOphInfo returns the ophthalmic information object for this patient (creates a default one if one does not exist - but does not save it).
getOphthalmicDiagnoses ( )
getOrCreateEpisodeForFirm ( $firm, boolean $include_closed = false ) : CActiveRecord | Episode | null Get or create an episode for the patient under the given Firm (Note that an episode will be returned if there is match on Firm Subspecialty rather than on Firm).
getOrderedEpisodes ( ) * will group episodes by specialty, ordered by the configuration key of specialty sort, and alphanumeric for any specialties not configured.
getPos ( )
getPrefix ( )
getPrimary_phone ( )
getPro ( )
getRisksString ( ) : string returns a standard risk string for the patient.
getSalutationName ( ) : string
getSdl ( )
getSpecialtyCodes ( ) * returns the specialty codes that are relevant to the patient. Determined by looking at the diagnoses related to the patient.
getSub ( )
getSummaryAddress ( $delimiter = '<br/>' )
getSyd ( ) : string Systemic diagnoses shortcode.
getSystemicDiagnoses ( )
getTitle ( )
getUniqueCodeForEvent ( $id )
getWarnings ( boolean $clinical = true ) : {'short_msg' return the patient warnings that have been defined for the patient. If $clinical is false only non-clinical warnings will be returned.
get_medications ( ) : array Gets the current medications linked with items from the prescription events.
get_previous_medications ( ) : array Gets the previous medications linked with items from the prescription events.
hasAllergy ( $allergy ) : boolean returns true if the patient has the allergy passed in.
hasAllergyStatus ( ) : boolean returns true if the allergy status of the patient is known (has allergies, or no known allergies) false otherwise.
hasDisorderTypeByIds ( $snomeds ) * checks if the patient has a disorder that is defined as being within the SNOMED tree specified by the given $snomed id.
hasDrugAllergy ( integer $drug_id = null ) : boolean
hasLegacyLetters ( )
hasOpenEpisodeOfSubspecialty ( $subspecialty_id ) : boolean returns true if patient has an open episode for the given subspecialty id.
hasRisk ( $riskCompare ) : boolean Check if the patient has a given risk.
hasRiskStatus ( ) : boolean returns true if the risk status of the patient is known (has risks, or no known risks) false otherwise.
isChild ( string $check_date = null ) : boolean
isDeceased ( ) : boolean
model ( $className = __CLASS__ ) : Patient Returns the static model of the specified AR class.
noPas ( ) : Patient Suppress PAS integration.
patientMedications ( $medicationCriteria ) : array
prescriptionItems ( array $exclude ) : array | CActiveRecord[] | null
prescriptionMedicationIds ( ) : mixed
relations ( ) : array
removeDiagnosis ( $diagnosis_id )
rules ( ) : array
search ( array $params = [] ) : CActiveDataProvider Retrieves a list of models based on the current search/filter conditions.
search_nr ( $params )
setNoAllergies ( ) marks the patient as having no allergies as of now.
setNoFamilyHistory ( ) marks the patient as having no family history.
setNoRisks ( ) marks the patient as having no allergies as of now.
tableName ( ) : string
validateDeceased ( $attribute, $params )

Protected Methods

Method Description
afterFind ( ) Raise event to allow external data sources to update patient.
instantiate ( $attributes ) Pass through use_pas flag to allow pas supression.
mergeItemToMedications ( $medicationList, $prescription ) : mixed
sortMedications ( $item1, $item2 ) : boolean Sort the medications by start date.

Private Methods

Method Description
getAllDisorderIds ( $eye_id = null ) * returns all disorder ids for the patient, aggregating the principal diagnosis for each patient episode, and any secondary diagnosis on the patient
randomData ( $field )
randomDate ( $startDate = '1931-01-01', $endDate = '2010-12-12' )

Method Details

__get() public method

I think this override is here to enforce the override of the medications relation and merge in the prescription items as appropriate.
public __get ( string $prop ) : mixed | null
$prop string
return mixed | null

__isset() public method

I think this override is here to enforce the override of the medications relation and merge in the prescription items as appropriate.
public __isset ( string $prop ) : boolean
$prop string
return boolean

addAllergy() public method

adds an allergy to the patient.
public addAllergy ( Allergy $allergy, string $other = null, $comments = null, $startTransaction = true )
$allergy Allergy
$other string

addDiagnosis() public method

public addDiagnosis ( $disorder_id, $eye_id = false, $date = false )

addEpisode() public method

add an episode to the patient for the given Firm.
public addEpisode ( $firm ) : Episode
$firm
return Episode

addFamilyHistory() public method

Adds FamilyHistory entry to the patient if it's not a duplicate.
public addFamilyHistory ( $relative_id, $other_relative, $side_id, $condition_id, $other_condition, $comments )
$relative_id
$other_relative
$side_id
$condition_id
$other_condition
$comments

addPreviousOperation() public method

public addPreviousOperation ( $operation, $side_id, $date )

addRisk() public method

adds a risk to the patient.
public addRisk ( Risk $risk, string $other = null, $comments = null )
$risk Risk
$other string

afterFind() protected method

Raise event to allow external data sources to update patient.
See also: CActiveRecord::afterFind()
protected afterFind ( )

ageOn() public method

Calculate the patient's age.
public ageOn ( string $check_date ) : string
$check_date string Date to check age on (default is today)
return string

attributeLabels() public method

public attributeLabels ( ) : array
return array customized attribute labels (name=>label)

audit() public method

public audit ( $target, $action, $data = null, $log = false, $properties = [] )

beforeSave() public method

public beforeSave ( )

beforeValidate() public method

public beforeValidate ( )

behaviors() public method

public behaviors ( )

cmp() public method

sort the remainder
public cmp ( $a, $b )

currentContactIDS() public method

public currentContactIDS ( )

editOphInfo() public method

update the patient's ophthalmic information.
public editOphInfo ( PatientOphInfoCviStatus $cvi_status, string $cvi_status_date ) : true | array
$cvi_status PatientOphInfoCviStatus
$cvi_status_date string - fuzzy date string of the format yyyy-mm-dd
return true | array True or array of errors

getAge() public method

Get the patient's age.
public getAge ( ) : string
return string

getAllDisorders() public method

FIXME: some of this can be abstracted to a relation when we upgrade from yii 1.1.8, which has some problems with yii relations: http://www.yiiframework.com/forum/index.php/topic/26806-relations-through-problem-wrong-on-clause-in-sql-generated/
public getAllDisorders ( $eye_id = null )

getAllergiesString() public method

returns a standard allergy string for the patient.
public getAllergiesString ( ) : string
return string

getBecomesAdultDate() public method

Returns the date on which the patient will become an adult.
public getBecomesAdultDate ( ) : null | string
return null | string

getCataractEpisodeId() public method

Get the episode ID of the patient's cataract if it exists.
public getCataractEpisodeId ( ) : mixed
return mixed

getChildPrefix() public method

public getChildPrefix ( )

getCommissioningBodyOfType() public method

get the CommissioningBody of the CommissioningBodyType $type currently assumes there would only ever be one commissioning body of a given type.
public getCommissioningBodyOfType ( CommissioningBodyType $type ) : CommissioningBody
$type CommissioningBodyType
return CommissioningBody

getContactAddress() public method

public getContactAddress ( $contact_id, $location_type = false, $location_id = false )

getCorrespondenceName() public method

public getCorrespondenceName ( ) : string
return string Patient name for prefixing an address

getDiabetes() public method

Get the patient diabetes type as Disorder instance - will return generic Diabetes if no specific type available, but patient has diabetes.
public getDiabetes ( ) : Disorder | null
return Disorder | null

getDiabetesType() public method

Get the Diabetes Type as a Disorder instance.
public getDiabetesType ( ) : Disorder | null
return Disorder | null

getDisordersOfType() public method

get the patient disorders that are of the type in the list of disorder ids provided.
public getDisordersOfType ( int[] $snomeds ) : Disorder[]
$snomeds int[] - disorder ids to check for
return Disorder[]

getDisplayName() public method

public getDisplayName ( )

getDistinctCommissioningBodiesByType() public method

get an associative array of CommissioningBody for this patient and the patient's practice indexed by CommissioningBodyType id.
public getDistinctCommissioningBodiesByType ( ) : array[string][CommissioningBody]
return array[string][CommissioningBody]

getDmt() public method

Diabetes mellitus as a letter string.
public getDmt ( ) : string
return string

getEdl() public method

public getEdl ( )

getEdr() public method

public getEdr ( )

getEmail() public method

Returns the contact address email
public getEmail ( ) : mixed
return mixed

getEpc() public method

public getEpc ( )

getEpd() public method

public getEpd ( )

getEpisodeForCurrentSubspecialty() public method

Get the episode for the subspecialty of the firm (or no subspecialty when the firm doesn't have one).
public getEpisodeForCurrentSubspecialty ( ) : Episode
return Episode

getEps() public method

public getEps ( )

getEpv() public method

public getEpv ( )

getEthnicGroupString() public method

getFirst_name() public method

public getFirst_name ( )

getFullName() public method

public getFullName ( ) : string
return string Full name

getGenderString() public method

public getGenderString ( )

getHSCICName() public method

get the Patient name according to HSCIC guidelines.
public getHSCICName ( $bold = false ) : string
return string

getLast_name() public method

public getLast_name ( )

getLatestEvent() public method

public getLatestEvent ( )

getLatestOperationNoteEventUniqueCode() public method

getNhsnum() public method

public getNhsnum ( )

getNick_name() public method

public getNick_name ( )

getObj() public method

public getObj ( )

getOpenEpisodeOfSubspecialty() public method

return the open episode of the given subspecialty if there is one, null otherwise.
public getOpenEpisodeOfSubspecialty ( $subspecialty_id ) : CActiveRecord | null
$subspecialty_id
return CActiveRecord | null

getOphInfo() public method

returns the ophthalmic information object for this patient (creates a default one if one does not exist - but does not save it).
public getOphInfo ( ) : PatientOphInfo
return PatientOphInfo

getOphthalmicDiagnoses() public method

getOrCreateEpisodeForFirm() public method

Get or create an episode for the patient under the given Firm (Note that an episode will be returned if there is match on Firm Subspecialty rather than on Firm).
public getOrCreateEpisodeForFirm ( $firm, boolean $include_closed = false ) : CActiveRecord | Episode | null
$firm
$include_closed boolean
return CActiveRecord | Episode | null

getOrderedEpisodes() public method

* will group episodes by specialty, ordered by the configuration key of specialty sort, and alphanumeric for any specialties not configured.
public getOrderedEpisodes ( )

getPos() public method

public getPos ( )

getPrefix() public method

public getPrefix ( )

getPrimary_phone() public method

public getPrimary_phone ( )

getPro() public method

public getPro ( )

getRisksString() public method

returns a standard risk string for the patient.
public getRisksString ( ) : string
return string

getSalutationName() public method

public getSalutationName ( ) : string
return string Patient name for using as a salutation

getSdl() public method

public getSdl ( )

getSpecialtyCodes() public method

* returns the specialty codes that are relevant to the patient. Determined by looking at the diagnoses related to the patient.
public getSpecialtyCodes ( )

getSub() public method

public getSub ( )

getSummaryAddress() public method

public getSummaryAddress ( $delimiter = '<br/>' )

getSyd() public method

Systemic diagnoses shortcode.
public getSyd ( ) : string
return string

getSystemicDiagnoses() public method

getTitle() public method

public getTitle ( )

getUniqueCodeForEvent() public method

public getUniqueCodeForEvent ( $id )

getWarnings() public method

return the patient warnings that have been defined for the patient. If $clinical is false only non-clinical warnings will be returned.
public getWarnings ( boolean $clinical = true ) : {'short_msg'
$clinical boolean
return {'short_msg'

get_medications() public method

Gets the current medications linked with items from the prescription events.
public get_medications ( ) : array
return array

get_previous_medications() public method

Gets the previous medications linked with items from the prescription events.
public get_previous_medications ( ) : array
return array

hasAllergy() public method

returns true if the patient has the allergy passed in.
public hasAllergy ( $allergy ) : boolean
$allergy
return boolean

hasAllergyStatus() public method

returns true if the allergy status of the patient is known (has allergies, or no known allergies) false otherwise.
public hasAllergyStatus ( ) : boolean
return boolean

hasDisorderTypeByIds() public method

* checks if the patient has a disorder that is defined as being within the SNOMED tree specified by the given $snomed id.
public hasDisorderTypeByIds ( $snomeds )

hasDrugAllergy() public method

public hasDrugAllergy ( integer $drug_id = null ) : boolean
$drug_id integer
return boolean Is patient allergic?

hasLegacyLetters() public method

public hasLegacyLetters ( )

hasOpenEpisodeOfSubspecialty() public method

returns true if patient has an open episode for the given subspecialty id.
public hasOpenEpisodeOfSubspecialty ( $subspecialty_id ) : boolean
$subspecialty_id
return boolean

hasRisk() public method

Check if the patient has a given risk.
public hasRisk ( $riskCompare ) : boolean
$riskCompare
return boolean

hasRiskStatus() public method

returns true if the risk status of the patient is known (has risks, or no known risks) false otherwise.
public hasRiskStatus ( ) : boolean
return boolean

instantiate() protected method

Pass through use_pas flag to allow pas supression.
See also: CActiveRecord::instantiate()
protected instantiate ( $attributes )

isChild() public method

public isChild ( string $check_date = null ) : boolean
$check_date string Optional date to check age on (default is today)
return boolean Is patient a child?

isDeceased() public method

public isDeceased ( ) : boolean
return boolean Is patient deceased?

mergeItemToMedications() protected method

protected mergeItemToMedications ( $medicationList, $prescription ) : mixed
$medicationList
$prescription
return mixed

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Patient
return Patient the static model class

noPas() public method

Suppress PAS integration.
public noPas ( ) : Patient
return Patient

patientMedications() public method

public patientMedications ( $medicationCriteria ) : array
$medicationCriteria
return array

prescriptionItems() public method

public prescriptionItems ( array $exclude ) : array | CActiveRecord[] | null
$exclude array
return array | CActiveRecord[] | null

prescriptionMedicationIds() public method

public prescriptionMedicationIds ( ) : mixed
return mixed

relations() public method

public relations ( ) : array
return array relational rules.

removeDiagnosis() public method

public removeDiagnosis ( $diagnosis_id )

rules() public method

public rules ( ) : array
return array validation rules for model attributes.

search_nr() public method

public search_nr ( $params )

setNoAllergies() public method

marks the patient as having no allergies as of now.
public setNoAllergies ( )

setNoFamilyHistory() public method

marks the patient as having no family history.
public setNoFamilyHistory ( )

setNoRisks() public method

marks the patient as having no allergies as of now.
public setNoRisks ( )

sortMedications() protected method

Sort the medications by start date.
protected sortMedications ( $item1, $item2 ) : boolean
$item1
$item2
return boolean

tableName() public method

public tableName ( ) : string
return string the associated database table name

validateDeceased() public method

public validateDeceased ( $attribute, $params )

Property Details

$_clinical_warnings protected_oe property

storage of warning data
protected $_clinical_warnings

$_nonclinical_warnings protected_oe property

protected $_nonclinical_warnings

$use_pas public_oe property

public $use_pas