Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
db1c562
Update pom.xml
5Amogh Sep 25, 2025
0c3b09a
Elasticsearch implementation for Beneficiary Search (#123)
vanitha1822 Jan 8, 2026
c7a52a4
fix: age issue while moving to nurse worklist (#130)
vanitha1822 Jan 8, 2026
cce05f3
Optimize the Elasticsearch for better Response Time (#131)
vanitha1822 Jan 30, 2026
2ad699b
fix: remove the bean function to create the index automatically (#133)
vanitha1822 Jan 30, 2026
64e89b8
Fix ES Issue in the Query (#137)
vanitha1822 Feb 19, 2026
39debc2
Nd/vs/fix es (#138)
vanitha1822 Feb 20, 2026
cbe8fe2
fix: enable multi-word fuzzy search requirement (#139)
vanitha1822 Feb 23, 2026
0590a0c
fix: multi-word search (#140)
vanitha1822 Feb 23, 2026
8b862a8
Fix the column mismatch issue in beneficiary search (#142)
vanitha1822 Feb 27, 2026
1cf6c07
add new column in rmnch table for death and child record
SauravBizbRolly Mar 12, 2026
c32deba
add new column in rmnch table for death and child record
SauravBizbRolly Mar 12, 2026
a6818d4
Merge pull request #144 from PSMRI/add/new_column_in_rmnch
SauravBizbRolly Mar 12, 2026
3703ac6
Cherry-pick health and version API enhancements to release-3.6.1 (#145)
DurgaPrasad-54 Mar 12, 2026
6bdd822
add status of women
SauravBizbRolly Mar 18, 2026
58f3d5c
add status of women
SauravBizbRolly Mar 18, 2026
c16275a
add status of women
SauravBizbRolly Mar 18, 2026
a137f00
add status of women
SauravBizbRolly Mar 18, 2026
e96a152
add status of women
SauravBizbRolly Mar 18, 2026
ef58275
add status of women
SauravBizbRolly Mar 18, 2026
452b809
add status of women
SauravBizbRolly Mar 18, 2026
0f4f378
add status of women
SauravBizbRolly Mar 24, 2026
b46f369
add status of women
SauravBizbRolly Mar 24, 2026
08e5d8c
Rebase 3.6.2 (#150)
vanitha1822 Mar 25, 2026
cb67c59
feat(jwt): enhance jwt validation logging and public endpoint check (…
DurgaPrasad-54 Mar 25, 2026
7022cc4
Merge branch 'add/hwc_status_of_women' into feature/status_of_women_hwc
SauravBizbRolly Mar 25, 2026
c8e7c94
fix: pom version (#152)
vanitha1822 Mar 26, 2026
b20c801
Add the missing properties for 1097_Preprod (#153)
vanitha1822 Mar 26, 2026
1daa411
docs: add CLAUDE.md for Claude Code guidance
snehar-nd Mar 30, 2026
9e1fa0a
fix: map sexualOrientationID during beneficiary update in 1097
snehar-nd May 11, 2026
8a9b68a
Merge branch 'release-3.6.2' into sn/3.6.2
snehar-nd May 12, 2026
46e4911
Sexual orientation data not reflecting under DB record (#157)
snehar-nd May 12, 2026
2c13c3b
feat: add getBenFamilyDetails API and fix searchFamily queries
snehar-nd May 13, 2026
4340aed
fix: preserve existing occupation and education when incoming values …
snehar-nd May 13, 2026
af82844
fix: replace in-memory queue with SELECT FOR UPDATE SKIP LOCKED for B…
vanitha1822 May 13, 2026
1de7c5b
Merge pull request #158 from PSMRI/sn/3.6.2
snehar-nd May 14, 2026
6f23596
aam-2126 Memeberlist is not displying properly
snehar-nd May 18, 2026
1c2ba64
Merge pull request #160 from PSMRI/sn/3.6.2
snehar-nd May 18, 2026
9d7ded3
fix: aam-2313 phone number leading with zero - removed zero (#161)
snehar-nd May 21, 2026
f9471c8
Allowing numbers with zero is search by phone number. (#162)
snehar-nd May 21, 2026
26f29a8
Merge branch 'main' into release-3.6.2
vanitha1822 May 22, 2026
25a0486
fix rmnch duplicate data issue
SauravBizbRolly Jun 4, 2026
0021215
fix rmnch duplicate data issue
SauravBizbRolly Jun 4, 2026
692679b
Merge pull request #164 from PSMRI/fix/duplicate_beneficaryrmnc_issue
SauravBizbRolly Jun 4, 2026
3ceef0a
fix rmnch duplicate data issue
SauravBizbRolly Jun 4, 2026
59c5ef7
Merge pull request #165 from PSMRI/fix/sync_issue_in_rmnch
SauravBizbRolly Jun 4, 2026
553a6c6
Merge branch 'release-3.6.2' into feature/status_of_women_hwc
SauravBizbRolly Jun 4, 2026
9fa1857
merge with release-3.6.2
SauravBizbRolly Jun 4, 2026
b95b68e
merge with release-3.6.2
SauravBizbRolly Jun 4, 2026
bc39ce1
merge with release-3.6.2
SauravBizbRolly Jun 4, 2026
f46b693
fix beneficiary save
SauravBizbRolly Jun 12, 2026
3162f66
fix beneficiary save
SauravBizbRolly Jun 12, 2026
c1e2e2d
fix beneficiary save
SauravBizbRolly Jun 12, 2026
853ec97
fix beneficiary save
SauravBizbRolly Jun 13, 2026
52caaa1
fix beneficiary save
SauravBizbRolly Jun 13, 2026
d75ed23
fix beneficiary save
SauravBizbRolly Jun 16, 2026
028e1b7
fix beneficiary save
SauravBizbRolly Jun 16, 2026
6258dae
fix beneficiary save
SauravBizbRolly Jun 16, 2026
5367efa
fix duplicate ben id issue
SauravBizbRolly Jun 16, 2026
ee77095
change release version
SauravBizbRolly Jun 17, 2026
c3e95f2
Merge pull request #166 from PSMRI/change/release_version
SauravBizbRolly Jun 17, 2026
effbfcc
Merge branch 'release-3.6.2' into release-3.9.0
SauravBizbRolly Jun 17, 2026
8d83a9a
save abha id in health maping with beneficiaryID
SauravBizbRolly Jun 17, 2026
3b7dd52
abha id add in entity class
SauravBizbRolly Jun 17, 2026
1d8dbe7
abha id add in entity class
SauravBizbRolly Jun 17, 2026
1801efe
abha id add in entity class
SauravBizbRolly Jun 17, 2026
594ab59
abha id add in entity class
SauravBizbRolly Jun 17, 2026
ec021c4
abha id add in entity class
SauravBizbRolly Jun 17, 2026
5a83005
abha id add in entity class
SauravBizbRolly Jun 17, 2026
32db7e1
abha id add in entity class
SauravBizbRolly Jun 17, 2026
a90fe13
abha id add in entity class
SauravBizbRolly Jun 17, 2026
59dbd6c
Merge pull request #169 from PSMRI/feature/save_health_id_in_health_m…
SauravBizbRolly Jun 19, 2026
dc2ad36
abha id add in entity class
SauravBizbRolly Jun 22, 2026
107d6a9
Merge branch 'release-3.6.2' into release-3.8.0
SauravBizbRolly Jun 24, 2026
f1ec971
fixed issue of Query did not return a unique result: 2 results were r…
SauravBizbRolly Jun 24, 2026
ad138d7
fixed issue of Query did not return a unique result: 2 results were r…
SauravBizbRolly Jun 24, 2026
40924cb
Merge branch 'main' into release-3.8.0
snehar-nd Jun 30, 2026
83b6046
attach logger in response
SauravBizbRolly Jul 3, 2026
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.common.identity</groupId>
<artifactId>identity-api</artifactId>
<version>3.6.2</version>
<version>3.8.0</version>

<packaging>war</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
import java.util.List;
import java.util.Objects;

import com.iemr.common.identity.data.rmnch.RMNCHBeneficiaryDetailsRmnch;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -315,6 +318,17 @@ public String searchBeneficiaryByVillageIdAndLastModDate(
}
return response;
}


@PostMapping("/getRmnchDataByBenRedID")
public ResponseEntity<RMNCHBeneficiaryDetailsRmnch> getRmnchDataByBenID(@RequestBody BigInteger object) {
Comment on lines +323 to +324

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“ Maintainability & Code Quality | 🟠 Major | ⚑ Quick win

Likely typo in endpoint path and missing Swagger @Operation annotation.

/getRmnchDataByBenRedID looks like a typo of "BenRegID" (the service method underneath is getRmnchDataByBenID, and the domain concept is benRegID throughout the file). Since this is a brand-new endpoint, fixing the name now avoids baking a typo into the public API surface. Also, every other endpoint here carries an @Operation summary for Swagger docs; this one doesn't.

+	`@Operation`(summary = "Get RMNCH data by beneficiary registration id")
-	`@PostMapping`("/getRmnchDataByBenRedID")
+	`@PostMapping`("/getRmnchDataByBenRegID")
 	public ResponseEntity<RMNCHBeneficiaryDetailsRmnch> getRmnchDataByBenID(`@RequestBody` BigInteger object) {

As per coding guidelines, **/controller/**/*.java: "Use SpringDoc OpenAPI (Swagger UI) for API documentation accessible at /swagger-ui.html".

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@PostMapping("/getRmnchDataByBenRedID")
public ResponseEntity<RMNCHBeneficiaryDetailsRmnch> getRmnchDataByBenID(@RequestBody BigInteger object) {
`@Operation`(summary = "Get RMNCH data by beneficiary registration id")
`@PostMapping`("/getRmnchDataByBenRegID")
public ResponseEntity<RMNCHBeneficiaryDetailsRmnch> getRmnchDataByBenID(`@RequestBody` BigInteger object) {
πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/iemr/common/identity/controller/IdentityController.java`
around lines 323 - 324, The new endpoint in IdentityController is missing the
standard Swagger documentation and its path appears to contain a typo. Update
the `@PostMapping` on getRmnchDataByBenID to use the intended benRegID-style route
instead of the current β€œBenRedID” spelling, and add an `@Operation` summary like
the other controller methods so the endpoint is documented in SpringDoc Swagger
UI.

Source: Coding guidelines

try {
RMNCHBeneficiaryDetailsRmnch data = svc.getRmnchDataByBenID(object);
return ResponseEntity.ok(data);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
}
// search beneficiary by lastModDate and districtID
@Operation(summary ="Get count of beneficiary by villageId and last modified date-time")
@PostMapping(path = "/countBenByVillageIdAndLastModifiedDate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@

import java.sql.Timestamp;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
Expand Down Expand Up @@ -56,22 +59,68 @@

@PostMapping(value = "/syncDataToAmrit", consumes = "application/json", produces = "application/json")
@Operation(summary = "Sync data to AMRIT for already regestered beneficiary with AMRIT beneficiary id ")
public String syncDataToAmrit(@RequestBody String requestOBJ) {
public String syncDataToAmrit(@RequestBody String requestOBJ,@RequestHeader(value = "jwttoken") String authorization) {
OutputResponse response = new OutputResponse();
try {
if (requestOBJ != null) {
String s = rmnchDataSyncService.syncDataToAmrit(requestOBJ);

String s = rmnchDataSyncService.syncDataToAmrit(requestOBJ,authorization);
logger.info("syncDataToAmrit Response: {}", s);

response.setResponse(s);

logger.info(" syncDataToAmrit Final API Response: {}", response.toString());
} else
response.setError(5000, "Invalid/NULL request obj");
} catch (Exception e) {
logger.error("Error in RMNCH mobile data sync : {} " , e.getMessage());
e.printStackTrace();
response.setError(5000, "Error in RMNCH mobile data sync : " + e);
}
return response.toString();

}

@PostMapping(value = "/syncDataToAmritByHwc", consumes = "application/json", produces = "application/json")
@Operation(summary = "Sync data to AMRIT for already registered beneficiary with AMRIT beneficiary id")
public ResponseEntity<?> syncDataToAmritHwc(@RequestBody String requestOBJ) {

try {
if (requestOBJ == null || requestOBJ.isEmpty()) {
return ResponseEntity.badRequest().body("Invalid/NULL request obj");
}

JsonObject requestObj = new Gson().fromJson(requestOBJ, JsonObject.class);

Long beneficiaryID = requestObj.has("benficieryid") && !requestObj.get("benficieryid").isJsonNull()

Check failure on line 95 in src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "benficieryid" 3 times.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Identity-API&issues=AZ8YVN8lwCc9a8pQX3xL&open=AZ8YVN8lwCc9a8pQX3xL&pullRequest=171
? requestObj.get("benficieryid").getAsLong()
: null;

Long beneficiaryRegID = requestObj.has("benRegId") && !requestObj.get("benRegId").isJsonNull()

Check failure on line 99 in src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "benRegId" 3 times.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Identity-API&issues=AZ8YVN8lwCc9a8pQX3xK&open=AZ8YVN8lwCc9a8pQX3xK&pullRequest=171
? requestObj.get("benRegId").getAsLong()
: null;

if (beneficiaryID == null || beneficiaryRegID == null) {
return ResponseEntity.badRequest().body("beneficiaryID or beneficiaryRegID is missing");
}

String result = rmnchDataSyncService.saveBeneficiaryDetailsAfterRegistration(
beneficiaryID,
beneficiaryRegID,
requestOBJ
);

return ResponseEntity.ok(result);

} catch (Exception e) {
logger.error("Error in RMNCH mobile data sync : {}", e.getMessage());
return ResponseEntity.internalServerError()
.body("Error in RMNCH mobile data sync : " + e.getMessage());
}
}



// @Deprecated
@PostMapping(value = "/getBeneficiaryDataForVillage", consumes = "application/json", produces = "application/json")
@Operation(summary = "Get beneficiary data for given village ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,11 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Expose
private Boolean isDeactivate;

@Expose
@Transient
private String abhaId;

@Expose
@Transient
private String familyId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,12 @@ public class RMNCHMBeneficiarydetail {
@Expose
@Transient
private Integer ProviderServiceMapID;

@Expose
@Transient
private String abhaId;

@Expose
@Column(name = "familyid")
private String familyId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public int compareTo(BeneficiariesDTO ben) {
private BigInteger religionId;
private String religion;
private String monthlyFamilyIncome;
private String reproductiveStatus;
private Integer reproductiveStatusId;
// End Outreach

// Start 1097
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public class IdentityDTO {
private Integer incomeStatusId;
private String incomeStatus;
private String monthlyFamilyIncome;
private String reproductiveStatus;
private Integer reproductiveStatusId;

@Expose
private Integer vanID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
package com.iemr.common.identity.repo.rmnch;

import java.math.BigInteger;
import java.util.List;

import io.swagger.v3.oas.annotations.info.License;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
Expand All @@ -35,8 +37,16 @@ public interface RMNCHBenDetailsRepo extends CrudRepository<RMNCHMBeneficiarydet
@Query(" SELECT t FROM RMNCHMBeneficiarydetail t WHERE t.id = :vanSerialNo AND t.VanID = :vanID")
public RMNCHMBeneficiarydetail getByIdAndVanID(@Param("vanSerialNo") BigInteger vanSerialNo,
@Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHMBeneficiarydetail t WHERE t.id = " +
"(SELECT m.benDetailsId from RMNCHMBeneficiarymapping m where m.benRegId = :beneficiaryRegID)")
public RMNCHMBeneficiarydetail getByBenRegID(@Param("beneficiaryRegID") BigInteger beneficiaryRegID);

@Query("""
SELECT t
FROM RMNCHMBeneficiarydetail t
WHERE t.id IN (
SELECT m.benDetailsId
FROM RMNCHMBeneficiarymapping m
WHERE m.benRegId = :beneficiaryRegID
)
""")
List<RMNCHMBeneficiarydetail> getByBenRegID(
@Param("beneficiaryRegID") BigInteger beneficiaryRegID);
Comment on lines +40 to +51

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ—„οΈ Data Integrity & Integration | 🟠 Major | ⚑ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== repo file ==\n'
sed -n '1,140p' src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java

printf '\n== usages ==\n'
rg -n "getByBenRegID\\(" src/main/java

printf '\n== service excerpt ==\n'
sed -n '140,230p' src/main/java/com/iemr/common/identity/service/impl/RmnchDataSyncServiceImpl.java

printf '\n== related entities ==\n'
rg -n "class RMNCHMBeneficiary(mapping|detail)|`@Table`|`@OrderBy`|`@OneToMany`|`@ManyToOne`" src/main/java/com/iemr/common/identity -g '*.java'

Repository: PSMRI/Identity-API

Length of output: 2763


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== service excerpt ==\n'
sed -n '160,210p' src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java

printf '\n== mapping entity ==\n'
sed -n '1,240p' src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarymapping.java

printf '\n== detail entity ==\n'
sed -n '1,240p' src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java

printf '\n== repo/entity references ==\n'
rg -n "benRegId|benDetailsId|`@Id`|`@OneToMany`|`@ManyToOne`|`@JoinColumn`|`@OrderBy`|`@UniqueConstraint`|unique = true" src/main/java/com/iemr/common/identity/data/rmnch src/main/java/com/iemr/common/identity/service/rmnch -g '*.java'

Repository: PSMRI/Identity-API

Length of output: 12835


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== benDetailsId usages ==\n'
rg -n "setBenDetailsId|getBenDetailsId|benDetailsId" src/main/java -g '*.java'

printf '\n== benRegId usages ==\n'
rg -n "setBenRegId|getBenRegId|benRegId" src/main/java -g '*.java'

printf '\n== ddl/schema hints ==\n'
rg -n "i_beneficiarymapping|beneficiarymapping|BenDetailsId|BenRegId|unique constraint|UNIQUE" . -g '*.{sql,java,xml,yml,yaml,properties}'

Repository: PSMRI/Identity-API

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== DDL / migration hits ==\n'
rg -n "i_beneficiarymapping|i_beneficiarydetails|BenRegId|BenDetailsId|UNIQUE|unique" src/main/resources src/main/java -g '*.{sql,xml,yml,yaml,properties,java}' | head -n 200

printf '\n== RMNCH detail-related repos ==\n'
sed -n '1,120p' src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBeneficiaryDetailsRmnchRepo.java

printf '\n== mapping-repo methods near benRegId ==\n'
sed -n '35,120p' src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHMBenRegIdMapRepo.java

Repository: PSMRI/Identity-API

Length of output: 32316


Make the first beneficiary detail selection deterministic. RmnchDataSyncServiceImpl reads .get(0) from this list, but there’s no ORDER BY here, so when multiple rows match the same beneficiaryRegID the updated record can vary across executions. Sort by a stable column like beneficiaryDetailsId (or createdDate) before taking the first row.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java`
around lines 40 - 51, The getByBenRegID query in RMNCHBenDetailsRepo returns
multiple RMNCHMBeneficiarydetail rows without a deterministic order, but
RmnchDataSyncServiceImpl relies on .get(0). Update the `@Query` so the result is
consistently ordered before selection, using a stable field on
RMNCHMBeneficiarydetail such as beneficiaryDetailsId or createdDate, and keep
the method signature unchanged so the service always picks the same row.

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.iemr.common.identity.repo.rmnch;

import java.math.BigInteger;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
Expand All @@ -37,5 +38,5 @@ public RMNCHBeneficiaryDetailsRmnch getByIdAndVanID(@Param("vanSerialNo") BigInt
@Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHBeneficiaryDetailsRmnch t WHERE t.BenRegId =:benRegID ")
public RMNCHBeneficiaryDetailsRmnch getByRegID(@Param("benRegID") BigInteger benRegId);
public List<RMNCHBeneficiaryDetailsRmnch> getByRegID(@Param("benRegID") BigInteger benRegId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.iemr.common.identity.repo.rmnch;

import java.math.BigInteger;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
Expand All @@ -36,5 +37,5 @@ public interface RMNCHBornBirthDetailsRepo extends CrudRepository<RMNCHBornBirth
public RMNCHBornBirthDetails getByIdAndVanID(@Param("vanSerialNo") Long vanSerialNo, @Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHBornBirthDetails t WHERE t.BenRegId =:benRegID ")
public RMNCHBornBirthDetails getByRegID(@Param("benRegID") BigInteger benRegID);
public List<RMNCHBornBirthDetails> getByRegID(@Param("benRegID") BigInteger benRegID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface RMNCHCBACDetailsRepo extends CrudRepository<RMNCHCBACdetails, L
public RMNCHCBACdetails getByIdAndVanID(@Param("vanSerialNo") Long vanSerialNo, @Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHCBACdetails t WHERE t.BenRegId =:benRegID")
public RMNCHCBACdetails getByRegID(@Param("benRegID") BigInteger benRegID);
public List<RMNCHCBACdetails> getByRegID(@Param("benRegID") BigInteger benRegID);

@Query(value = "select beneficiary_visit_code,visit_category from db_iemr.i_ben_flow_outreach where beneficiary_reg_id=:benRegID AND beneficiary_visit_code is not null AND visit_category is not null order by created_date desc limit 1", nativeQuery = true)
public List<Object[]> getVisitDetailsbyRegID(@Param("benRegID") Long benRegID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@

import com.iemr.common.identity.data.rmnch.RMNCHHouseHoldDetails;

import java.util.List;

@Repository
public interface RMNCHHouseHoldDetailsRepo extends CrudRepository<RMNCHHouseHoldDetails, Long> {
@Query(" SELECT t FROM RMNCHHouseHoldDetails t WHERE t.id = :vanSerialNo AND t.VanID = :vanID")
public RMNCHHouseHoldDetails getByIdAndVanID(@Param("vanSerialNo") long vanSerialNo, @Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHHouseHoldDetails t WHERE t.houseoldId =:houseoldId ")
public RMNCHHouseHoldDetails getByHouseHoldID(@Param("houseoldId") long houseoldId);
@Query("SELECT t FROM RMNCHHouseHoldDetails t WHERE t.houseoldId = :houseoldId")
List<RMNCHHouseHoldDetails> getByHouseHoldID(@Param("houseoldId") long houseoldId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.iemr.common.identity.repo.rmnch;

import java.math.BigInteger;
import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
Expand Down
48 changes: 36 additions & 12 deletions src/main/java/com/iemr/common/identity/service/IdentityService.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,16 @@
return beneficiaryList;
}


public RMNCHBeneficiaryDetailsRmnch getRmnchDataByBenID(BigInteger benID) {
RMNCHBeneficiaryDetailsRmnch rmnchBeneficiaryDetailsRmnch = new RMNCHBeneficiaryDetailsRmnch();

if(!rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(benID).isEmpty()){
rmnchBeneficiaryDetailsRmnch = rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(benID).get(0);
}
return rmnchBeneficiaryDetailsRmnch;
}

public Long countBeneficiaryByVillageIdAndLastModifyDate(List<Integer> villageIDs, Timestamp lastModifiedDate) {
Long beneficiaryCount = 0L;
try {
Expand Down Expand Up @@ -853,7 +863,7 @@
return beneficiaryList;
}

private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {

Check failure on line 866 in src/main/java/com/iemr/common/identity/service/IdentityService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Identity-API&issues=AZ8YVN74wCc9a8pQX3xJ&open=AZ8YVN74wCc9a8pQX3xJ&pullRequest=171
MBeneficiarymapping mapping = new MBeneficiarymapping();
if (benMapArr != null && benMapArr.length == 12 && benMapArr[8] != null && benMapArr[9] != null) {
mapping.setBenMapId(getBigIntegerValueFromObject(benMapArr[0]));
Expand Down Expand Up @@ -884,21 +894,27 @@
//benMapOBJ = mappingRepo.getMapping(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]);

BigInteger benRegId = new BigInteger(benMapArr[5].toString());
RMNCHBeneficiaryDetailsRmnch obj = rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(benRegId);

if (obj != null) {
if (obj.getHouseoldId() != null) {
mapping.setHouseHoldID(obj.getHouseoldId());
}
if (obj.getGuidelineId() != null) {
mapping.setGuideLineID(obj.getGuidelineId());
}
if (obj.getRchid() != null) {
mapping.setRchID(obj.getRchid());
if(!rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(benRegId).isEmpty()){
RMNCHBeneficiaryDetailsRmnch obj = rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(benRegId).get(0);

if (obj != null) {
if (obj.getHouseoldId() != null) {
mapping.setHouseHoldID(obj.getHouseoldId());
}
if (obj.getGuidelineId() != null) {
mapping.setGuideLineID(obj.getGuidelineId());
}
if (obj.getRchid() != null) {
mapping.setRchID(obj.getRchid());
}
}
}




}
return mapping;
}
Expand Down Expand Up @@ -1987,6 +2003,7 @@
* @return
*/
private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
RMNCHBeneficiaryDetailsRmnch rmnchBeneficiaryDetailsRmnch = new RMNCHBeneficiaryDetailsRmnch();
BeneficiariesDTO bdto = mapper.mBeneficiarymappingToBeneficiariesDTO(benMap);
if (null != benMap && null != benMap.getMBeneficiarydetail()
&& !StringUtils.isEmpty(benMap.getMBeneficiarydetail().getFaceEmbedding())) {
Expand All @@ -2002,6 +2019,13 @@
bdto.setFaceEmbedding(floatList);
}
// bdto.setOtherFields(benMap.getMBeneficiarydetail().getOtherFields());

if(!rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(benMap.getBenRegId()).isEmpty() ){
rmnchBeneficiaryDetailsRmnch = rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(benMap.getBenRegId()).get(0);
bdto.setReproductiveStatus(rmnchBeneficiaryDetailsRmnch.getReproductiveStatus());
bdto.setReproductiveStatusId(rmnchBeneficiaryDetailsRmnch.getReproductiveStatusId());
}

bdto.setBeneficiaryFamilyTags(
mapper.mapToMBeneficiaryfamilymappingWithBenFamilyDTOList(benMap.getMBeneficiaryfamilymappings()));
bdto.setBeneficiaryIdentites(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
package com.iemr.common.identity.service.rmnch;

public interface RmnchDataSyncService {
public String syncDataToAmrit(String requestOBJ) throws Exception;
public String syncDataToAmrit(String requestOBJ, String authorization) throws Exception;
public String saveBeneficiaryDetailsAfterRegistration(
Long beneficiaryID,
Long beneficiaryRegID,
String comingRequest);
public String getBenData(String requestOBJ, String authorisation) throws Exception;
public String getBenDataByAsha(String requestOBJ, String authorisation) throws Exception;
}
Loading
Loading