Exemplo n.º 1
0
  @RequestMapping(value = "/showBloodTypingResultsForCollection", method = RequestMethod.GET)
  public ModelAndView showBloodTypingResultsForCollection(
      HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam(value = "collectionId") String collectionId) {
    ModelAndView mv = new ModelAndView();
    collectionId = collectionId.trim();
    Long collectedSampleId = Long.parseLong(collectionId);
    CollectedSample collectedSample =
        collectedSampleRepository.findCollectedSampleById(collectedSampleId);
    BloodTestingRuleResult ruleResult =
        bloodTestingRepository.getAllTestsStatusForCollection(collectedSampleId);
    mv.addObject("collection", new CollectedSampleViewModel(collectedSample));
    mv.addObject("collectionId", collectedSample.getId());
    mv.addObject("bloodTypingOutputForCollection", ruleResult);
    mv.addObject("collectionFields", utilController.getFormFieldsForForm("collectedSample"));

    List<BloodTest> bloodTypingTests = bloodTestingRepository.getBloodTypingTests();
    Map<String, BloodTest> bloodTypingTestsMap = new LinkedHashMap<String, BloodTest>();
    for (BloodTest bloodTypingTest : bloodTypingTests) {
      bloodTypingTestsMap.put(bloodTypingTest.getId().toString(), bloodTypingTest);
    }
    mv.addObject("allBloodTypingTests", bloodTypingTestsMap);

    List<BloodTest> allBloodTypingTests = bloodTestingRepository.getBloodTypingTests();
    Map<String, BloodTest> allBloodTypingTestsMap = new TreeMap<String, BloodTest>();
    for (BloodTest bloodTypingTest : allBloodTypingTests) {
      allBloodTypingTestsMap.put(bloodTypingTest.getId().toString(), bloodTypingTest);
    }
    mv.addObject("allBloodTypingTests", allBloodTypingTestsMap);

    mv.setViewName("bloodtesting/bloodTypingSummaryCollection");

    mv.addObject("refreshUrl", getUrl(request));

    return mv;
  }