Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
3c2135e
Bulk registration
SauravBizbRolly Mar 4, 2025
23cccac
Bulk registration
SauravBizbRolly Mar 11, 2025
83f693e
Bulk registration
SauravBizbRolly Mar 13, 2025
8ae4c09
Merge pull request #69 from toarunmishra/bulk_registration
sushant-bizbrolly Mar 13, 2025
cdd7b2a
add userName and password in Bulk registration
SauravBizbRolly Mar 31, 2025
128c8f9
add userName and password in Bulk registration
SauravBizbRolly Jun 19, 2025
a069382
Merge pull request #88 from toarunmishra/bulk_registration
SauravBizbRolly Jun 19, 2025
3fd079a
Merge remote-tracking branch 'upstream/develop' into enhancement
SauravBizbRolly Jun 19, 2025
fcbc3da
Merge pull request #90 from toarunmishra/3.3.0
drtechie Jun 19, 2025
5cd719d
remove unwanted line
SauravBizbRolly Jun 19, 2025
2a55c54
Merge pull request #91 from toarunmishra/3.3.0
SauravBizbRolly Jun 19, 2025
110fa59
fix code
SauravBizbRolly Jun 21, 2025
83d3387
Merge pull request #92 from toarunmishra/3.3.0
SauravBizbRolly Jun 21, 2025
b1a893f
fix code
SauravBizbRolly Aug 21, 2025
b67332f
fix code
SauravBizbRolly Aug 21, 2025
bdde896
fix code
SauravBizbRolly Aug 21, 2025
5315e05
fix code
SauravBizbRolly Aug 21, 2025
486d412
fix code
SauravBizbRolly Aug 21, 2025
4e5dab6
fix code
SauravBizbRolly Aug 21, 2025
cd7f567
fix code
SauravBizbRolly Aug 21, 2025
f06d077
fix code
SauravBizbRolly Aug 28, 2025
84b679a
fix code
SauravBizbRolly Aug 28, 2025
7b123e9
fix code
SauravBizbRolly Aug 28, 2025
a28294f
fix code
SauravBizbRolly Aug 28, 2025
093ba26
fix code
SauravBizbRolly Aug 28, 2025
8820fe2
Httpheader content disposition changed
ravishanigarapu Sep 2, 2025
2aab70e
Coderabbitai comments adrressed
ravishanigarapu Sep 2, 2025
20eaaed
Httpheader content disposition changed (#100)
ravishanigarapu Sep 2, 2025
e04b9e5
Compile error resolved
ravishanigarapu Sep 2, 2025
bd11453
Merge pull request #101 from PSMRI/feature/signaturerelease
SauravBizbRolly Sep 2, 2025
0addca8
fix code
SauravBizbRolly Sep 2, 2025
b313e03
Merge remote-tracking branch 'upstream/release-3.6.0' into release-3.6.0
SauravBizbRolly Sep 2, 2025
adc946d
Main branch changes missed (#102)
ravishanigarapu Sep 2, 2025
4e3a304
Feature/signaturerelease (#103)
ravishanigarapu Sep 2, 2025
875e40a
Feature/signaturerelease (#104)
ravishanigarapu Sep 10, 2025
41162a4
Update pom.xml
5Amogh Sep 25, 2025
27241e1
Cherry-pick the commits related to 3.5.0 form 3.6.0 (#106)
snehar-nd Sep 26, 2025
8fb55ce
fix:casesheet signature
vishwab1 Oct 29, 2025
45250ea
fix:pom file change
vishwab1 Oct 30, 2025
c824879
API changes in Signature enhancement for Casesheet (#107)
vishwab1 Oct 30, 2025
7231794
fix: pom version
vishwab1 Oct 30, 2025
e763f9f
Merge pull request #108 from PSMRI/vb/sign
snehar-nd Oct 30, 2025
3d22060
fix code
SauravBizbRolly Nov 7, 2025
226c101
Merge remote-tracking branch 'upstream/release-3.6.0' into release-3.6.0
SauravBizbRolly Nov 7, 2025
74cd354
fix code
SauravBizbRolly Nov 10, 2025
f719ba5
fix code
SauravBizbRolly Nov 10, 2025
bb00223
fix code
SauravBizbRolly Nov 10, 2025
d52c950
fix code
SauravBizbRolly Nov 10, 2025
86ed8cb
fix code
SauravBizbRolly Nov 10, 2025
3ae6436
fix code
SauravBizbRolly Nov 10, 2025
67a4240
fix code
SauravBizbRolly Nov 10, 2025
f8e646e
fix code
SauravBizbRolly Nov 10, 2025
8c48069
fix code
SauravBizbRolly Nov 11, 2025
5f8dcf2
fix code
SauravBizbRolly Nov 11, 2025
30d3317
fix code
SauravBizbRolly Nov 11, 2025
6f5a101
fix code
SauravBizbRolly Nov 11, 2025
1d45257
Merge branch 'release-3.6.1' into release-3.6.0
5Amogh Nov 17, 2025
0acb505
Merge pull request #109 from PSMRI/release-3.6.0
5Amogh Nov 17, 2025
608773a
fix: amm-1927 send headers only if the request is from the allowed or…
5Amogh Nov 17, 2025
5a7c6bf
fix: amm-1927 coderabbit fixes
5Amogh Nov 17, 2025
ad6ff5e
Update regex handling for localhost URLs
5Amogh Nov 18, 2025
eb98a5a
Enhance regex pattern for URL matching
5Amogh Nov 18, 2025
bffa971
Merge pull request #110 from PSMRI/amm-1927
5Amogh Nov 20, 2025
c6ded08
Merge branch 'release-3.6.0' into release-3.5.0
5Amogh Dec 3, 2025
2a04bfb
Merge pull request #111 from PSMRI/release-3.5.0
5Amogh Dec 3, 2025
75d06ca
Merge pull request #112 from PSMRI/release-3.6.1
5Amogh Dec 3, 2025
b421d8b
fix code
SauravBizbRolly Dec 3, 2025
9c206a4
Merge remote-tracking branch 'upstream/release-3.6.0' into release-3.6.0
SauravBizbRolly Dec 3, 2025
76db67c
fix code
SauravBizbRolly Dec 3, 2025
d5b3e20
Merge branch 'main' into release-3.6.0
SauravBizbRolly Jan 14, 2026
711128e
fix vulnerabilitie code
SauravBizbRolly Jan 14, 2026
091bd75
Merge pull request #115 from PSMRI/fix/vulnerabilitie
SauravBizbRolly Jan 14, 2026
f76f68c
fix security hotspots
SauravBizbRolly Jan 14, 2026
a52081b
Merge pull request #116 from PSMRI/fix/remove_log
SauravBizbRolly Jan 14, 2026
ea22db4
fixed conflicts
vishwab1 Feb 27, 2026
68e4130
Add facility hierarchy creation with village and parent-child mapping…
vishwab1 Mar 2, 2026
c701ce9
fix: facility hierarchy and facility type management (#125)
vishwab1 Mar 18, 2026
7f10a54
Facility hierarchy inventory mapping and store field management (#128)
vishwab1 Mar 26, 2026
1c6a062
merge 3.6.2 to release 3.8.1 (#132)
vishwab1 May 21, 2026
0599abd
fix: avoid ONLY_FULL_GROUP_BY violation in service lookup queries
vishwab1 Jun 16, 2026
300d7ae
fix: bulk employee registration sets username from contact number ins…
vishwab1 Jun 18, 2026
32e65ca
Merge remote-tracking branch 'origin/release-3.8.2' into vb/fixservice
vishwab1 Jun 29, 2026
25c0f17
Add Nikshay location master for Stop TB (TU/Facility) and complete du…
vishwab1 Jul 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,8 @@ public String UserRoleMappings(@RequestBody String userRoleMapping, HttpServletR
resDataMap1.setVillageID(previl.getVillageID());
resDataMap1.setVillageName(previl.getVillageName());
resDataMap1.setFacilityID(previl.getFacilityID());
resDataMap1.setNikshayTUID(previl.getNikshayTUID());
resDataMap1.setNikshayFacilityID(previl.getNikshayFacilityID());
resList1.add(resDataMap1);

}
Expand Down Expand Up @@ -1861,6 +1863,13 @@ public String updateUserRoleMapping(@RequestBody String updateUserRoleMapping, H
}
}

// Soft-delete other active mappings for same user+service to prevent duplicates
// (e.g. old roleID 122 rows left over when new roleID 128 mapping was created)
if (pre.getUserID() != null && pre.getProviderServiceMapID() != null && pre.getuSRMappingID() != null) {
employeeMasterInter.softDeleteOldMappings(
pre.getUserID(), pre.getProviderServiceMapID(), pre.getuSRMappingID());
}

usrRole.setUserID(pre.getUserID());
usrRole.setRoleID(pre.getRoleID());
usrRole.setAgentPassword(pre.getAgentPassword());
Expand All @@ -1874,6 +1883,8 @@ public String updateUserRoleMapping(@RequestBody String updateUserRoleMapping, H
usrRole.setVillageID(pre.getVillageID());
usrRole.setVillageName(pre.getVillageName());
usrRole.setFacilityID(pre.getFacilityID());
usrRole.setNikshayTUID(pre.getNikshayTUID());
usrRole.setNikshayFacilityID(pre.getNikshayFacilityID());

if (pre.getTeleConsultation() != null) {
usrRole.setTeleConsultation(pre.getTeleConsultation());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* 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.admin.controller.nikshay;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.iemr.admin.data.locationmaster.DistrictBranchMapping;
import com.iemr.admin.data.locationmaster.M_District;
import com.iemr.admin.data.nikshay.NikshayFacility;
import com.iemr.admin.data.nikshay.NikshayTU;
import com.iemr.admin.data.nikshay.NikshayVillageFacilityMapping;
import com.iemr.admin.data.rolemaster.StateMasterForRole;
import com.iemr.admin.repo.locationmaster.DistrictBranchMappingRepo;
import com.iemr.admin.repo.locationmaster.MdistrictRepo;
import com.iemr.admin.repo.nikshay.NikshayFacilityRepo;
import com.iemr.admin.repo.nikshay.NikshayTURepo;
import com.iemr.admin.repo.nikshay.NikshayVillageFacilityMappingRepo;
import com.iemr.admin.repository.rolemaster.StateMasterRepo;
import com.iemr.admin.utils.response.OutputResponse;

import io.swagger.v3.oas.annotations.Operation;

/**
* Read-only cascading lookups for Stop TB's Nikshay location hierarchy:
* State (reused, existing) -> District (reused, existing) ->
* TU -> Facility -> Village (all new, or reused via the village mapping).
*
* Every endpoint here only reads existing/new tables β€” nothing is inserted
* or altered from these calls.
*/
@RestController
public class NikshayLocationController {

private final Logger logger = LoggerFactory.getLogger(NikshayLocationController.class);

@Autowired

Check warning on line 65 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwT&open=AZ9LIO5L8q4ryBIgcEwT&pullRequest=136
private StateMasterRepo stateMasterRepo;

@Autowired

Check warning on line 68 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwU&open=AZ9LIO5L8q4ryBIgcEwU&pullRequest=136
private MdistrictRepo mdistrictRepo;

@Autowired

Check warning on line 71 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwV&open=AZ9LIO5L8q4ryBIgcEwV&pullRequest=136
private NikshayTURepo nikshayTURepo;

@Autowired

Check warning on line 74 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwW&open=AZ9LIO5L8q4ryBIgcEwW&pullRequest=136
private NikshayFacilityRepo nikshayFacilityRepo;

@Autowired

Check warning on line 77 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwX&open=AZ9LIO5L8q4ryBIgcEwX&pullRequest=136
private NikshayVillageFacilityMappingRepo nikshayVillageFacilityMappingRepo;

@Autowired

Check warning on line 80 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwY&open=AZ9LIO5L8q4ryBIgcEwY&pullRequest=136
private DistrictBranchMappingRepo districtBranchMappingRepo;

@Operation(summary = "Get all states (reused from AMRIT's existing state master)")
@GetMapping(value = "/nikshay/location/states", produces = "application/json")
public String getStates() {
OutputResponse response = new OutputResponse();
try {
ArrayList<StateMasterForRole> states = stateMasterRepo.getAllState();
response.setResponse(states.toString());
} catch (Exception e) {
logger.error("Error fetching Nikshay states: " + e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

@Operation(summary = "Get districts for a state (reused from AMRIT's existing district master)")
@GetMapping(value = "/nikshay/location/districts", produces = "application/json")
public String getDistricts(@RequestParam("stateID") Integer stateID) {
OutputResponse response = new OutputResponse();
try {
ArrayList<M_District> districts = mdistrictRepo.getAllDistrictByStateId(stateID);
response.setResponse(districts.toString());
} catch (Exception e) {
logger.error("Error fetching districts for stateID " + stateID + ": " + e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

@Operation(summary = "Get Nikshay TUs for a district")
@GetMapping(value = "/nikshay/location/tus", produces = "application/json")
public String getTUs(@RequestParam("districtID") Integer districtID) {
OutputResponse response = new OutputResponse();
try {
List<NikshayTU> tus = nikshayTURepo.findByDistrictID(districtID);
response.setResponse(tus.toString());
} catch (Exception e) {
logger.error("Error fetching Nikshay TUs for districtID " + districtID + ": " + e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

@Operation(summary = "Get Nikshay facilities for one or more TUs (comma-separated tuIDs)")
@GetMapping(value = "/nikshay/location/facilities", produces = "application/json")
public String getFacilities(@RequestParam("tuIDs") String tuIDs) {
OutputResponse response = new OutputResponse();
try {
List<Integer> ids = parseIntCsv(tuIDs);
List<NikshayFacility> facilities = nikshayFacilityRepo.findByTUIDs(ids);
response.setResponse(facilities.toString());
} catch (Exception e) {
logger.error("Error fetching Nikshay facilities for tuIDs " + tuIDs + ": " + e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

@Operation(summary = "Get villages for one or more Nikshay facilities (comma-separated facilityIDs), "
+ "resolved to AMRIT's existing village master")
@GetMapping(value = "/nikshay/location/villages", produces = "application/json")
public String getVillages(@RequestParam("facilityIDs") String facilityIDs) {
OutputResponse response = new OutputResponse();
try {
List<Integer> ids = parseIntCsv(facilityIDs);
List<NikshayVillageFacilityMapping> mappings = nikshayVillageFacilityMappingRepo.findByFacilityIDs(ids);

List<Integer> amritVillageIDs = mappings.stream()
.map(NikshayVillageFacilityMapping::getAmritVillageID)
.distinct()
.collect(Collectors.toList());

List<DistrictBranchMapping> villages = new ArrayList<>();
districtBranchMappingRepo.findAllById(amritVillageIDs).forEach(villages::add);

response.setResponse(villages.toString());
} catch (Exception e) {
logger.error("Error fetching villages for facilityIDs " + facilityIDs + ": " + e.getMessage(), e);
response.setError(e);
}
return response.toString();
}

private List<Integer> parseIntCsv(String csv) {
return Arrays.stream(csv.split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Integer::parseInt)
.collect(Collectors.toList());

Check warning on line 170 in src/main/java/com/iemr/admin/controller/nikshay/NikshayLocationController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this usage of 'Stream.collect(Collectors.toList())' with 'Stream.toList()' and ensure that the list is unmodified.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIO5L8q4ryBIgcEwZ&open=AZ9LIO5L8q4ryBIgcEwZ&pullRequest=136
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,15 @@ public class M_UserServiceRoleMapping2 {
@Column(name = "isOutbound")
private Boolean outbound;

// Stop TB / Nikshay location scope β€” populated only when serviceName = "Stop TB"
@Expose
@Column(name = "NikshayTUID")
private Integer nikshayTUID;

@Expose
@Column(name = "NikshayFacilityID")
private Integer nikshayFacilityID;

public M_UserServiceRoleMapping2() {
}

Expand Down
98 changes: 98 additions & 0 deletions src/main/java/com/iemr/admin/data/nikshay/NikshayFacility.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* 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.admin.data.nikshay;

import java.sql.Timestamp;

import com.google.gson.annotations.Expose;
import com.iemr.admin.utils.mapper.OutputMapper;

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 jakarta.persistence.Transient;
import lombok.Data;

/**
* Nikshay's PHC/HWC/CHC facility master. Verified against production data
* that AMRIT's existing m_facility has no meaningful overlap with Nikshay's
* facility list (0 matches out of 343,615) β€” kept as its own table rather
* than reusing m_facility.
*/
@Data
@Entity
@Table(name = "m_nikshay_facility")
public class NikshayFacility {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Expose
@Column(name = "NikshayFacilityID")
private Integer nikshayFacilityID;

@Expose
@Column(name = "NikshayCode")
private String nikshayCode;

@Expose
@Column(name = "FacilityName")
private String facilityName;

@Expose
@Column(name = "FacilityCode")
private String facilityCode;

@Expose
@Column(name = "NikshayTUID")
private Integer nikshayTUID;

@Expose
@Column(name = "Deleted")
private Boolean deleted = false;

@Expose
@Column(name = "CreatedBy")
private String createdBy;

@Expose
@Column(name = "CreatedDate", insertable = false, updatable = false)
private Timestamp createdDate;

@Expose
@Column(name = "ModifiedBy")
private String modifiedBy;

@Expose
@Column(name = "LastModDate", insertable = false, updatable = false)
private Timestamp lastModDate;

@Transient
private OutputMapper outputMapper = new OutputMapper();

@Override
public String toString() {
return outputMapper.gson().toJson(this);

Check warning on line 96 in src/main/java/com/iemr/admin/data/nikshay/NikshayFacility.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this instance-reference to a static reference.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ9LIOyQ8q4ryBIgcEwP&open=AZ9LIOyQ8q4ryBIgcEwP&pullRequest=136
}
}
Loading
Loading