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

View File

@ -2937,18 +2937,6 @@ paths:
type: string type: string
format: email format: email
description: Email address to check 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 - name: Phone
in: query in: query
schema: schema:

View File

@ -109,18 +109,6 @@
type: string type: string
format: email format: email
description: Email address to check 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 - name: Phone
in: query in: query
schema: schema:

View File

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