Skip to content
Merged
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
20 changes: 13 additions & 7 deletions src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -868,25 +868,31 @@ private String getInstituteData(String className, String methodName, SMSRequest
variableValue = address;
break;
case "address1":
String truncatedAdress1 = institute.getAddress() != null ? institute.getAddress() + " " : "";
String hospitalName1 = institute.getInstitutionName() != null ? institute.getInstitutionName() + " " : "";
String addressValue1 = institute.getAddress() != null ? institute.getAddress() + " " : "";
String truncatedAdress1 = hospitalName1.concat(" ").concat(addressValue1);
if(!truncatedAdress1.isEmpty()) {
variableValue = getSubstringInRange(institute.getAddress(), 0, 29);
variableValue = getSubstringInRange(truncatedAdress1, 0, 29);
}else {
variableValue = "";
}
break;
case "address2":
String truncatedAdress2 = institute.getAddress() != null ? institute.getAddress() + " " : "";
String hospitalName2 = institute.getInstitutionName() != null ? institute.getInstitutionName() + " " : "";
String addressValue2 = institute.getAddress() != null ? institute.getAddress() + " " : "";
String truncatedAdress2 = hospitalName2.concat(" ").concat(addressValue2);
if(!truncatedAdress2.isEmpty()) {
variableValue = getSubstringInRange(institute.getAddress(), 30, 59);
variableValue = getSubstringInRange(truncatedAdress2, 29, 59);
}else {
variableValue = "";
}
break;
case "address3":
String truncatedAdress3 = institute.getAddress() != null ? institute.getAddress() + " " : "";
String hospitalName3 = institute.getInstitutionName() != null ? institute.getInstitutionName() + " " : "";
String addressValue3= institute.getAddress() != null ? institute.getAddress() + " " : "";
String truncatedAdress3 = hospitalName3.concat(" ").concat(addressValue3);
if(!truncatedAdress3.isEmpty()) {
variableValue = getSubstringInRange(institute.getAddress(), 60, 89);
variableValue = getSubstringInRange(truncatedAdress3, 59, 89);
}else {
variableValue = "";
}
Expand Down Expand Up @@ -920,7 +926,7 @@ private String getInstituteData(String className, String methodName, SMSRequest
default:
break;
}
return variableValue.trim();
return variableValue;
}

private static String getSubstringInRange(String input, int startIndex, int endIndex) {
Expand Down