fix: align patient check email lookup

This commit is contained in:
mahdahar 2026-04-13 12:15:05 +07:00
parent c49743bbf3
commit ee7b677ae4
4 changed files with 5 additions and 33 deletions

View File

@ -256,8 +256,6 @@ class PatientController extends Controller {
try {
$PatientID = $this->request->getVar('PatientID');
$EmailAddress = $this->request->getVar('EmailAddress');
$EmailAddress1 = $this->request->getVar('EmailAddress1');
$EmailAddress2 = $this->request->getVar('EmailAddress2');
$Phone = $this->request->getVar('Phone');
if (!empty($PatientID)){
@ -273,13 +271,11 @@ class PatientController extends Controller {
->where('PatientID', $PatientID)
->get()
->getRowArray();
} elseif (!empty($EmailAddress) || !empty($EmailAddress1) || !empty($EmailAddress2)){
$searchEmail = $EmailAddress ?: $EmailAddress1 ?: $EmailAddress2;
} elseif (!empty($EmailAddress)) {
$patient = $this->db->table('patient')
->groupStart()
->where('EmailAddress1', $searchEmail)
->orWhere('EmailAddress2', $searchEmail)
->where('EmailAddress1', $EmailAddress)
->orWhere('EmailAddress2', $EmailAddress)
->groupEnd()
->get()
->getRowArray();

View File

@ -2937,18 +2937,6 @@ paths:
type: string
format: email
description: Email address to check
- name: EmailAddress1
in: query
schema:
type: string
format: email
description: Email address alias to check
- name: EmailAddress2
in: query
schema:
type: string
format: email
description: Email address alias to check
- name: Phone
in: query
schema:

View File

@ -109,18 +109,6 @@
type: string
format: email
description: Email address to check
- name: EmailAddress1
in: query
schema:
type: string
format: email
description: Email address alias to check
- name: EmailAddress2
in: query
schema:
type: string
format: email
description: Email address alias to check
- name: Phone
in: query
schema:

View File

@ -66,10 +66,10 @@ class PatientCheckTest extends CIUnitTestCase
$this->assertIsBool($data['data']);
}
public function testCheckEmailAddressAliasExists()
public function testCheckEmailAddressMatchesSecondaryColumn()
{
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
'EmailAddress1' => 'dummy1@test.com',
'EmailAddress' => 'dummy1@test.com',
]);
$result->assertStatus(200);