Skip to content

Commit

Permalink
DTSCCI-1455: add medical cos and sol doc in bundle (#6014)
Browse files Browse the repository at this point in the history
* DTSCCI-1455: add medical, cos, sl and other in bundle

* DTSCCI-1455: add medical cos sol in bundle

---------

Co-authored-by: pats-john <13101669+pats-john@users.noreply.github.com>
  • Loading branch information
rishikrsharma and pats-john authored Jan 30, 2025
1 parent 664dbbf commit a4fe571
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public enum BundleFileNameList {
REPLIES_FROM("Replies from %s %s"),
JOINT_STATEMENTS_OF_EXPERTS("Joint statement of experts %s %s %s"),
SKELETON_ARGUMENT("%s Skeleton argument %s"),
PARTICULARS_OF_CLAIM("Particulars Of Claim %s");
PARTICULARS_OF_CLAIM("Particulars Of Claim %s"),
CERTIFICATE_OF_SUITABILITY("Certificate Of Suitability %s"),
SCHEDULE_OF_LOSS("Schedule Of Loss %s"),
MEDICAL_REPORT("Medical Report %s");

String displayName;

public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class BundleDocumentsRetrieval {
private final ConversionToBundleRequestDocs conversionToBundleRequestDocs;
private final BundleRequestDocsOrganizer bundleRequestDocsOrganizer;

public String getParticularsOfClaimName(CaseData caseData) {
public String getParticularsOfClaimName(CaseData caseData, BundleFileNameList bundleFileNameList) {

log.info("Getting details of claim for case ID: {}", caseData.getCcdCaseReference());
LocalDate pocDate;
Expand All @@ -55,8 +55,7 @@ public String getParticularsOfClaimName(CaseData caseData) {
} else {
pocDate = caseData.getSubmittedDate().toLocalDate();
}
return generateDocName(BundleFileNameList.PARTICULARS_OF_CLAIM.getDisplayName(),
null, null, pocDate
return generateDocName(bundleFileNameList.getDisplayName(), null, null, pocDate
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.documentmanagement.model.CaseDocument;
import uk.gov.hmcts.reform.civil.documentmanagement.model.Document;
import uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType;
import uk.gov.hmcts.reform.civil.enums.DocCategory;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
Expand All @@ -12,6 +13,7 @@
import uk.gov.hmcts.reform.civil.enums.caseprogression.TypeOfDocDocumentaryEvidenceOfTrial;
import uk.gov.hmcts.reform.civil.helpers.DateFormatHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.DocumentWithRegex;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.model.bundle.BundleCreateRequest;
import uk.gov.hmcts.reform.civil.model.bundle.BundlingCaseData;
Expand Down Expand Up @@ -104,14 +106,41 @@ private BundlingCaseData mapCaseData(CaseData caseData, String bundleConfigFileN

private List<BundlingRequestDocument> mapParticularsOfClaimDocs(CaseData caseData) {
List<BundlingRequestDocument> bundlingRequestDocuments = new ArrayList<>();
if (Objects.nonNull(caseData.getServedDocumentFiles())
&& Objects.nonNull((caseData.getServedDocumentFiles().getParticularsOfClaimDocument()))) {
caseData.getServedDocumentFiles()
.getParticularsOfClaimDocument()
.forEach(poc -> bundlingRequestDocuments.add(
buildBundlingRequestDoc(bundleDocumentsRetrieval.getParticularsOfClaimName(caseData),
poc.getValue(), ""
)));
if (Objects.nonNull(caseData.getServedDocumentFiles())) {
List<Element<Document>> particularsOfClaimDocument = caseData.getServedDocumentFiles().getParticularsOfClaimDocument();
if (Objects.nonNull((particularsOfClaimDocument))) {
particularsOfClaimDocument.forEach(poc -> bundlingRequestDocuments.add(
buildBundlingRequestDoc(
bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.PARTICULARS_OF_CLAIM),
poc.getValue(), ""
)));
}
List<Element<DocumentWithRegex>> medicalReport = caseData.getServedDocumentFiles().getMedicalReport();
if (Objects.nonNull(medicalReport)) {
medicalReport.forEach(mr -> bundlingRequestDocuments.add(
buildBundlingRequestDoc(
bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.MEDICAL_REPORT),
mr.getValue().getDocument(), ""
)));
}

List<Element<DocumentWithRegex>> scheduleOfLoss = caseData.getServedDocumentFiles().getScheduleOfLoss();
if (Objects.nonNull(scheduleOfLoss)) {
scheduleOfLoss.forEach(poc -> bundlingRequestDocuments.add(
buildBundlingRequestDoc(
bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.SCHEDULE_OF_LOSS),
poc.getValue().getDocument(), ""
)));
}

List<Element<DocumentWithRegex>> cos = caseData.getServedDocumentFiles().getCertificateOfSuitability();
if (Objects.nonNull(cos)) {
cos.forEach(poc -> bundlingRequestDocuments.add(
buildBundlingRequestDoc(
bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.CERTIFICATE_OF_SUITABILITY),
poc.getValue().getDocument(), ""
)));
}
}
return bundlingRequestDocuments;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ void shouldReturnCorrectParticularsOfClaimName_forSpecClaim() {
.issueDate(LocalDate.of(2023, 12, 4))
.build();

String result = bundleDocumentsRetrieval.getParticularsOfClaimName(caseData);

String result = bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.PARTICULARS_OF_CLAIM);
assertEquals("Particulars Of Claim 04/12/2023", result);
result = bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.MEDICAL_REPORT);
assertEquals("Medical Report 04/12/2023", result);
result = bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.SCHEDULE_OF_LOSS);
assertEquals("Schedule Of Loss 04/12/2023", result);
result = bundleDocumentsRetrieval.getParticularsOfClaimName(caseData, BundleFileNameList.CERTIFICATE_OF_SUITABILITY);
assertEquals("Certificate Of Suitability 04/12/2023", result);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.enums.caseprogression.TypeOfDocDocumentaryEvidenceOfTrial;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.DocumentWithRegex;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.model.ServedDocumentFiles;
import uk.gov.hmcts.reform.civil.model.bundle.BundleCreateRequest;
Expand Down Expand Up @@ -112,18 +113,24 @@ void testBundleRequestMapperWithAllDocs(boolean caseProgressionCuiEnabled) {
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(0).getValue().getDocumentFileName());
assertEquals("Particulars Of Claim 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(1).getValue().getDocumentFileName());
assertEquals("DF 1 Defence 10/02/2023",
assertEquals("Medical Report 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(2).getValue().getDocumentFileName());
assertEquals("CL's reply 10/02/2023",
assertEquals("Schedule Of Loss 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(3).getValue().getDocumentFileName());
assertEquals("CL 1 reply to part 18 request 12/01/2023",
assertEquals("Certificate Of Suitability 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(4).getValue().getDocumentFileName());
assertEquals("CL 2 reply to part 18 request 12/01/2023",
assertEquals("DF 1 Defence 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(5).getValue().getDocumentFileName());
assertEquals("DF 1 reply to part 18 request 12/01/2023",
assertEquals("CL's reply 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(6).getValue().getDocumentFileName());
assertEquals("DF 2 reply to part 18 request 12/01/2023",
assertEquals("CL 1 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(7).getValue().getDocumentFileName());
assertEquals("CL 2 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(8).getValue().getDocumentFileName());
assertEquals("DF 1 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(9).getValue().getDocumentFileName());
assertEquals("DF 2 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(10).getValue().getDocumentFileName());
assertEquals("CL 1 Directions Questionnaire 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getDirectionsQuestionnaires().get(0).getValue().getDocumentFileName());
assertEquals("DF 1 Directions Questionnaire 10/02/2023",
Expand Down Expand Up @@ -246,18 +253,24 @@ void testBundleRequestMapperWithAllDocsAndCaseEvenEnable(boolean caseProgression
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(0).getValue().getDocumentFileName());
assertEquals("Particulars Of Claim 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(1).getValue().getDocumentFileName());
assertEquals("DF 1 Defence 10/02/2023",
assertEquals("Medical Report 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(2).getValue().getDocumentFileName());
assertEquals("CL's reply 10/02/2023",
assertEquals("Schedule Of Loss 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(3).getValue().getDocumentFileName());
assertEquals("CL 1 reply to part 18 request 12/01/2023",
assertEquals("Certificate Of Suitability 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(4).getValue().getDocumentFileName());
assertEquals("CL 2 reply to part 18 request 12/01/2023",
assertEquals("DF 1 Defence 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(5).getValue().getDocumentFileName());
assertEquals("DF 1 reply to part 18 request 12/01/2023",
assertEquals("CL's reply 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(6).getValue().getDocumentFileName());
assertEquals("DF 2 reply to part 18 request 12/01/2023",
assertEquals("CL 1 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(7).getValue().getDocumentFileName());
assertEquals("CL 2 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(8).getValue().getDocumentFileName());
assertEquals("DF 1 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(9).getValue().getDocumentFileName());
assertEquals("DF 2 reply to part 18 request 12/01/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getStatementsOfCaseDocuments().get(10).getValue().getDocumentFileName());
assertEquals("CL 1 Directions Questionnaire 10/02/2023",
bundleCreateRequest.getCaseDetails().getCaseData().getDirectionsQuestionnaires().get(0).getValue().getDocumentFileName());
assertEquals("DF 1 Directions Questionnaire 10/02/2023",
Expand Down Expand Up @@ -392,25 +405,6 @@ private CaseData getCaseDataWithNoId() {
.build();
}

private CaseData getCaseDataWithUnbundledFolderId() {
return CaseData.builder().ccdCaseReference(1L)
.systemGeneratedCaseDocuments(setupSystemGeneratedCaseDocsUnbundledFolderId())
.applicant1(Party.builder().individualLastName("lastname").individualFirstName("cl1Fname").partyName(
"applicant1").type(Party.Type.INDIVIDUAL).build())
.respondent1(Party.builder().individualLastName("lastname").individualFirstName("df1Fname").partyName(
"respondent1").type(Party.Type.INDIVIDUAL).build())
.addApplicant2(YesOrNo.YES)
.addRespondent2(YesOrNo.YES)
.applicant2(Party.builder().individualLastName("lastname").individualFirstName("cl2Fname").partyName(
"applicant2").type(Party.Type.INDIVIDUAL).build())
.respondent2(Party.builder().individualLastName("lastname").individualFirstName("df2Fname").partyName(
"respondent2").type(Party.Type.INDIVIDUAL).build())
.hearingDate(LocalDate.now())
.submittedDate(LocalDateTime.of(2023, 2, 10, 2,
2, 2))
.build();
}

private CaseData getCaseData() {
return CaseData.builder().ccdCaseReference(1L)
.documentWitnessStatement(getWitnessDocs())
Expand Down Expand Up @@ -553,7 +547,18 @@ private ServedDocumentFiles setupParticularsOfClaimDocs() {
List<Element<Document>> particularsOfClaim = new ArrayList<>();
Document document = Document.builder().documentFileName(TEST_FILE_NAME).documentUrl(TEST_URL).build();
particularsOfClaim.add(ElementUtils.element(document));
return ServedDocumentFiles.builder().particularsOfClaimDocument(particularsOfClaim).build();
List<Element<DocumentWithRegex>> docs = new ArrayList<>();
DocumentWithRegex doc = DocumentWithRegex.builder().document(Document.builder()
.documentFileName(TEST_FILE_NAME)
.documentUrl(TEST_URL).build()).build();
docs.add(ElementUtils.element(doc));
return ServedDocumentFiles.builder()
.particularsOfClaimDocument(particularsOfClaim)
.medicalReport(docs)
.certificateOfSuitability(docs)
.scheduleOfLoss(docs)
.other(docs)
.build();
}

private List<Element<UploadEvidenceExpert>> getExpertOtherPartyQuestionDocs(String partyName) {
Expand Down

0 comments on commit a4fe571

Please sign in to comment.