Skip to content

Commit

Permalink
minnor fix 01
Browse files Browse the repository at this point in the history
  • Loading branch information
adityadeshlahre committed Apr 2, 2024
1 parent 60dc81e commit 3e2bb7f
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -24,13 +30,17 @@
@RequestMapping("/rest/")
public class ReferredOutTestsRestController {

private static final String[] ALLOWED_FIELDS = new String[] { "labNumber", "testIds", "testUnitIds", "endDate",
"startDate", "dateType", "searchType", "selPatient"

};

@Autowired
private ReferralService referralService;

@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setAllowedFields("labNumber", "testIds", "testUnitIds", "endDate",
"startDate", "dateType", "searchType", "selPatient");
binder.setAllowedFields(ALLOWED_FIELDS);
}

private void setupPageForDisplay(ReferredOutTestsForm form) {
Expand All @@ -53,8 +63,6 @@ private void setupPageForDisplayRest(ReferredOutTestsForm form) {
form.setReferralDisplayItems(referralService.getReferralItems(form));
form.setSearchFinished(true);
}
form.setTestSelectionList(DisplayListService.getInstance().getList(DisplayListService.ListType.ALL_TESTS));
form.setTestUnitSelectionList(DisplayListService.getInstance().getList(DisplayListService.ListType.TEST_SECTION_BY_NAME));
}

@PostMapping(value = "ReferredOutTests", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
Expand All @@ -63,11 +71,6 @@ public ReferredOutTestsForm submitReferredOutTests(@Valid @RequestBody ReferredO
setupPageForDisplayRest(form);
return form;
}

// dummy data
// form types fixing or creating
// validating response
// print out things

public class NonNumericTests {
public String testId;
Expand Down

0 comments on commit 3e2bb7f

Please sign in to comment.