From 68bb0805100885199faf0e1cb3613591d0910367 Mon Sep 17 00:00:00 2001
From: Devika <de40034072@wipro.com>
Date: Wed, 20 Dec 2023 18:03:58 +0530
Subject: [PATCH 1/5] Added limit condition while fetching Item stock entry
 details in eaushadha API

---
 .../iemr/common/repository/eausadha/ItemStockEntryRepo.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/iemr/common/repository/eausadha/ItemStockEntryRepo.java b/src/main/java/com/iemr/common/repository/eausadha/ItemStockEntryRepo.java
index eae06706..1403681d 100644
--- a/src/main/java/com/iemr/common/repository/eausadha/ItemStockEntryRepo.java
+++ b/src/main/java/com/iemr/common/repository/eausadha/ItemStockEntryRepo.java
@@ -15,7 +15,8 @@
 @RestResource(exported = false)
 public interface ItemStockEntryRepo extends CrudRepository<ItemStockEntry, Integer> {
 	
-	@Query("Select t from ItemStockEntry t Where t.itemID = :itemId And t.batchNo = :batchNo")
+	@Query(nativeQuery = true, value = " SELECT * FROM db_iemr.t_itemstockentry "
+			+ " WHERE ItemID =:itemId and BatchNo =:batchNo LIMIT 1" )
 	ItemStockEntry getItemStocks(@Param("itemId")Integer itemId, @Param("batchNo")String batchNo);
 	
 	@Transactional

From 7afc342b34b640d23bc82c79559d12e644d484bb Mon Sep 17 00:00:00 2001
From: Devika <de40034072@wipro.com>
Date: Tue, 30 Jan 2024 13:19:17 +0530
Subject: [PATCH 2/5] Minor modifications in 1097 referral sms template

---
 .../java/com/iemr/common/service/sms/SMSServiceImpl.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
index 1d63bb45..51e6c49c 100644
--- a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
+++ b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
@@ -878,7 +878,7 @@ private String getInstituteData(String className, String methodName, SMSRequest
 		case "address2":
 			String truncatedAdress2 = institute.getAddress() != null ? institute.getAddress() + " " : "";
 			if(!truncatedAdress2.isEmpty()) {
-				variableValue = getSubstringInRange(institute.getAddress(), 30, 59);
+				variableValue = getSubstringInRange(institute.getAddress(), 29, 59);
 			}else {
 				variableValue = "";
 			}
@@ -886,7 +886,7 @@ private String getInstituteData(String className, String methodName, SMSRequest
 		case "address3":
 			String truncatedAdress3 = institute.getAddress() != null ? institute.getAddress() + " " : "";
 			if(!truncatedAdress3.isEmpty()) {
-				variableValue = getSubstringInRange(institute.getAddress(), 60, 89);
+				variableValue = getSubstringInRange(institute.getAddress(), 59, 89);
 			}else {
 				variableValue = "";
 			}
@@ -920,7 +920,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) {

From 593728d02ae4c7dbb2663e19848151876b061ce3 Mon Sep 17 00:00:00 2001
From: Devika <de40034072@wipro.com>
Date: Wed, 31 Jan 2024 15:29:09 +0530
Subject: [PATCH 3/5] Added institute name along with referral SMS

---
 .../common/service/sms/SMSServiceImpl.java     | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
index 51e6c49c..0de15785 100644
--- a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
+++ b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java
@@ -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(), 29, 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(), 59, 89);
+				variableValue = getSubstringInRange(truncatedAdress3, 59, 89);
 			}else {
 				variableValue = "";
 			}

From 0ad1dd7afef4d66a3f32fcb94dfbbb83c7528279 Mon Sep 17 00:00:00 2001
From: Devika <de40034072@wipro.com>
Date: Fri, 16 Feb 2024 18:28:54 +0530
Subject: [PATCH 4/5] Removed myapp propeties and minor change in interceptor.

---
 .../config/BlockingHttpMethodInterceptor.java | 36 -------------------
 .../iemr/common/config/InterceptorConfig.java | 17 +++------
 .../CareStreamCreateOrderController.java      |  1 -
 3 files changed, 5 insertions(+), 49 deletions(-)
 delete mode 100644 src/main/java/com/iemr/common/config/BlockingHttpMethodInterceptor.java

diff --git a/src/main/java/com/iemr/common/config/BlockingHttpMethodInterceptor.java b/src/main/java/com/iemr/common/config/BlockingHttpMethodInterceptor.java
deleted file mode 100644
index 447e3aaa..00000000
--- a/src/main/java/com/iemr/common/config/BlockingHttpMethodInterceptor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.iemr.common.config;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.ModelAndView;
-
-public class BlockingHttpMethodInterceptor implements HandlerInterceptor {
-	@Override
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-        String method = request.getMethod();
-        if (!("GET".equals(method) || "POST".equals(method))) {
-            response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
-            return false;
-        }
-        return true;
-}
-
-	@Override
-	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
-			ModelAndView modelAndView) throws Exception {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
-			throws Exception {
-		// TODO Auto-generated method stub
-		
-	}
-}
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/config/InterceptorConfig.java b/src/main/java/com/iemr/common/config/InterceptorConfig.java
index 37817edf..2beb8de9 100644
--- a/src/main/java/com/iemr/common/config/InterceptorConfig.java
+++ b/src/main/java/com/iemr/common/config/InterceptorConfig.java
@@ -29,21 +29,14 @@
 import com.iemr.common.utils.http.HTTPRequestInterceptor;
 
 @Configuration
-public class InterceptorConfig extends WebMvcConfigurerAdapter
-{
+public class InterceptorConfig extends WebMvcConfigurerAdapter {
 
 	@Autowired
 	HTTPRequestInterceptor requestInterceptor;
 
-//	@Override
-//	public void addInterceptors(InterceptorRegistry registry)
-//	{
-//		registry.addInterceptor(requestInterceptor);
-//	}
-	
 	@Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        registry.addInterceptor(new BlockingHttpMethodInterceptor())
-                .addPathPatterns("/**"); 
-    }
+	public void addInterceptors(InterceptorRegistry registry) {
+		registry.addInterceptor(requestInterceptor);
+	}
+
 }
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/controller/carestream/CareStreamCreateOrderController.java b/src/main/java/com/iemr/common/controller/carestream/CareStreamCreateOrderController.java
index 529c759c..4a4f2a05 100644
--- a/src/main/java/com/iemr/common/controller/carestream/CareStreamCreateOrderController.java
+++ b/src/main/java/com/iemr/common/controller/carestream/CareStreamCreateOrderController.java
@@ -44,7 +44,6 @@
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
-@PropertySource("classpath:myapp.properties")
 @RestController
 @RequestMapping(value = "/carestream")
 public class CareStreamCreateOrderController {

From 6cfbb83c1b61002af1229c37198b37eb060b5faa Mon Sep 17 00:00:00 2001
From: Devika <de40034072@wipro.com>
Date: Thu, 21 Mar 2024 10:11:08 +0530
Subject: [PATCH 5/5] Change in Phone No comparison while fetching call audit
 details

---
 .../callhandling/BeneficiaryCallServiceImpl.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/iemr/common/service/callhandling/BeneficiaryCallServiceImpl.java b/src/main/java/com/iemr/common/service/callhandling/BeneficiaryCallServiceImpl.java
index c554ee8d..55f6b09c 100644
--- a/src/main/java/com/iemr/common/service/callhandling/BeneficiaryCallServiceImpl.java
+++ b/src/main/java/com/iemr/common/service/callhandling/BeneficiaryCallServiceImpl.java
@@ -1070,8 +1070,12 @@ private Long getTotalCallCount(CriteriaBuilder criteriaBuilder, BeneficiaryCall
 			predicates.add(criteriaBuilder.equal(entityRoot.get("callTypeID"), callRequest.getCallTypeID()));
 		}
 
-		predicates.add(criteriaBuilder.like(entityRoot.get("phoneNo"),
-				(callRequest.getPhoneNo() == null) ? "%%" : callRequest.getPhoneNo()));
+//		predicates.add(criteriaBuilder.like(entityRoot.get("phoneNo"),
+//				(callRequest.getPhoneNo() == null) ? "%%" : callRequest.getPhoneNo()));
+		
+		if (callRequest.getPhoneNo() != null) {
+			predicates.add(criteriaBuilder.equal(entityRoot.get("phoneNo"), callRequest.getPhoneNo()));
+		}
 
 		if (callRequest.getInboundOutbound() != null) {
 			callRequest.setIsOutbound(callRequest.getInboundOutbound().equalsIgnoreCase("outbound") ? true : false);
@@ -1211,8 +1215,12 @@ public String filterCallList(String request, String auth) throws IEMRException {
 			predicates.add(criteriaBuilder.equal(root.get("callTypeID"), callRequest.getCallTypeID()));
 		}
 
-		predicates.add(criteriaBuilder.like(root.get("phoneNo"),
-				(callRequest.getPhoneNo() == null) ? "%%" : callRequest.getPhoneNo()));
+//		predicates.add(criteriaBuilder.like(root.get("phoneNo"),
+//				(callRequest.getPhoneNo() == null) ? "%%" : callRequest.getPhoneNo()));
+		
+		if (callRequest.getPhoneNo() != null) {
+			predicates.add(criteriaBuilder.equal(root.get("phoneNo"), callRequest.getPhoneNo()));
+		}
 
 		if (callRequest.getInboundOutbound() != null) {
 			callRequest.setIsOutbound(callRequest.getInboundOutbound().equalsIgnoreCase("outbound") ? true : false);
