diff --git a/pom.xml b/pom.xml
index 9eda8258..04fad9b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0com.iemr.common.identityidentity-api
- 3.9.0
+ 3.8.3war
diff --git a/src/main/environment/1097_ci.properties b/src/main/environment/1097_ci.properties
index 514f675d..371df704 100644
--- a/src/main/environment/1097_ci.properties
+++ b/src/main/environment/1097_ci.properties
@@ -34,3 +34,11 @@ elasticsearch.index.beneficiary=@env.ELASTICSEARCH_INDEX_BENEFICIARY@
# Enable/Disable ES (for gradual rollout)
elasticsearch.enabled=@env.ELASTICSEARCH_ENABLED@
+# Van/local-laptop deployments only. The 1097 service is not a van deployment, so this
+# stays false — but must still be set explicitly, since IdentityService.java (shared with
+# the common_* build) now requires this property with no inline default.
+stoptb.enforce.vanid=false
+# Same reasoning — not a van deployment, but RmnchDataSyncServiceImpl (shared with the
+# common_* build) now requires this property explicitly, no inline default.
+stoptb.van.id=0
+
diff --git a/src/main/environment/1097_docker.properties b/src/main/environment/1097_docker.properties
index 88df0354..d3eefc0d 100644
--- a/src/main/environment/1097_docker.properties
+++ b/src/main/environment/1097_docker.properties
@@ -34,3 +34,11 @@ elasticsearch.index.beneficiary=${ELASTICSEARCH_INDEX_BENEFICIARY}
# Enable/Disable ES (for gradual rollout)
elasticsearch.enabled=${ELASTICSEARCH_ENABLED}
+# Van/local-laptop deployments only. The 1097 service is not a van deployment, so this
+# stays false — but must still be set explicitly, since IdentityService.java (shared with
+# the common_* build) now requires this property with no inline default.
+stoptb.enforce.vanid=false
+# Same reasoning — not a van deployment, but RmnchDataSyncServiceImpl (shared with the
+# common_* build) now requires this property explicitly, no inline default.
+stoptb.van.id=0
+
diff --git a/src/main/environment/1097_example.properties b/src/main/environment/1097_example.properties
index ba2f3211..ab928d52 100644
--- a/src/main/environment/1097_example.properties
+++ b/src/main/environment/1097_example.properties
@@ -31,3 +31,11 @@ elasticsearch.index.beneficiary=beneficiary_index
# Enable/Disable ES (for gradual rollout)
elasticsearch.enabled=true
+# Van/local-laptop deployments only. The 1097 service is not a van deployment, so this
+# stays false — but must still be set explicitly, since IdentityService.java (shared with
+# the common_* build) now requires this property with no inline default.
+stoptb.enforce.vanid=false
+# Same reasoning — not a van deployment, but RmnchDataSyncServiceImpl (shared with the
+# common_* build) now requires this property explicitly, no inline default.
+stoptb.van.id=0
+
diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties
index e32dc366..ae899db2 100644
--- a/src/main/environment/common_ci.properties
+++ b/src/main/environment/common_ci.properties
@@ -22,6 +22,11 @@ fhir-url=@env.FHIR_API@
# Redis Config
spring.redis.host=@env.REDIS_HOST@
+# Stop TB: when true, RMNCH data sync fails with an error if camp (vanID) is not configured
+stoptb.enforce.vanid=@env.STOPTB_ENFORCE_VANID@
+# Stop TB: this deployment's van/camp ID, replacing the old Redis camp:vanID lookup
+stoptb.van.id=@env.STOPTB_VAN_ID@
+
cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
# Elasticsearch Configuration
diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties
index 07bd53cc..3eed5222 100644
--- a/src/main/environment/common_docker.properties
+++ b/src/main/environment/common_docker.properties
@@ -22,6 +22,11 @@ fhir-url=${FHIR_API}
# Redis Config
spring.redis.host=${REDIS_HOST}
+# Stop TB: when true, RMNCH data sync fails with an error if camp (vanID) is not configured
+stoptb.enforce.vanid=${STOPTB_ENFORCE_VANID}
+# Stop TB: this deployment's van/camp ID, replacing the old Redis camp:vanID lookup
+stoptb.van.id=${STOPTB_VAN_ID}
+
cors.allowed-origins=${CORS_ALLOWED_ORIGINS}
# Elasticsearch Configuration
diff --git a/src/main/environment/common_example.properties b/src/main/environment/common_example.properties
index b78483f2..b9d36842 100644
--- a/src/main/environment/common_example.properties
+++ b/src/main/environment/common_example.properties
@@ -17,6 +17,13 @@ fhir-url=http://localhost:8093/
# Redis Config
spring.redis.host=localhost
+
+# Stop TB: when true, RMNCH data sync fails with an error if camp (vanID) is not
+# configured instead of silently skipping vanID stamping
+stoptb.enforce.vanid=false
+# Stop TB: this deployment's van/camp ID, replacing the old Redis camp:vanID lookup
+stoptb.van.id=0
+
cors.allowed-origins=http://localhost:*
# Elasticsearch Configuration
diff --git a/src/main/java/com/iemr/common/identity/controller/IdentityController.java b/src/main/java/com/iemr/common/identity/controller/IdentityController.java
index fc894761..2482ac47 100644
--- a/src/main/java/com/iemr/common/identity/controller/IdentityController.java
+++ b/src/main/java/com/iemr/common/identity/controller/IdentityController.java
@@ -607,7 +607,12 @@ public String createIdentity(@Param(value = "{\r\n" + " \"eventTypeName\": \"St
+ " \"sexualOrientationType\": \"String\",\r\n" + " \"vanID\": \"Integer\",\r\n"
+ " \"createdDate\": \"Timestamp\"\r\n" + " \"faceEmbedding\": [\"Float\"]\r\n" + "}") @RequestBody String identityData) throws IEMRException {
logger.info("IdentityController.createIdentity - start");
-
+
+ // Bare Gson matches Common-API's RegisterBenificiaryServiceImpl, which also
+ // serializes the outgoing identity payload with a bare new Gson(). dob relies
+ // on this symmetric default format; gpsTimestamp is still parsed correctly via
+ // its field-level @JsonAdapter(GpsTimestampAdapter.class) on Address, which
+ // works regardless of which Gson instance performs the parse.
IdentityDTO identity = new Gson().fromJson(identityData, IdentityDTO.class);
logger.info("identity hit: " + identity);
BeneficiaryCreateResp map;
diff --git a/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java b/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java
index cbb91cce..deada381 100644
--- a/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java
+++ b/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java
@@ -59,12 +59,17 @@ public class RMNCHMobileAppController {
@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) {
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 4cab210c..a6604f69 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
@@ -34,6 +34,8 @@
import jakarta.persistence.Transient;
import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.JsonAdapter;
+import com.iemr.common.identity.mapper.GpsTimestampAdapter;
import lombok.Data;
@@ -390,6 +392,9 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Expose
@Transient
private String addressLine3;
+ @Expose
+ @Transient
+ private String pinCode;
// ----------------------------------------------
@@ -527,6 +532,15 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Expose
private String otherPlaceOfDeath;
+ @Expose
+ private String placeOfCurrentLiving;
+
+ @Expose
+ private String otherPlaceOfCurrentLiving;
+
+ @Expose
+ private String institutionName;
+
@Expose
private Boolean isSpouseAdded;
@@ -550,4 +564,52 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Expose
private Boolean isDeactivate;
+ @Expose
+ @Transient
+ private String abhaId;
+
+ @Expose
+ @Transient
+ private String familyId;
+
+ // Anthropometry fields sent by Stop TB mobile app via beneficiaryDetails payload.
+ // i_beneficiarydetails_rmnch has no these columns — stored in i_beneficiarydetails.otherFields instead.
+ @Expose
+ @Transient
+ private Double height;
+ @Expose
+ @Transient
+ private Double weight;
+ @Expose
+ @Transient
+ private Double bmi;
+ @Expose
+ @Transient
+ private Double temperature; // stored as "temperatureValue" in otherFields to match getBeneficiaryData key
+
+ @Expose
+ @Column(name = "gpsLatitude")
+ private Double gpsLatitude;
+
+ @Expose
+ @Column(name = "gpsLongitude")
+ private Double gpsLongitude;
+
+ @Expose
+ @Column(name = "digipin")
+ private String digipin;
+
+ @Expose
+ @Column(name = "gpsTimestamp")
+ @JsonAdapter(GpsTimestampAdapter.class)
+ private Timestamp gpsTimestamp;
+
+ @Expose
+ @Column(name = "isGpsUnavailable", nullable = false, columnDefinition = "TINYINT(1) DEFAULT 0")
+ private Boolean isGpsUnavailable = false;
+
+ @Expose
+ @Column(name = "gpsUnavailableReason")
+ private String gpsUnavailableReason;
+
}
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHHouseHoldDetails.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHHouseHoldDetails.java
index 8aa8ed47..471bdaa6 100644
--- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHHouseHoldDetails.java
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHHouseHoldDetails.java
@@ -1,24 +1,24 @@
/*
-* AMRIT – Accessible Medical Records via Integrated Technology
-* Integrated EHR (Electronic Health Records) Solution
-*
-* Copyright (C) "Piramal Swasthya Management and Research Institute"
-*
-* This file is part of AMRIT.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
+ * AMRIT – Accessible Medical Records via Integrated Technology
+ * Integrated EHR (Electronic Health Records) Solution
+ *
+ * Copyright (C) "Piramal Swasthya Management and Research Institute"
+ *
+ * This file is part of AMRIT.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see https://www.gnu.org/licenses/.
+ */
package com.iemr.common.identity.data.rmnch;
import java.sql.Timestamp;
@@ -31,11 +31,14 @@
import jakarta.persistence.Table;
import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.iemr.common.identity.mapper.GpsTimestampAdapter;
import lombok.Data;
/**
- *
+ *
* @author de40034072
*
*/
@@ -111,6 +114,23 @@ public class RMNCHHouseHoldDetails {
@Column(name = "familyName")
private String familyName;
+ @Expose
+ @SerializedName(value = "address", alternate = "Address")
+ @Column(name = "address")
+ private String address;
+
+ @Expose
+ @Column(name = "totalHhMembers")
+ private Integer totalHhMembers;
+
+ @Expose
+ @Column(name = "registeredAtCampSite")
+ private String registeredAtCampSite;
+
+ @Expose
+ @Column(name = "registeredAtCampSiteId")
+ private Integer registeredAtCampSiteId;
+
@Expose
@Column(name = "fuelUsed")
private String fuelUsed;
@@ -191,6 +211,7 @@ public class RMNCHHouseHoldDetails {
private String other_sourceofDrinkingWater;
@Expose
+ @SerializedName(value = "pincode", alternate = "Pincode")
@Column(name = "pincode")
private Integer pincode;
@@ -359,4 +380,31 @@ public class RMNCHHouseHoldDetails {
@Column(name = "mohallaName")
private String mohallaName;
+ @Expose
+ @SerializedName("latitude")
+ @Column(name = "gpsLatitude")
+ private Double gpsLatitude;
+
+ @Expose
+ @SerializedName("longitude")
+ @Column(name = "gpsLongitude")
+ private Double gpsLongitude;
+
+ @Expose
+ @Column(name = "digipin")
+ private String digipin;
+
+ @Expose
+ @Column(name = "gpsTimestamp")
+ @JsonAdapter(GpsTimestampAdapter.class)
+ private Timestamp gpsTimestamp;
+
+ @Expose
+ @Column(name = "isGpsUnavailable", nullable = false, columnDefinition = "TINYINT(1) DEFAULT 0")
+ private Boolean isGpsUnavailable = false;
+
+ @Expose
+ @Column(name = "gpsUnavailableReason")
+ private String gpsUnavailableReason;
+
}
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 397c5a66..0e86127e 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
@@ -214,4 +214,21 @@ public class RMNCHMBeneficiarydetail {
@Expose
@Transient
private Integer ProviderServiceMapID;
+
+ @Expose
+ @Transient
+ private String abhaId;
+
+ @Expose
+ @Column(name = "familyid")
+ private String familyId;
+
+ @Expose
+ private String placeOfCurrentLiving;
+
+ @Expose
+ private String otherPlaceOfCurrentLiving;
+
+ @Expose
+ private String institutionName;
}
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/identity/domain/Address.java b/src/main/java/com/iemr/common/identity/domain/Address.java
index c37b4507..f355cbc8 100644
--- a/src/main/java/com/iemr/common/identity/domain/Address.java
+++ b/src/main/java/com/iemr/common/identity/domain/Address.java
@@ -23,6 +23,11 @@
import lombok.Data;
+import java.sql.Timestamp;
+
+import com.google.gson.annotations.JsonAdapter;
+import com.iemr.common.identity.mapper.GpsTimestampAdapter;
+
public @Data class Address {
private String addrLine1;
private String addrLine2;
@@ -51,4 +56,11 @@
private Integer vanID;
private Integer parkingPlaceID;
+ private Double gpsLatitude;
+ private Double gpsLongitude;
+ private String digipin;
+ @JsonAdapter(GpsTimestampAdapter.class)
+ private Timestamp gpsTimestamp;
+ private Boolean isGpsUnavailable;
+ private String gpsUnavailableReason;
}
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryaddress.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryaddress.java
index 0e2ab415..3c98e412 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryaddress.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryaddress.java
@@ -1,24 +1,24 @@
/*
-* AMRIT – Accessible Medical Records via Integrated Technology
-* Integrated EHR (Electronic Health Records) Solution
-*
-* Copyright (C) "Piramal Swasthya Management and Research Institute"
-*
-* This file is part of AMRIT.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
+ * AMRIT – Accessible Medical Records via Integrated Technology
+ * Integrated EHR (Electronic Health Records) Solution
+ *
+ * Copyright (C) "Piramal Swasthya Management and Research Institute"
+ *
+ * This file is part of AMRIT.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see https://www.gnu.org/licenses/.
+ */
package com.iemr.common.identity.domain;
import java.io.Serializable;
@@ -39,7 +39,7 @@
/**
* The persistent class for the m_beneficiaryaddress database table.
- *
+ *
*/
@Entity
@Table(name = "i_beneficiaryaddress")
diff --git a/src/main/java/com/iemr/common/identity/mapper/GpsTimestampAdapter.java b/src/main/java/com/iemr/common/identity/mapper/GpsTimestampAdapter.java
new file mode 100644
index 00000000..1f1fe2ff
--- /dev/null
+++ b/src/main/java/com/iemr/common/identity/mapper/GpsTimestampAdapter.java
@@ -0,0 +1,116 @@
+/*
+* AMRIT – Accessible Medical Records via Integrated Technology
+* Integrated EHR (Electronic Health Records) Solution
+*
+* Copyright (C) "Piramal Swasthya Management and Research Institute"
+*
+* This file is part of AMRIT.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see https://www.gnu.org/licenses/.
+*/
+package com.iemr.common.identity.mapper;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * Parses the GPS capture timestamp (epoch millis, ISO-8601 with/without a literal
+ * 'Z', or the mobile client's "MMM dd, yyyy, h:mm:ss a" format).
+ *
+ * Attach with {@code @JsonAdapter(GpsTimestampAdapter.class)} directly on a
+ * gpsTimestamp field only. Do NOT register this globally on a GsonBuilder for
+ * Timestamp.class — that previously intercepted every Timestamp field in the
+ * request (including dob) and silently nulled it out whenever the client's
+ * format didn't match one of the patterns below.
+ */
+public class GpsTimestampAdapter extends TypeAdapter {
+
+ private static final Logger logger = LoggerFactory.getLogger(GpsTimestampAdapter.class);
+
+ private static final DateTimeFormatter ISO_WITH_Z =
+ DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ private static final DateTimeFormatter ISO_NO_TZ =
+ DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS");
+ private static final DateTimeFormatter CLIENT_DATE_FORMAT =
+ DateTimeFormatter.ofPattern("MMM dd, yyyy, h:mm:ss a", Locale.ENGLISH);
+
+ @Override
+ public void write(JsonWriter out, Timestamp value) throws IOException {
+ if (value == null) {
+ out.nullValue();
+ } else {
+ out.value(value.getTime());
+ }
+ }
+
+ @Override
+ public Timestamp read(JsonReader in) throws IOException {
+ if (in.peek() == JsonToken.NULL) {
+ in.nextNull();
+ return null;
+ }
+ if (in.peek() == JsonToken.NUMBER) {
+ return new Timestamp(in.nextLong());
+ }
+
+ String s = in.nextString();
+
+ // epoch millis as string
+ try {
+ return new Timestamp(Long.parseLong(s));
+ } catch (NumberFormatException ignored) {
+ // not epoch millis, try the date formats below
+ }
+ // ISO 8601 with Z, e.g. "2021-06-18T00:00:00.000Z"
+ try {
+ return Timestamp.from(Instant.parse(s));
+ } catch (Exception ignored) {
+ // not this format
+ }
+ // Mobile client format, e.g. "Jun 18, 2021, 5:30:00 AM"
+ try {
+ return Timestamp.valueOf(LocalDateTime.parse(s, CLIENT_DATE_FORMAT));
+ } catch (Exception ignored) {
+ // not this format
+ }
+ // ISO with literal 'Z' pattern, e.g. "2021-06-18T00:00:00.000Z" parsed as local
+ try {
+ return Timestamp.valueOf(LocalDateTime.parse(s, ISO_WITH_Z));
+ } catch (Exception ignored) {
+ // not this format
+ }
+ // ISO without timezone, e.g. "2021-06-18T00:00:00.000" (assume UTC)
+ try {
+ return Timestamp.from(LocalDateTime.parse(s, ISO_NO_TZ).toInstant(ZoneOffset.UTC));
+ } catch (Exception ignored) {
+ // not this format
+ }
+
+ logger.warn("GpsTimestampAdapter: unable to parse gpsTimestamp value '{}' with any known format; storing as null", s);
+ return null;
+ }
+}
diff --git a/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java b/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
index bc3ad686..1e2b1920 100644
--- a/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
+++ b/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
@@ -1,24 +1,24 @@
/*
-* AMRIT – Accessible Medical Records via Integrated Technology
-* Integrated EHR (Electronic Health Records) Solution
-*
-* Copyright (C) "Piramal Swasthya Management and Research Institute"
-*
-* This file is part of AMRIT.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
+ * AMRIT – Accessible Medical Records via Integrated Technology
+ * Integrated EHR (Electronic Health Records) Solution
+ *
+ * Copyright (C) "Piramal Swasthya Management and Research Institute"
+ *
+ * This file is part of AMRIT.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see https://www.gnu.org/licenses/.
+ */
package com.iemr.common.identity.mapper;
import java.sql.Timestamp;
@@ -66,7 +66,7 @@ public interface IdentityMapper {
MBeneficiarymapping identityDTOToMBeneficiarymapping(IdentityDTO dto);
-
+
@Mapping(source = "defaultNo", target = "shareAnonymousWithGovt")
@Mapping(source = "defaultNo", target = "shareAnonymousWithMedicalCommunity")
@@ -93,7 +93,7 @@ public interface IdentityMapper {
MBeneficiaryconsent identityDTOToDefaultMBeneficiaryconsent(IdentityDTO dto, Boolean defaultYes, Boolean defaultNo);
-
+
// @Mapping(source = "dto.areaId", target = "areaId")
// @Mapping(source = "dto.beneficiaryRegId", target = "beneficiaryRegID")
@@ -144,7 +144,7 @@ public interface IdentityMapper {
// @Mapping(source = "dto.vanID", target = "vanID")
// @Mapping(source = "dto.parkingPlaceId", target = "parkingPlaceID")
// MBeneficiarydetail identityDTOToMBeneficiarydetail(IdentityDTO dto);
-
+
@Mapping(source = "benFamilyDTO.isEmergencyContact", target = "isEmergencyContact")
@Mapping(source = "benFamilyDTO.relationshipToSelf", target = "relationshipToSelf")
@@ -152,7 +152,7 @@ public interface IdentityMapper {
@Mapping(source = "createdBy", target = "createdBy")
@Mapping(source = "createdDate", target = "createdDate")
MBeneficiaryfamilymapping identityDTOToMBeneficiaryfamilymapping(BenFamilyDTO benFamilyDTO, String createdBy,
- Timestamp createdDate);
+ Timestamp createdDate);
List identityDTOListToMBeneficiaryfamilymappingList(List list);
@@ -296,13 +296,13 @@ MBeneficiaryfamilymapping identityDTOToMBeneficiaryfamilymapping(BenFamilyDTO be
@Mapping(target = "beneficiaryDetails.title", source = "map.MBeneficiarydetail.title")
@Mapping(target = "beneficiaryDetails.zoneId", source = "map.MBeneficiarydetail.zoneId")
@Mapping(target = "contacts", expression = "java( map != null && map.getMBeneficiarycontact() != null && "
- + "map.getMBeneficiarydetail() != null ? "
- + "Phone.createContactList(map.getMBeneficiarycontact(), "
- + "(benRegId != null ? benRegId.toString() : null), "
- + "(map.getMBeneficiarydetail().getFirstName() != null ? map.getMBeneficiarydetail().getFirstName() : \"\") + \" \" + "
- + "(map.getMBeneficiarydetail().getMiddleName() != null ? map.getMBeneficiarydetail().getMiddleName() : \"\") + \" \" + "
- + "(map.getMBeneficiarydetail().getLastName() != null ? map.getMBeneficiarydetail().getLastName() : \"\") "
- + ") : null)")
+ + "map.getMBeneficiarydetail() != null ? "
+ + "Phone.createContactList(map.getMBeneficiarycontact(), "
+ + "(map.getBenRegId() != null ? map.getBenRegId().toString() : null), "
+ + "(map.getMBeneficiarydetail().getFirstName() != null ? map.getMBeneficiarydetail().getFirstName() : \"\") + \" \" + "
+ + "(map.getMBeneficiarydetail().getMiddleName() != null ? map.getMBeneficiarydetail().getMiddleName() : \"\") + \" \" + "
+ + "(map.getMBeneficiarydetail().getLastName() != null ? map.getMBeneficiarydetail().getLastName() : \"\") "
+ + ") : null)")
@Mapping(target = "permanentAddress.zoneID", source = "map.MBeneficiaryaddress.permZoneID")
@Mapping(target = "permanentAddress.zoneName", source = "map.MBeneficiaryaddress.permZone")
@@ -334,13 +334,13 @@ MBeneficiaryfamilymapping identityDTOToMBeneficiaryfamilymapping(BenFamilyDTO be
@Mapping(target = "accountNo", source = "map.MBeneficiaryAccount.accountNo")
@Mapping(target = "benAccountID", source = "map.benAccountID")
@Mapping(target = "ageAtMarriage", expression = "java(map != null && map.getMBeneficiarydetail() != null ? "
- + "MBeneficiarydetail.getAgeAtMarriageCalc(map.getMBeneficiarydetail().getDob(), "
- + "map.getMBeneficiarydetail().getMarriageDate(), "
- + "map.getMBeneficiarydetail().getAgeAtMarriage()) : null)")
+ + "MBeneficiarydetail.getAgeAtMarriageCalc(map.getMBeneficiarydetail().getDob(), "
+ + "map.getMBeneficiarydetail().getMarriageDate(), "
+ + "map.getMBeneficiarydetail().getAgeAtMarriage()) : null)")
@Mapping(target = "marriageDate", expression = "java(map != null && map.getMBeneficiarydetail() != null ? "
- + "MBeneficiarydetail.getMarriageDateCalc(map.getMBeneficiarydetail().getDob(), "
- + "map.getMBeneficiarydetail().getMarriageDate(), "
- + "map.getMBeneficiarydetail().getAgeAtMarriage()) : null)")
+ + "MBeneficiarydetail.getMarriageDateCalc(map.getMBeneficiarydetail().getDob(), "
+ + "map.getMBeneficiarydetail().getMarriageDate(), "
+ + "map.getMBeneficiarydetail().getAgeAtMarriage()) : null)")
@Mapping(target = "literacyStatus", source = "map.MBeneficiarydetail.literacyStatus")
@Mapping(target = "motherName", source = "map.MBeneficiarydetail.motherName")
@@ -481,7 +481,7 @@ List mapToMBeneficiaryfamilymappingWithBenFamilyDTOList(
@Mapping(source = "dto.createdDate", target = "createdDate")
@Mapping(source = "dto.vanID", target = "vanID")
@Mapping(source = "dto.parkingPlaceId", target = "parkingPlaceID")
- // End
+ // End
MBeneficiaryAccount identityDTOToMBeneficiaryAccount(IdentityDTO dto);
@InheritInverseConfiguration
@@ -490,7 +490,7 @@ List mapToMBeneficiaryfamilymappingWithBenFamilyDTOList(
@Mapping(source = "dto.benImage", target = "benImage")
@Mapping(source = "dto.agentName", target = "createdBy")
@Mapping(source = "dto.createdDate", target = "createdDate")
-
+
@Mapping(source = "dto.vanID", target = "vanID")
@Mapping(source = "dto.parkingPlaceId", target = "parkingPlaceID")
diff --git a/src/main/java/com/iemr/common/identity/mapper/InputMapper.java b/src/main/java/com/iemr/common/identity/mapper/InputMapper.java
index 9a46ba4f..3549efc2 100644
--- a/src/main/java/com/iemr/common/identity/mapper/InputMapper.java
+++ b/src/main/java/com/iemr/common/identity/mapper/InputMapper.java
@@ -44,6 +44,10 @@ public class InputMapper
private InputMapper()
{
+ // Timestamp fields (including dob) use Gson's default parsing here, same as
+ // on vb/stoptb. The gpsTimestamp field on Address/RMNCH entities is parsed by
+ // GpsTimestampAdapter via a field-level @JsonAdapter annotation instead of a
+ // global registration, so it can't affect any other Timestamp field.
builder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
// .excludeFieldsWithoutExposeAnnotation()
.serializeNulls().setLongSerializationPolicy(LongSerializationPolicy.STRING);
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java b/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
index 4e8bcc01..07fc0638 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
@@ -148,6 +148,11 @@ int untagFamily(@Param("modifiedBy") String modifiedBy, @Param("vanSerialNo") Bi
@Query("SELECT b FROM MBeneficiarydetail b WHERE b.familyId =:familyid ")
List searchByFamilyId(@Param("familyid") String familyid);
+ @Transactional
+ @Modifying
+ @Query("UPDATE MBeneficiarydetail d SET d.otherFields = :otherFields WHERE d.mBeneficiarymapping.benRegId = :benRegId")
+ int updateOtherFieldsByBenRegId(@Param("benRegId") BigInteger benRegId, @Param("otherFields") String otherFields);
+
/**
* Find complete beneficiary data by IDs from Elasticsearch
*/
@@ -155,7 +160,7 @@ int untagFamily(@Param("modifiedBy") String modifiedBy, @Param("vanSerialNo") Bi
"m.BenRegId, " + // 0
"brm.beneficiaryID, " + // 1
"d.FirstName, " + // 2
- "d.MiddleName, " + // 3
+ "d.MiddleName, " + // 3
"d.LastName, " + // 4
"d.GenderID, " + // 5
"g.GenderName, " + // 6
@@ -163,7 +168,7 @@ int untagFamily(@Param("modifiedBy") String modifiedBy, @Param("vanSerialNo") Bi
"TIMESTAMPDIFF(YEAR, d.DOB, CURDATE()) as Age, " + // 8
"d.FatherName, " + // 9
"d.SpouseName, " + // 10
- "d.MaritalStatusID, " + // 11
+ "d.MaritalStatusID, " + // 11
"ms.Status as MaritalStatusName, " + // 12
"d.IsHIVPositive, " + // 13
"m.CreatedBy, " + // 14
@@ -181,19 +186,19 @@ int untagFamily(@Param("modifiedBy") String modifiedBy, @Param("vanSerialNo") Bi
"addr.CurrServicePoint, " + // 26
"addr.ParkingPlaceID, " + // 27
"contact.PreferredPhoneNum, " + // 28
- "addr.CurrVillageId, " + // 29
- "addr.CurrVillage " + // 30
+ "addr.CurrVillageId, " + // 29
+ "addr.CurrVillage " + // 30
"FROM i_beneficiarymapping m " +
"LEFT JOIN i_beneficiarydetails d ON m.BenDetailsId = d.BeneficiaryDetailsID " +
"LEFT JOIN m_beneficiaryregidmapping brm ON brm.BenRegId = m.BenRegId " +
"LEFT JOIN db_iemr.m_gender g ON d.GenderID = g.GenderID " +
- "LEFT JOIN db_iemr.m_maritalstatus ms ON d.MaritalStatusID = ms.StatusID " +
+ "LEFT JOIN db_iemr.m_maritalstatus ms ON d.MaritalStatusID = ms.StatusID " +
"LEFT JOIN i_beneficiaryaddress addr ON m.BenAddressId = addr.BenAddressID " +
"LEFT JOIN i_beneficiarycontacts contact ON m.BenContactsId = contact.BenContactsID " +
- "WHERE m.BenRegId IN (:ids) AND m.Deleted = false",
+ "WHERE m.BenRegId IN (:ids) AND m.Deleted = false",
nativeQuery = true)
List