diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java index 60805dcf..b41c7ecc 100644 --- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java +++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java @@ -422,6 +422,18 @@ public class RMNCHBeneficiaryDetailsRmnch { private String phoneNo; @Expose @Transient + private String economicStatus; + @Expose + @Transient + private Integer economicStatusId; + @Expose + @Transient + private String residentialArea; + @Expose + @Transient + private Integer residentialAreaId; + @Expose + @Transient private String contact_number; @Expose @Transient diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java index 0e86127e..52ce4297 100644 --- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java +++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java @@ -111,6 +111,24 @@ public class RMNCHMBeneficiarydetail { @Column(length = 45) private String occupation; + // STOP-444 followup fix: column exists (economicStatus/economicStatusId on + // i_beneficiarydetails) and is 100% NULL across every row, including freshly + // created ones — confirmed no code path, create or edit, has ever written to it. + // The app sends this value (inside i_bendemographics) every time. + private Integer economicStatusId; + + @Column(length = 45) + private String economicStatus; + + // STOP-444 followup fix: same situation as economicStatus above — real column, + // never written. Originally (wrongly) placed on the address entity in an earlier + // pass; corrected here to match where FLW-API's own RMNCHMBeneficiarydetail already + // declares it, confirming this is the real table. + private Integer residentialAreaId; + + @Column(name = "residentialArea") + private String residentialArea; + private Integer phcId; @Column(length = 30) diff --git a/src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java b/src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java index 3a2674aa..6201d6a3 100644 --- a/src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java +++ b/src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java @@ -223,9 +223,7 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex if (demog.has("isGpsUnavailable") && !demog.get("isGpsUnavailable").isJsonNull()) obj.setIsGpsUnavailable(demog.get("isGpsUnavailable").getAsBoolean()); // STOP-444 followup fix: same source object, previously never read for - // anything but GPS. economicStatus deliberately NOT extracted here — its - // correct persisted home is unconfirmed (looks like it belongs on the - // household record, i_householddetails.type_bpl_apl, not the beneficiary). + // anything but GPS. if (demog.has("occupation") && !demog.get("occupation").isJsonNull()) obj.setOccupation(demog.get("occupation").getAsString()); if (demog.has("communityName") && !demog.get("communityName").isJsonNull()) @@ -236,6 +234,18 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex obj.setPinCode(demog.get("pinCode").getAsString()); if (demog.has("blockID") && !demog.get("blockID").isJsonNull()) obj.setBlockId(demog.get("blockID").getAsInt()); + // STOP-444 followup fix: economicStatus previously skipped here — turned + // out i_beneficiarydetails.economicStatus/economicStatusId genuinely exist + // (confirmed via schema, not just source code — 100% NULL across every row + // including fresh ones), so this is the correct persisted home after all. + if (demog.has("economicStatus") && !demog.get("economicStatus").isJsonNull()) + obj.setEconomicStatus(demog.get("economicStatus").getAsString()); + if (demog.has("economicStatusId") && !demog.get("economicStatusId").isJsonNull()) + obj.setEconomicStatusId(demog.get("economicStatusId").getAsInt()); + if (demog.has("residentialArea") && !demog.get("residentialArea").isJsonNull()) + obj.setResidentialArea(demog.get("residentialArea").getAsString()); + if (demog.has("residentialAreaId") && !demog.get("residentialAreaId").isJsonNull()) + obj.setResidentialAreaId(demog.get("residentialAreaId").getAsInt()); } // STOP-444 followup fix: phone number is sent as benPhoneMaps[0].phoneNo, not // a flat field — same lowercase-key mismatch problem as village/block below. @@ -342,6 +352,22 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex if (obj.getReligionID() != null) { rmnchmBeneficiarydetail.setReligionID(obj.getReligionID()); } + if (obj.getEconomicStatus() != null) { + rmnchmBeneficiarydetail.setEconomicStatus(obj.getEconomicStatus()); + } + if (obj.getEconomicStatusId() != null) { + rmnchmBeneficiarydetail.setEconomicStatusId(obj.getEconomicStatusId()); + } + // STOP-444 followup fix: residentialArea/residentialAreaId — corrected here + // from an earlier (wrong) placement on the address entity; confirmed against + // FLW-API's own RMNCHMBeneficiarydetail, which already declares these fields + // on this same table. + if (obj.getResidentialArea() != null) { + rmnchmBeneficiarydetail.setResidentialArea(obj.getResidentialArea()); + } + if (obj.getResidentialAreaId() != null) { + rmnchmBeneficiarydetail.setResidentialAreaId(obj.getResidentialAreaId()); + } if(obj.getFamilyId()!=null && !obj.getFamilyId().isEmpty()){ rmnchmBeneficiarydetail.setFamilyId(obj.getFamilyId());