ClinicController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package com.lemon.lifecenter.controller;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletRequest;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RequestParam;
  9. import org.springframework.web.bind.annotation.ResponseBody;
  10. import org.springframework.web.servlet.ModelAndView;
  11. import com.lemon.lifecenter.common.LifeCenterController;
  12. import com.lemon.lifecenter.common.LifeCenterSessionController;
  13. import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
  14. import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
  15. import com.lemon.lifecenter.service.ClinicService;
  16. import com.lemon.lifecenter.service.PHRService;
  17. import com.lemon.lifecenter.service.PatientService;
  18. @Controller
  19. @RequestMapping("/clinic")
  20. public class ClinicController extends LifeCenterController {
  21. @Autowired
  22. private ClinicService clinicService;
  23. @Autowired
  24. private PHRService phrService;
  25. @Autowired
  26. private PatientService patientService;
  27. @RequestMapping("/state")
  28. public ModelAndView clinicState(
  29. HttpServletRequest request,
  30. @RequestParam(value="page", required=true, defaultValue="1") int page,
  31. @RequestParam(value="wardNumber", required=false, defaultValue="") String wardNumber,
  32. @RequestParam(value="patientName", required=false, defaultValue="") String patientName) {
  33. System.err.println( "page : " + page );
  34. final int pageSize = 18;
  35. String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
  36. PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
  37. dto.setLimit( ( Integer.valueOf( page ) - 1 ) * pageSize );
  38. dto.setLimitMax( pageSize );
  39. dto.setCenterCode(centerCode);
  40. dto.setWardNumber(wardNumber);
  41. dto.setPatientName(patientName);
  42. int total = clinicService.selectPHRLatestCount(dto);
  43. List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
  44. if (total > 0) {
  45. result = clinicService.selectPHRLatestList(dto);
  46. }
  47. ModelAndView mv = setMV("clinic/state");
  48. mv.addObject("total", 18);
  49. mv.addObject("items", result);
  50. return mv;
  51. }
  52. @RequestMapping("/info")
  53. public ModelAndView patientInfo(
  54. @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
  55. @RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
  56. String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
  57. PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
  58. dto.setPhrType(phrType);
  59. dto.setPatientIdx(patientIdx);
  60. int total = phrService.selectPHRHistoryCount(dto);
  61. List<PatientPHRHistoryDTO> result = new ArrayList<PatientPHRHistoryDTO>();
  62. if (total > 0) {
  63. result = phrService.selectPHRHistoryList(dto);
  64. }
  65. ModelAndView mv = setMV("clinic/info");
  66. mv.addObject("patientIdx", patientIdx);
  67. mv.addObject("phrType", phrType);
  68. mv.addObject("phrTotal", total);
  69. mv.addObject("phrItems", result);
  70. return mv;
  71. }
  72. @RequestMapping("/api/phrDatas")
  73. public @ResponseBody List<PatientPHRHistoryDTO> phrDatas(
  74. @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
  75. @RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
  76. PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
  77. dto.setPatientIdx(patientIdx);
  78. dto.setPhrType(phrType);
  79. return phrService.selectPHRHistoryList(dto);
  80. }
  81. }