Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNFT1-3429: Phone number header label in search #1984

Merged
merged 5 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class PatientSearchResultDetailedPhoneFinder {
[use].code_short_desc_txt,
[locators].[use_cd]
) as [use],
[locators].cd as [type_cd],
[locators].use_cd as [use_cd],
[phone_number].phone_nbr_txt as [phone_number]
from Entity_locator_participation [locators]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
class PatientSearchResultPhoneMapper implements RowMapper<PatientSearchResultPhone> {


record Columns(int type, int use, int number) {
record Columns(int type, int use, int typeCode, int useCode, int number) {
}


private final Columns columns;

PatientSearchResultPhoneMapper() {
this(new Columns(1, 2, 3));
this(new Columns(1, 2, 3, 4, 5));
}

PatientSearchResultPhoneMapper(final Columns columns) {
Expand All @@ -27,8 +27,26 @@ record Columns(int type, int use, int number) {
public PatientSearchResultPhone mapRow(final ResultSet resultSet, final int rowNum) throws SQLException {
String type = resultSet.getString(columns.type());
String use = resultSet.getString(columns.use());
String typeCode = resultSet.getString(columns.typeCode());
String useCode = resultSet.getString(columns.useCode());
String number = resultSet.getString(columns.number());
return new PatientSearchResultPhone(type,use, number);
String displayUse = resolveDisplayUse(typeCode, useCode, use);
return new PatientSearchResultPhone(type, displayUse, number);
}

private String resolveDisplayUse(final String typeCode, final String useCode, final String use) {
if (useCode != null && typeCode != null) {
if (typeCode.equals("PH") && (useCode.equals("WP") || useCode.equals("SB"))) {
return "Work";
}
else if (typeCode.equals("PH") && useCode.equals("H")) {
return "Home";
}
else if (typeCode.equals("CP") && useCode.equals("MC")) {
return "Cell";
}
}
return use;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const displayPhones = (result: PatientSearchResult): JSX.Element => (
<div>
{result.detailedPhones.map((phone, index) => (
<div key={index}>
<ItemGroup type="phone" label={phone.use ?? undefined}>
<ItemGroup type="phone" label={phone.use ?? phone.type}>
{phone.number}
</ItemGroup>
</div>
Expand Down
Loading