diff --git a/pom.xml b/pom.xml
index 04fad9b0..667d7cc6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0com.iemr.common.identityidentity-api
- 3.8.3
+ 3.12.0war
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 2482ac47..6468ed3e 100644
--- a/src/main/java/com/iemr/common/identity/controller/IdentityController.java
+++ b/src/main/java/com/iemr/common/identity/controller/IdentityController.java
@@ -990,6 +990,8 @@ public String saveGeneratedBenIDToLocalServer(
logger.info("Number of unique benid imported to local server: " + i);
if (i > 0)
response.setResponse(i + " Unique benid imported to local server");
+ else if (!benIdImportDTOList.isEmpty())
+ response.setResponse("All benid already present in local server");
else {
response.setResponse("Empty or invalid data");
logger.error("Empty or invalid data. Data Size is : " + benIdImportDTOList.size());
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/BenAnthropometryDetail.java b/src/main/java/com/iemr/common/identity/data/rmnch/BenAnthropometryDetail.java
new file mode 100644
index 00000000..27a6df6e
--- /dev/null
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/BenAnthropometryDetail.java
@@ -0,0 +1,101 @@
+/*
+* 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;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+
+import lombok.Data;
+
+/**
+ * Mirrors FLW-API's BenAnthropometryDetail (same db_iemr.t_phy_anthropometry table), so syncDataToAmrit can write
+ * registration-time values that FLW-API getBeneficiaryData reads back.
+ */
+@Entity
+@Table(name = "t_phy_anthropometry", catalog = "db_iemr")
+@Data
+public class BenAnthropometryDetail {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "BeneficiaryRegID")
+ private Long beneficiaryRegID;
+
+ @Column(name = "BenVisitID")
+ private Long benVisitID;
+
+ @Column(name = "ProviderServiceMapID")
+ private Integer providerServiceMapID;
+
+ @Column(name = "VisitCode")
+ private Long visitCode;
+
+ @Column(name = "Weight_Kg")
+ private Double weightKg;
+
+ @Column(name = "Height_cm")
+ private Double heightCm;
+
+ @Column(name = "BMI")
+ private Double bmi;
+
+ @Column(name = "Deleted", insertable = false, updatable = true)
+ private Boolean deleted;
+
+ @Column(name = "Processed", insertable = false, updatable = true)
+ private String processed;
+
+ @Column(name = "CreatedBy")
+ private String createdBy;
+
+ @Column(name = "CreatedDate", insertable = false, updatable = false)
+ private Timestamp createdDate;
+
+ @Column(name = "ModifiedBy")
+ private String modifiedBy;
+
+ @Column(name = "LastModDate", insertable = false, updatable = false)
+ private Timestamp lastModDate;
+
+ @Column(name = "VanSerialNo")
+ private Long vanSerialNo;
+
+ @Column(name = "VanID")
+ private Integer vanID;
+
+ @Column(name = "ParkingPlaceID")
+ private Integer parkingPlaceID;
+
+ @Column(name = "SyncedBy")
+ private String syncedBy;
+
+ @Column(name = "SyncedDate")
+ private Timestamp syncedDate;
+}
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/BenPhysicalVitalDetail.java b/src/main/java/com/iemr/common/identity/data/rmnch/BenPhysicalVitalDetail.java
new file mode 100644
index 00000000..9e98f289
--- /dev/null
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/BenPhysicalVitalDetail.java
@@ -0,0 +1,107 @@
+/*
+* 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;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+
+import lombok.Data;
+
+/**
+ * Mirrors FLW-API's BenPhysicalVitalDetail (same db_iemr.t_phy_vitals table), so syncDataToAmrit can write
+ * registration-time values that FLW-API getBeneficiaryData reads back.
+ */
+@Entity
+@Table(name = "t_phy_vitals", catalog = "db_iemr")
+@Data
+public class BenPhysicalVitalDetail {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "BeneficiaryRegID")
+ private Long beneficiaryRegID;
+
+ @Column(name = "BenVisitID")
+ private Long benVisitID;
+
+ @Column(name = "ProviderServiceMapID")
+ private Integer providerServiceMapID;
+
+ @Column(name = "VisitCode")
+ private Long visitCode;
+
+ @Column(name = "Temperature")
+ private Double temperature;
+
+ @Column(name = "PulseRate")
+ private Short pulseRate;
+
+ @Column(name = "SystolicBP_1stReading")
+ private Short systolicBP;
+
+ @Column(name = "DiastolicBP_1stReading")
+ private Short diastolicBP;
+
+ @Column(name = "BloodGlucose_Random")
+ private Short bloodGlucoseRandom;
+
+ @Column(name = "Deleted", insertable = false, updatable = true)
+ private Boolean deleted;
+
+ @Column(name = "Processed", insertable = false, updatable = true)
+ private String processed;
+
+ @Column(name = "CreatedBy")
+ private String createdBy;
+
+ @Column(name = "CreatedDate", insertable = false, updatable = false)
+ private Timestamp createdDate;
+
+ @Column(name = "ModifiedBy")
+ private String modifiedBy;
+
+ @Column(name = "LastModDate", insertable = false, updatable = false)
+ private Timestamp lastModDate;
+
+ @Column(name = "VanSerialNo")
+ private Long vanSerialNo;
+
+ @Column(name = "VanID")
+ private Integer vanID;
+
+ @Column(name = "ParkingPlaceID")
+ private Integer parkingPlaceID;
+
+ @Column(name = "SyncedBy")
+ private String syncedBy;
+
+ @Column(name = "SyncedDate")
+ private Timestamp syncedDate;
+}
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 06022622..2d80fc8f 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
@@ -611,12 +611,14 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Transient
private Double temperature; // stored as "temperatureValue" in otherFields to match getBeneficiaryData key
-
@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")
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 1e794702..f5233bbf 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
@@ -422,4 +422,31 @@ public class RMNCHHouseHoldDetails {
@Column(name = "gpsUnavailableReason")
private String gpsUnavailableReason;
+ @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/domain/Address.java b/src/main/java/com/iemr/common/identity/domain/Address.java
index 7f7e716b..f355cbc8 100644
--- a/src/main/java/com/iemr/common/identity/domain/Address.java
+++ b/src/main/java/com/iemr/common/identity/domain/Address.java
@@ -56,9 +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/repo/BenRegIdMappingRepo.java b/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
index 866b2137..ea629982 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
@@ -60,6 +60,12 @@ MBeneficiaryregidmapping findFirstByProviderServiceMapIDAndVehicalNoOrderByBenRe
Long countByProvisioned(Boolean isProvisioned);
+ /**
+ * Count of BenRegIds that can be given to a new registration: not provisioned
+ * and not claimed by a registration in progress.
+ */
+ Long countByProvisionedAndReserved(Boolean isProvisioned, Boolean isReserved);
+
@Transactional
@Modifying
@Query("update MBeneficiaryregidmapping set providerServiceMapID = null , vehicalNo = null "
diff --git a/src/main/java/com/iemr/common/identity/repo/rmnch/BenAnthropometryRepo.java b/src/main/java/com/iemr/common/identity/repo/rmnch/BenAnthropometryRepo.java
new file mode 100644
index 00000000..95476f67
--- /dev/null
+++ b/src/main/java/com/iemr/common/identity/repo/rmnch/BenAnthropometryRepo.java
@@ -0,0 +1,41 @@
+/*
+* 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.repo.rmnch;
+
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.iemr.common.identity.data.rmnch.BenAnthropometryDetail;
+
+@Repository
+public interface BenAnthropometryRepo extends CrudRepository {
+ public BenAnthropometryDetail findFirstByBeneficiaryRegIDOrderByCreatedDateDescIdDesc(Long beneficiaryRegID);
+
+ @Transactional
+ @Modifying
+ @Query("UPDATE BenAnthropometryDetail t SET t.vanSerialNo = t.id WHERE t.id = :id")
+ void updateVanSerialNo(@Param("id") Long id);
+}
diff --git a/src/main/java/com/iemr/common/identity/repo/rmnch/BenPhysicalVitalRepo.java b/src/main/java/com/iemr/common/identity/repo/rmnch/BenPhysicalVitalRepo.java
new file mode 100644
index 00000000..61ddc045
--- /dev/null
+++ b/src/main/java/com/iemr/common/identity/repo/rmnch/BenPhysicalVitalRepo.java
@@ -0,0 +1,41 @@
+/*
+* 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.repo.rmnch;
+
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.iemr.common.identity.data.rmnch.BenPhysicalVitalDetail;
+
+@Repository
+public interface BenPhysicalVitalRepo extends CrudRepository {
+ public BenPhysicalVitalDetail findFirstByBeneficiaryRegIDAndTemperatureIsNotNullOrderByCreatedDateDescIdDesc(Long beneficiaryRegID);
+
+ @Transactional
+ @Modifying
+ @Query("UPDATE BenPhysicalVitalDetail t SET t.vanSerialNo = t.id WHERE t.id = :id")
+ void updateVanSerialNo(@Param("id") Long id);
+}
diff --git a/src/main/java/com/iemr/common/identity/service/IdentityService.java b/src/main/java/com/iemr/common/identity/service/IdentityService.java
index 0d965dd5..f1872cb1 100644
--- a/src/main/java/com/iemr/common/identity/service/IdentityService.java
+++ b/src/main/java/com/iemr/common/identity/service/IdentityService.java
@@ -2170,7 +2170,9 @@ public int importBenIdToLocalServer(List benIdImportDTOList) {
jdbcTemplate = getJdbcTemplate();
List