Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
341a34f
Enforced mandatory validation for "Reason for Refusal in section e in…
sehjotsinghunthinkable Jun 22, 2026
2908c20
Added counselled flag to confirmed cases response, indicating whether…
sehjotsinghunthinkable Jun 23, 2026
9396905
Align `/complete` and `/submitBulk` form response editing behavior
sehjotsinghunthinkable Jun 23, 2026
9e28141
Merge branch 'vb/counselling' into vb/counselling
sehjotsinghunthinkable Jun 23, 2026
105ede6
Add van/sync tracking fields (vanID, parkingPlaceID, vanSerialNo, pro…
sehjotsinghunthinkable Jun 24, 2026
21b7187
feat(dynamic-form): add Hindi localization fields and completed benef…
sehjotsinghunthinkable Jun 25, 2026
fdb1a1f
feat(dynamic-form): add Hindi localization fields and completed benef…
sehjotsinghunthinkable Jun 25, 2026
6d8cb0b
Merge branch 'vb/counselling' into vb/counselling
vishwab1 Jun 25, 2026
5f05f66
feat(beneficiary): expose GPS coordinates in getBeneficiaryData response
sehjotsinghunthinkable Jun 26, 2026
6ae9ed0
Committed 82b00ccf with only the three files:
sehjotsinghunthinkable Jun 26, 2026
0332e9b
Revert "Committed 82b00ccf with only the three files:"
sehjotsinghunthinkable Jun 26, 2026
4123985
Committed 82b00ccf with only the three files:
sehjotsinghunthinkable Jun 26, 2026
b7488fe
Committed 82b00ccf with only the three files:
sehjotsinghunthinkable Jun 26, 2026
78d402c
Merge branch 'vb/counselling' into vb/counselling
sehjotsinghunthinkable Jun 26, 2026
b92cdea
Updated isMandatory field in Section C, so changed in TbCounsellingFo…
sehjotsinghunthinkable Jun 30, 2026
81e29d2
Add optional villageId and providerServiceMapId filters to getComplet…
sehjotsinghunthinkable Jul 2, 2026
be0d0d6
Removing section f from seeder
sehjotsinghunthinkable Jul 2, 2026
f6aca3a
Removing already existing check in /complete api
sehjotsinghunthinkable Jul 2, 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 @@ -98,10 +98,13 @@ public ResponseEntity<ApiResponse> getById(@RequestParam Long responseId) {
FormResponseDTO dto = responseService.getResponseById(responseId);
return ResponseEntity.ok(new ApiResponse(true, "Response fetched successfully", dto));
}
@Operation(summary = "Get beneficiary IDs that have a COMPLETE form response for the given form type")
@Operation(summary = "Get beneficiary IDs that have a COMPLETE form response for the given form type, optionally filtered by village and/or provider service map")
@RequestMapping(value = "/getCompletedBeneficiaries", method = RequestMethod.GET)
public ResponseEntity<ApiResponse> getCompletedBeneficiaries(@RequestParam FormType formType) {
List<Long> beneficiaryIds = responseService.getCompletedBeneficiaries(formType);
public ResponseEntity<ApiResponse> getCompletedBeneficiaries(
@RequestParam FormType formType,
@RequestParam(required = false) Integer villageId,
@RequestParam(required = false) Integer providerServiceMapId) {
List<Long> beneficiaryIds = responseService.getCompletedBeneficiaries(formType, villageId, providerServiceMapId);
return ResponseEntity.ok(new ApiResponse(true, "Completed beneficiaries fetched successfully", beneficiaryIds));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ public class RMNCHBeneficiaryDetailsRmnch {
@Column(name = "isGpsUnavailable", nullable = false, columnDefinition = "TINYINT(1) DEFAULT 0")
private Boolean isGpsUnavailable = false;

@Expose
@Column(name = "gpsUnavailableReason")
private String gpsUnavailableReason;

@Expose
@Column(name = "menstrualBFDId")
private Integer menstrualBFDId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,7 @@ public class RMNCHMBeneficiaryaddress implements Serializable {

@Column(name = "isGpsUnavailable", nullable = false, columnDefinition = "TINYINT(1) DEFAULT 0")
private Boolean isGpsUnavailable = false;

@Column(name = "gpsUnavailableReason")
private String gpsUnavailableReason;
}
9 changes: 9 additions & 0 deletions src/main/java/com/iemr/flw/repo/iemr/FormResponseRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public interface FormResponseRepo extends JpaRepository<FormResponse, Long> {
@Query("SELECT r.beneficiaryId FROM FormResponse r WHERE r.formId = :formId AND r.status = :status")
List<Long> findBeneficiaryIdsByFormIdAndStatus(@Param("formId") Long formId, @Param("status") String status);

@Query("SELECT r.beneficiaryId FROM FormResponse r WHERE r.formId = :formId AND r.status = :status " +
"AND r.beneficiaryId IN (SELECT b.beneficiaryID FROM BenFlowStatus b WHERE b.deleted = false " +
"AND (:villageId IS NULL OR b.villageID = :villageId) " +
"AND (:providerServiceMapId IS NULL OR b.providerServiceMapId = :providerServiceMapId))")
List<Long> findBeneficiaryIdsByFormIdAndStatusFiltered(@Param("formId") Long formId,
@Param("status") String status,
@Param("villageId") Integer villageId,
@Param("providerServiceMapId") Integer providerServiceMapId);

@Query("SELECT r.beneficiaryId FROM FormResponse r " +
"WHERE r.beneficiaryId IN :benIds " +
"AND r.formId = :formId " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private DynamicFormDTO buildFormDto() {
sections.add(buildSectionC());
sections.add(buildSectionD());
sections.add(buildSectionE());
sections.add(buildSectionF());
// sections.add(buildSectionF());
dto.setSections(sections);
return dto;
}
Expand Down Expand Up @@ -125,8 +125,8 @@ private FormSectionDTO buildSectionB() {
private FormSectionDTO buildSectionC() {
FormSectionDTO s = section("TB_SEC_C", "Government Schemes", "सरकारी योजनाएं", "PRE_SUBMIT", 3, false, false);
List<SectionQuestionDTO> qs = new ArrayList<>();
qs.add(yesNoRadio("TB_C_Q1", "Nikshay Poshan Yojana (NPY) eligibility explained", "निक्षय पोषण योजना (एनपीवाई) पात्रता के बारे में बताया गया", 1, false));
qs.add(yesNoRadio("TB_C_Q2", "DOTS free treatment explained", "DOTS मुफ़्त इलाज के बारे में जानकारी", 2, false));
qs.add(yesNoRadio("TB_C_Q1", "Nikshay Poshan Yojana (NPY) eligibility explained", "निक्षय पोषण योजना (एनपीवाई) पात्रता के बारे में बताया गया", 1, true));
qs.add(yesNoRadio("TB_C_Q2", "DOTS free treatment explained", "DOTS मुफ़्त इलाज के बारे में जानकारी", 2, true));
qs.add(textQuestion("TB_C_REMARKS", "Schemes notes", "योजनाओं के नोट्स", 3, false, 300, true));
s.setQuestions(qs);
return s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public interface DynamicFormResponseService {
*/
List<FormResponseDTO> findPendingFollowUps(List<Long> formIds, int delayDays);

/** Returns beneficiary IDs with COMPLETE status for the given form type. */
List<Long> getCompletedBeneficiaries(FormType formType);
/** Returns beneficiary IDs with COMPLETE status for the given form type, optionally filtered by village and/or provider service map. */
List<Long> getCompletedBeneficiaries(FormType formType, Integer villageId, Integer providerServiceMapId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ private String getMappingsForAddressIDs(List<RMNCHMBeneficiaryaddress> addressLi
benDetailsRMNCH_OBJ.setGpsTimestamp(benAddressOBJ.getGpsTimestamp());
if (benDetailsRMNCH_OBJ.getIsGpsUnavailable() == null && benAddressOBJ.getIsGpsUnavailable() != null)
benDetailsRMNCH_OBJ.setIsGpsUnavailable(benAddressOBJ.getIsGpsUnavailable());
if (benDetailsRMNCH_OBJ.getGpsUnavailableReason() == null && benAddressOBJ.getGpsUnavailableReason() != null)
benDetailsRMNCH_OBJ.setGpsUnavailableReason(benAddressOBJ.getGpsUnavailableReason());

// Map GPS double fields to the exposed latitude/longitude BigDecimal fields for response
if (benDetailsRMNCH_OBJ.getGpsLatitude() != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,17 @@ public FormResponseDTO completeForm(FormResponseRequest request, String jwtToken

FormVersion version = resolveLatestVersion(request.getFormUuid());
Long formId = version.getDynamicForm().getFormId();
Timestamp now = new Timestamp(System.currentTimeMillis());

List<FormResponse> existing =
formResponseRepo.findByBeneficiaryIdAndFormId(request.getBeneficiaryId(), formId);
if (existing.isEmpty()) {
throw new NoSuchElementException(
"FormResponse not found for beneficiaryId=" + request.getBeneficiaryId()
+ " formUuid=" + request.getFormUuid());
}
FormResponse formResponse = existing.get(0);
FormResponse formResponse = existing.isEmpty()
? createFormResponse(request, version, STATUS_SUBMITTED, now)
: existing.get(0);

formResponse.setUpdatedBy(actor);
formResponse.setStatus(STATUS_COMPLETE);
formResponse.setCompletedAt(new Timestamp(System.currentTimeMillis()));
formResponse.setCompletedAt(now);
formResponse = formResponseRepo.save(formResponse);
return processSections(formResponse, request, version, actor);
}
Expand Down Expand Up @@ -469,10 +467,12 @@ public List<FormResponseDTO> findPendingFollowUps(List<Long> formIds, int delayD

@Override
@Transactional(readOnly = true)
public List<Long> getCompletedBeneficiaries(FormType formType) {
public List<Long> getCompletedBeneficiaries(FormType formType, Integer villageId, Integer providerServiceMapId) {
DynamicForm form = dynamicFormRepo.findByFormTypeAndIsActive(formType, true)
.orElseThrow(() -> new NoSuchElementException(
"No active form found for type: " + formType));
return formResponseRepo.findBeneficiaryIdsByFormIdAndStatus(form.getFormId(), STATUS_COMPLETE);
return (villageId != null || providerServiceMapId != null)
? formResponseRepo.findBeneficiaryIdsByFormIdAndStatusFiltered(form.getFormId(), STATUS_COMPLETE, villageId, providerServiceMapId)
: formResponseRepo.findBeneficiaryIdsByFormIdAndStatus(form.getFormId(), STATUS_COMPLETE);
}
}