|
@@ -5,15 +5,18 @@ import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
+import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.lemon.lifecenter.common.LifeCenterController;
|
|
import com.lemon.lifecenter.common.LifeCenterController;
|
|
import com.lemon.lifecenter.common.LifeCenterSessionController;
|
|
import com.lemon.lifecenter.common.LifeCenterSessionController;
|
|
|
|
+import com.lemon.lifecenter.dto.PatientMemoDTO;
|
|
import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
|
|
import com.lemon.lifecenter.dto.PatientPHRHistoryDTO;
|
|
import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
|
|
import com.lemon.lifecenter.dto.PatientPHRLatestDTO;
|
|
import com.lemon.lifecenter.dto.PatientSymptomSimDTO;
|
|
import com.lemon.lifecenter.dto.PatientSymptomSimDTO;
|
|
@@ -24,126 +27,271 @@ import com.lemon.lifecenter.service.PatientService;
|
|
@Controller
|
|
@Controller
|
|
@RequestMapping("/clinic")
|
|
@RequestMapping("/clinic")
|
|
public class ClinicController extends LifeCenterController {
|
|
public class ClinicController extends LifeCenterController {
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ClinicService clinicService;
|
|
private ClinicService clinicService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private PHRService phrService;
|
|
private PHRService phrService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private PatientService patientService;
|
|
private PatientService patientService;
|
|
-
|
|
|
|
|
|
+
|
|
final int pageSize = 30;
|
|
final int pageSize = 30;
|
|
|
|
|
|
- @RequestMapping("/state")
|
|
|
|
- public ModelAndView clinicState(
|
|
|
|
- HttpServletRequest request,
|
|
|
|
- @RequestParam(value="page", required=true, defaultValue="1") int page,
|
|
|
|
- @RequestParam(value="searchText", required=false, defaultValue="") String searchText) {
|
|
|
|
-
|
|
|
|
- System.err.println( "page : " + page );
|
|
|
|
-
|
|
|
|
- String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
-
|
|
|
|
- PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
|
|
|
|
- dto.setLimit( ( Integer.valueOf( page ) - 1 ) * pageSize );
|
|
|
|
- dto.setLimitMax( pageSize );
|
|
|
|
- dto.setCenterCode(centerCode);
|
|
|
|
- dto.setSearchText(searchText);
|
|
|
|
-
|
|
|
|
- int total = clinicService.selectPHRLatestCount(dto);
|
|
|
|
- List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
|
|
|
|
-
|
|
|
|
- if (total > 0) {
|
|
|
|
- result = clinicService.selectPHRLatestList(dto);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ModelAndView mv = setMV("clinic/state");
|
|
|
|
-
|
|
|
|
- mv.addObject("searchText", searchText);
|
|
|
|
- mv.addObject("total", total);
|
|
|
|
- mv.addObject("items", result);
|
|
|
|
-
|
|
|
|
- return mv;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping("/info")
|
|
|
|
- public ModelAndView patientInfo(
|
|
|
|
- @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
|
|
|
|
- @RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
|
|
|
|
-
|
|
|
|
- String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
-
|
|
|
|
- PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
|
- dto.setPhrType(phrType);
|
|
|
|
- dto.setPatientIdx(patientIdx);
|
|
|
|
-
|
|
|
|
- int total = phrService.selectPHRHistoryCount(dto);
|
|
|
|
- List<PatientPHRHistoryDTO> result = new ArrayList<PatientPHRHistoryDTO>();
|
|
|
|
-
|
|
|
|
- if (total > 0) {
|
|
|
|
- result = phrService.selectPHRHistoryList(dto);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- ModelAndView mv = setMV("clinic/info");
|
|
|
|
-
|
|
|
|
- mv.addObject("patientIdx", patientIdx);
|
|
|
|
- mv.addObject("phrType", phrType);
|
|
|
|
- mv.addObject("phrTotal", total);
|
|
|
|
- mv.addObject("phrItems", result);
|
|
|
|
-
|
|
|
|
- return mv;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping("/api/state")
|
|
|
|
- public @ResponseBody List<PatientPHRLatestDTO> state(
|
|
|
|
- HttpServletRequest request,
|
|
|
|
- @RequestParam(value="page", required=true, defaultValue="1") int page,
|
|
|
|
- @RequestParam(value="searchText", required=false, defaultValue="") String searchText) {
|
|
|
|
-
|
|
|
|
- System.err.println( "page : " + page );
|
|
|
|
-
|
|
|
|
- String centerCode = "0000";//LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
-
|
|
|
|
- PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
|
|
|
|
- dto.setLimit( ( Integer.valueOf( page ) - 1 ) * pageSize );
|
|
|
|
- dto.setLimitMax( pageSize );
|
|
|
|
- dto.setCenterCode(centerCode);
|
|
|
|
- dto.setSearchText(searchText);
|
|
|
|
-
|
|
|
|
- int total = clinicService.selectPHRLatestCount(dto);
|
|
|
|
- List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
|
|
|
|
-
|
|
|
|
- if (total > 0) {
|
|
|
|
- result = clinicService.selectPHRLatestList(dto);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping("/api/phrDatas")
|
|
|
|
- public @ResponseBody List<PatientPHRHistoryDTO> phrDatas(
|
|
|
|
- @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx,
|
|
|
|
- @RequestParam(value="phrType", required=true, defaultValue="temperature") String phrType) {
|
|
|
|
-
|
|
|
|
- PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
|
- dto.setPatientIdx(patientIdx);
|
|
|
|
- dto.setPhrType(phrType);
|
|
|
|
-
|
|
|
|
- return phrService.selectPHRHistoryList(dto);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping("/api/symptomDatas")
|
|
|
|
- public @ResponseBody List<PatientSymptomSimDTO> symptomDatas(
|
|
|
|
- @RequestParam(value="patientIdx", required=true, defaultValue="") int patientIdx) {
|
|
|
|
-
|
|
|
|
- PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
|
|
|
|
- dto.setPatientIdx(patientIdx);
|
|
|
|
-
|
|
|
|
- return phrService.selectSymptomList(dto);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ @RequestMapping("/state")
|
|
|
|
+ public ModelAndView clinicState(HttpServletRequest request,
|
|
|
|
+ @RequestParam(value = "page", required = true, defaultValue = "1") int page,
|
|
|
|
+ @RequestParam(value = "searchText", required = false, defaultValue = "") String searchText) {
|
|
|
|
+
|
|
|
|
+ boolean makePhrData = false;
|
|
|
|
+ boolean makeSymptomData = false;
|
|
|
|
+ boolean makeMemoData = false;
|
|
|
|
+
|
|
|
|
+ if (makePhrData) {
|
|
|
|
+ for (int i = 0; i < 2000; i++) {
|
|
|
|
+ java.util.Random random = new java.util.Random();
|
|
|
|
+ random.setSeed(System.currentTimeMillis());
|
|
|
|
+
|
|
|
|
+ int idx = random.nextInt(2344) + 1;
|
|
|
|
+ while ((idx > 56 && idx < 68) || (idx > 69 && idx < 114) || (idx > 145 && idx < 170)
|
|
|
|
+ || (idx > 385 && idx < 388)) {
|
|
|
|
+ idx = random.nextInt(2344) + 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String[] typeArray = { "temperature", "oxygenSaturation", "pulseRate", "systolicBloodPressure",
|
|
|
|
+ "diastolicBloodPressure", "bloodSugar" };
|
|
|
|
+ int type = random.nextInt(5);
|
|
|
|
+ int value = random.nextInt(100);
|
|
|
|
+
|
|
|
|
+ PatientPHRHistoryDTO dto2 = new PatientPHRHistoryDTO();
|
|
|
|
+
|
|
|
|
+ dto2.setPatientIdx(idx);
|
|
|
|
+ dto2.setPhrType(typeArray[type]);
|
|
|
|
+ dto2.setPhrValue(value);
|
|
|
|
+ dto2.setRecordedByName("홍길동");
|
|
|
|
+
|
|
|
|
+ phrService.insertPHR(dto2);
|
|
|
|
+
|
|
|
|
+ System.err.println("idx : " + idx);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (makeSymptomData) {
|
|
|
|
+ java.util.Random random = new java.util.Random();
|
|
|
|
+ random.setSeed(System.currentTimeMillis());
|
|
|
|
+
|
|
|
|
+ int idx = random.nextInt(2344) + 1;
|
|
|
|
+ String[] typeArray = { "temperature", "oxygenSaturation", "pulseRate", "systolicBloodPressure",
|
|
|
|
+ "diastolicBloodPressure", "bloodSugar" };
|
|
|
|
+ int type = random.nextInt(5);
|
|
|
|
+ int value = random.nextInt(100);
|
|
|
|
+
|
|
|
|
+ PatientPHRHistoryDTO dto2 = new PatientPHRHistoryDTO();
|
|
|
|
+
|
|
|
|
+ dto2.setPatientIdx(idx);
|
|
|
|
+ dto2.setPhrType(typeArray[type]);
|
|
|
|
+ dto2.setPhrValue(value);
|
|
|
|
+ dto2.setRecordedByName("홍길동");
|
|
|
|
+
|
|
|
|
+ phrService.insertPHR(dto2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ System.err.println("page : " + page);
|
|
|
|
+
|
|
|
|
+ String centerCode = "0000";// LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
+
|
|
|
|
+ PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
|
|
|
|
+ dto.setLimit((Integer.valueOf(page) - 1) * pageSize);
|
|
|
|
+ dto.setLimitMax(pageSize);
|
|
|
|
+ dto.setCenterCode(centerCode);
|
|
|
|
+ dto.setSearchText(searchText);
|
|
|
|
+
|
|
|
|
+ int total = clinicService.selectPHRLatestCount(dto);
|
|
|
|
+ List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
|
|
|
|
+
|
|
|
|
+ if (total > 0) {
|
|
|
|
+ result = clinicService.selectPHRLatestList(dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ModelAndView mv = setMV("clinic/state");
|
|
|
|
+
|
|
|
|
+ mv.addObject("searchText", searchText);
|
|
|
|
+ mv.addObject("total", total);
|
|
|
|
+ mv.addObject("items", result);
|
|
|
|
+
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/info")
|
|
|
|
+ public ModelAndView patientInfo(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
|
|
|
|
+ @RequestParam(value = "phrType", required = true, defaultValue = "temperature") String phrType) {
|
|
|
|
+
|
|
|
|
+ String centerCode = "0000";// LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
+
|
|
|
|
+ PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
|
+ dto.setPhrType(phrType);
|
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
|
+
|
|
|
|
+ int total = phrService.selectPHRHistoryCount(dto);
|
|
|
|
+ List<PatientPHRHistoryDTO> result = new ArrayList<PatientPHRHistoryDTO>();
|
|
|
|
+
|
|
|
|
+ if (total > 0) {
|
|
|
|
+ result = phrService.selectPHRHistoryList(dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ModelAndView mv = setMV("clinic/info");
|
|
|
|
+
|
|
|
|
+ mv.addObject("patientIdx", patientIdx);
|
|
|
|
+ mv.addObject("phrType", phrType);
|
|
|
|
+ mv.addObject("phrTotal", total);
|
|
|
|
+ mv.addObject("phrItems", result);
|
|
|
|
+
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/api/state")
|
|
|
|
+ public @ResponseBody List<PatientPHRLatestDTO> state(HttpServletRequest request,
|
|
|
|
+ @RequestParam(value = "page", required = true, defaultValue = "1") int page,
|
|
|
|
+ @RequestParam(value = "searchText", required = false, defaultValue = "") String searchText) {
|
|
|
|
+
|
|
|
|
+ System.err.println("page : " + page);
|
|
|
|
+
|
|
|
|
+ String centerCode = "0000";// LifeCenterSessionController.getSession( request, "sesCenterCode" );
|
|
|
|
+
|
|
|
|
+ PatientPHRLatestDTO dto = new PatientPHRLatestDTO();
|
|
|
|
+ dto.setLimit((Integer.valueOf(page) - 1) * pageSize);
|
|
|
|
+ dto.setLimitMax(pageSize);
|
|
|
|
+ dto.setCenterCode(centerCode);
|
|
|
|
+ dto.setSearchText(searchText);
|
|
|
|
+
|
|
|
|
+ int total = clinicService.selectPHRLatestCount(dto);
|
|
|
|
+ List<PatientPHRLatestDTO> result = new ArrayList<PatientPHRLatestDTO>();
|
|
|
|
+
|
|
|
|
+ if (total > 0) {
|
|
|
|
+ result = clinicService.selectPHRLatestList(dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/api/phrDatas")
|
|
|
|
+ public @ResponseBody List<PatientPHRHistoryDTO> phrDatas(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
|
|
|
|
+ @RequestParam(value = "phrType", required = true, defaultValue = "temperature") String phrType) {
|
|
|
|
+
|
|
|
|
+ PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
|
+ dto.setPhrType(phrType);
|
|
|
|
+
|
|
|
|
+ return phrService.selectPHRHistoryList(dto);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/api/phrData", method = RequestMethod.POST)
|
|
|
|
+ public @ResponseBody String insertPhrData(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
|
|
|
|
+ @RequestParam(value = "phrType", required = true, defaultValue = "") String phrType,
|
|
|
|
+ @RequestParam(value = "phrValue", required = true, defaultValue = "") float phrValue) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PatientPHRHistoryDTO dto = new PatientPHRHistoryDTO();
|
|
|
|
+
|
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
|
+ dto.setPhrType(phrType);
|
|
|
|
+ dto.setPhrValue(phrValue);
|
|
|
|
+ dto.setRecordedByName("홍길동");
|
|
|
|
+
|
|
|
|
+ phrService.insertPHR(dto);
|
|
|
|
+
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "00");
|
|
|
|
+ json.put("message", "");
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "01");
|
|
|
|
+ json.put("message", e.getLocalizedMessage());
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/api/symptomDatas")
|
|
|
|
+ public @ResponseBody List<PatientSymptomSimDTO> symptomDatas(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx) {
|
|
|
|
+
|
|
|
|
+ PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
|
|
|
|
+ dto.setPatientIdx(patientIdx);
|
|
|
|
+
|
|
|
|
+ return phrService.selectSymptomList(dto);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/api/symptomData", method = RequestMethod.POST)
|
|
|
|
+ public @ResponseBody String symptomData(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
|
|
|
|
+ @RequestParam(value = "phrType", required = true, defaultValue = "") String phrType,
|
|
|
|
+ @RequestParam(value = "phrValue", required = true, defaultValue = "") float phrValue) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PatientSymptomSimDTO dto = new PatientSymptomSimDTO();
|
|
|
|
+
|
|
|
|
+ phrService.insertSymptom(dto);
|
|
|
|
+
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "00");
|
|
|
|
+ json.put("message", "");
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "01");
|
|
|
|
+ json.put("message", e.getLocalizedMessage());
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/api/memoDatas")
|
|
|
|
+ public @ResponseBody List<PatientMemoDTO> memoDatas(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx) {
|
|
|
|
+
|
|
|
|
+ PatientMemoDTO dto = new PatientMemoDTO();
|
|
|
|
+
|
|
|
|
+ return clinicService.selectMemoList(dto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/api/memoData", method = RequestMethod.POST)
|
|
|
|
+ public @ResponseBody String memoData(
|
|
|
|
+ @RequestParam(value = "patientIdx", required = true, defaultValue = "") int patientIdx,
|
|
|
|
+ @RequestParam(value = "phrType", required = true, defaultValue = "") String phrType,
|
|
|
|
+ @RequestParam(value = "phrValue", required = true, defaultValue = "") float phrValue) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ PatientMemoDTO dto = new PatientMemoDTO();
|
|
|
|
+
|
|
|
|
+ clinicService.insertMemo(dto);
|
|
|
|
+
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "00");
|
|
|
|
+ json.put("message", "");
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+
|
|
|
|
+ json.put("code", "01");
|
|
|
|
+ json.put("message", e.getLocalizedMessage());
|
|
|
|
+
|
|
|
|
+ return json.toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|