|
@@ -5,6 +5,9 @@ import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+import com.dbs.consentServer.DTO.User;
|
|
|
import com.dbs.consentServer.DTO.hospitalDTO.PatientInfoDTO;
|
|
|
import com.dbs.consentServer.DTO.hospitalDTO.PatientListDTO;
|
|
|
import com.dbs.consentServer.VO.hospitalVO.ConsentFormCategoryVO;
|
|
@@ -13,16 +16,16 @@ import com.dbs.consentServer.VO.hospitalVO.GetPatientInfoVO;
|
|
|
import com.dbs.consentServer.VO.hospitalVO.GetPatientVO;
|
|
|
import com.dbs.consentServer.VO.hospitalVO.GetUserDeptVO;
|
|
|
import com.dbs.consentServer.VO.hospitalVO.GetWardDeptVO;
|
|
|
-import com.dbs.consentServer.exception.ItemNotFoundException;
|
|
|
import com.dbs.consentServer.service.HospitalService;
|
|
|
import com.dbs.consentServer.util.CommonUtils;
|
|
|
|
|
|
-import org.apache.ibatis.annotations.Options;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -46,9 +49,9 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="/GetBaseData", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, String>> GetBaseData(String instCd) {
|
|
|
- ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String, String>>();
|
|
|
- HashMap<String, String> map = new HashMap<String, String>();
|
|
|
+ public ArrayList<HashMap<String, String>> GetBaseData(final String instCd) {
|
|
|
+ final ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String, String>>();
|
|
|
+ final HashMap<String, String> map = new HashMap<String, String>();
|
|
|
String baseData = hospitalService.hospitalMapper.getBaseData(instCd);
|
|
|
|
|
|
if (baseData == null) {
|
|
@@ -66,13 +69,30 @@ public class HospitalSvc {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(path = "/getBaseData", method = RequestMethod.GET)
|
|
|
- public String getBaseData(@RequestParam Map<String, String> reqQeury) throws ItemNotFoundException, IllegalArgumentException {
|
|
|
- String instcd = Optional.ofNullable(reqQeury.get("instCd"))
|
|
|
- .orElseThrow(() -> new IllegalArgumentException("instCd must not be null"));
|
|
|
- String result = Optional.ofNullable(hospitalService.hospitalMapper.getBaseData(instcd))
|
|
|
- .orElseThrow(()->new ItemNotFoundException("no base item found"));
|
|
|
- return result;
|
|
|
+ @GetMapping("GetBaseData")
|
|
|
+ public ResponseEntity<String> GetBaseData(@RequestParam final Map<String, String> reqQeury){
|
|
|
+ HttpStatus status = HttpStatus.OK;
|
|
|
+ String body = "";
|
|
|
+
|
|
|
+ final String instCd = Optional.ofNullable(reqQeury.get("instCd")).orElse("");
|
|
|
+ if(instCd.equals("")){
|
|
|
+ status = HttpStatus.BAD_REQUEST;
|
|
|
+ body = "instCd MUST not be null";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ // 람다 안에서 접근하려면 해당 타입의 array 로 접근하여야 한다. 더럽넹...
|
|
|
+ // String[] bodyTemp = { null };
|
|
|
+ HttpStatus[] statusTemp = { HttpStatus.OK };
|
|
|
+ body = Optional.ofNullable(hospitalService.hospitalMapper.getBaseData(instCd))
|
|
|
+ .filter(o -> !o.equals(""))
|
|
|
+ .orElseGet(() -> {
|
|
|
+ statusTemp[0] = HttpStatus.NO_CONTENT;
|
|
|
+ // 204 일때 어딘가에서 body 를 짤라먹는뎅...
|
|
|
+ return "no basecode found";
|
|
|
+ });
|
|
|
+ status = statusTemp[0];
|
|
|
+ }
|
|
|
+ return new ResponseEntity<String>(body, status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -82,16 +102,16 @@ public class HospitalSvc {
|
|
|
* @param instCd
|
|
|
*/
|
|
|
@RequestMapping(path="updateUserSetUp", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> updateUserSetup(String userId, String status, String instCd) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ public ArrayList<HashMap<String, Object>> updateUserSetup(final String userId, final String status, final String instCd) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
|
|
|
params.put("instCd", instCd);
|
|
|
params.put("status", status);
|
|
|
params.put("userId", userId);
|
|
|
|
|
|
- int rts = hospitalService.updateUserSetUp(params);
|
|
|
+ final int rts = hospitalService.updateUserSetUp(params);
|
|
|
|
|
|
if (rts == 0) {
|
|
|
map.put("code", "01");
|
|
@@ -104,6 +124,24 @@ public class HospitalSvc {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userSet
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PutMapping("updateUserSetUp")
|
|
|
+ public ResponseEntity<?> updateUserSetUp(@Valid User.UserSet userSet){
|
|
|
+ HttpStatus[] status = { HttpStatus.OK };
|
|
|
+ int updated = Optional.ofNullable(hospitalService.updateUserSetUp(userSet))
|
|
|
+ .filter(o -> o >= 0)
|
|
|
+ .orElseGet(() -> {
|
|
|
+ status[0] = HttpStatus.NO_CONTENT;
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ return new ResponseEntity<Integer>(updated, status[0]);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 로그인 프로세스
|
|
@@ -115,8 +153,8 @@ public class HospitalSvc {
|
|
|
*/
|
|
|
@RequestMapping(path="/doLogin", method=RequestMethod.POST)
|
|
|
public ArrayList<HashMap<String, Object>> doLogin(final String userId, final String userPw, final String dutInstCd, final String certSucc) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
|
String encryptPw = hospitalService.hospitalMapper.doLogin(userId);
|
|
|
|
|
@@ -131,11 +169,11 @@ public class HospitalSvc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String sysCd = "HIS031";
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ final String sysCd = "HIS031";
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
params.put("userId", userId);
|
|
|
params.put("sysCd", sysCd);
|
|
|
- ArrayList<GetUserDeptVO> userDeptList = hospitalService.hospitalMapper.getUserDeptList(params);
|
|
|
+ final ArrayList<GetUserDeptVO> userDeptList = hospitalService.hospitalMapper.getUserDeptList(params);
|
|
|
|
|
|
map.put("code", "00");
|
|
|
map.put("data", userDeptList);
|
|
@@ -150,8 +188,8 @@ public class HospitalSvc {
|
|
|
*/
|
|
|
@RequestMapping(path="/getWardList", method=RequestMethod.POST)
|
|
|
public ArrayList<HashMap<String, Object>> getWardList(final String instCd) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
final ArrayList<GetWardDeptVO> wardList = hospitalService.getWardList(instCd);
|
|
|
|
|
|
if (wardList.size() == 0) {
|
|
@@ -174,8 +212,8 @@ public class HospitalSvc {
|
|
|
* 병동 목록이 없을 경우 NO_CONTENT 반환
|
|
|
*/
|
|
|
@GetMapping("getWardList")
|
|
|
- public ArrayList<GetWardDeptVO> getWardList(@RequestParam Map<String, String> reqQeury) {
|
|
|
- String instCd = Optional.ofNullable(reqQeury.get("instCd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "instCd is null"));
|
|
|
+ public ArrayList<GetWardDeptVO> getWardList(@RequestParam final Map<String, String> reqQeury) {
|
|
|
+ final String instCd = Optional.ofNullable(reqQeury.get("instCd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "instCd is null"));
|
|
|
return Optional.ofNullable(
|
|
|
hospitalService.getWardList(instCd)).filter(o -> !o.isEmpty())
|
|
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NO_CONTENT, "no ward list found"));
|
|
@@ -188,14 +226,14 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="getDeptList", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> getDeptList(String instCd, String ordType) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ public ArrayList<HashMap<String, Object>> getDeptList(final String instCd, final String ordType) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<>();
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
params.put("instCd", instCd);
|
|
|
params.put("ordType", ordType);
|
|
|
|
|
|
- ArrayList<GetWardDeptVO> deptList = hospitalService.getDeptList(params);
|
|
|
+ final ArrayList<GetWardDeptVO> deptList = hospitalService.getDeptList(params);
|
|
|
|
|
|
if (deptList.size() == 0) {
|
|
|
map.put("code", "01");
|
|
@@ -209,8 +247,8 @@ public class HospitalSvc {
|
|
|
}
|
|
|
|
|
|
@GetMapping("getDeptList")
|
|
|
- public ArrayList<GetWardDeptVO> getDeptList(@RequestParam Map<String, String> reqQeury) {
|
|
|
- HashMap<String, String> params = new HashMap<>();
|
|
|
+ public ArrayList<GetWardDeptVO> getDeptList(@RequestParam final Map<String, String> reqQeury) {
|
|
|
+ final HashMap<String, String> params = new HashMap<>();
|
|
|
params.put("instCd", Optional.ofNullable(reqQeury.get("instCd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "instCd is null")));
|
|
|
params.put("ordType", Optional.ofNullable(reqQeury.get("ordType")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "ordType is null")));
|
|
|
|
|
@@ -226,16 +264,16 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="getDoctorList", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> getDoctorList(String instCd, String ordDeptCd, String srchDd) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ public ArrayList<HashMap<String, Object>> getDoctorList(final String instCd, final String ordDeptCd, final String srchDd) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
params.put("instCd", instCd);
|
|
|
params.put("ordDeptCd", ordDeptCd);
|
|
|
params.put("srchDd", srchDd);
|
|
|
|
|
|
- ArrayList<GetDoctorVO> doctorList = hospitalService.getDoctorList(params);
|
|
|
+ final ArrayList<GetDoctorVO> doctorList = hospitalService.getDoctorList(params);
|
|
|
if (doctorList.size() == 0) {
|
|
|
map.put("code", "01");
|
|
|
} else {
|
|
@@ -248,8 +286,8 @@ public class HospitalSvc {
|
|
|
}
|
|
|
|
|
|
@GetMapping("getDoctorList")
|
|
|
- public ArrayList<GetDoctorVO> getDoctorList(@RequestParam Map<String, String> reqQeury) {
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ public ArrayList<GetDoctorVO> getDoctorList(@RequestParam final Map<String, String> reqQeury) {
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
params.put("instCd", Optional.ofNullable(reqQeury.get("instCd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "instCd is null")));
|
|
|
params.put("ordDeptCd", Optional.ofNullable(reqQeury.get("ordDeptCd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "ordDeptCd is null")));
|
|
|
params.put("srchDd", Optional.ofNullable(reqQeury.get("srchDd")).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST, "srchDd is null")));
|
|
@@ -264,10 +302,10 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="getPatientList", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> getPatientList(PatientListDTO patientListDTO) {
|
|
|
+ public ArrayList<HashMap<String, Object>> getPatientList(final PatientListDTO patientListDTO) {
|
|
|
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
ArrayList<GetPatientVO> patientList = new ArrayList<>();
|
|
|
|
|
|
if (patientListDTO == null) {
|
|
@@ -278,7 +316,7 @@ public class HospitalSvc {
|
|
|
}
|
|
|
|
|
|
String selectFlag = patientListDTO.getSelectFlag();
|
|
|
- String patientState = patientListDTO.getPatientState();
|
|
|
+ final String patientState = patientListDTO.getPatientState();
|
|
|
String myPatient = patientListDTO.getMyPatient();
|
|
|
|
|
|
logger.debug("patientState -- > " + patientListDTO.getPatientState());
|
|
@@ -320,9 +358,9 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="getPatientInfo", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> getPatientInfo(PatientInfoDTO patientInfoDTO) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ public ArrayList<HashMap<String, Object>> getPatientInfo(final PatientInfoDTO patientInfoDTO) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
ArrayList<GetPatientInfoVO> patientInfo = new ArrayList<GetPatientInfoVO>();
|
|
|
|
|
|
if (patientInfoDTO == null) {
|
|
@@ -332,7 +370,7 @@ public class HospitalSvc {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- String opRsrvNo = patientInfoDTO.getOpRsrvNo() == null ? "" : patientInfoDTO.getOpRsrvNo();
|
|
|
+ final String opRsrvNo = patientInfoDTO.getOpRsrvNo() == null ? "" : patientInfoDTO.getOpRsrvNo();
|
|
|
patientInfoDTO.setOpRsrvNo(opRsrvNo);
|
|
|
|
|
|
patientInfo = hospitalService.getPatientInfo(patientInfoDTO);
|
|
@@ -356,16 +394,16 @@ public class HospitalSvc {
|
|
|
* @param instCd 기관 코드
|
|
|
*/
|
|
|
@RequestMapping(path="setUserFormSetList", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> setUserFormSetList(String userId, String formCd, String instCd) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
- HashMap<String, String> params = new HashMap<String, String>();
|
|
|
+ public ArrayList<HashMap<String, Object>> setUserFormSetList(final String userId, final String formCd, final String instCd) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final HashMap<String, String> params = new HashMap<String, String>();
|
|
|
params.put("userId", userId);
|
|
|
params.put("formCd", formCd);
|
|
|
params.put("instCd", instCd);
|
|
|
|
|
|
logger.debug("params -- > " + params);
|
|
|
- int rCount = hospitalService.setUserFormSet(params);
|
|
|
+ final int rCount = hospitalService.setUserFormSet(params);
|
|
|
logger.debug("result -- > " + result);
|
|
|
|
|
|
if (rCount == 0) {
|
|
@@ -390,15 +428,15 @@ public class HospitalSvc {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(path="delUserFormSet", method=RequestMethod.POST)
|
|
|
- public ArrayList<HashMap<String, Object>> delUserFormSet(String idx, String userId, String formCd, String instCd) {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
- HashMap<Object, Object> params = new HashMap<Object, Object>();
|
|
|
+ public ArrayList<HashMap<String, Object>> delUserFormSet(final String idx, final String userId, final String formCd, final String instCd) {
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final HashMap<Object, Object> params = new HashMap<Object, Object>();
|
|
|
|
|
|
logger.debug("idx -- > " + idx);
|
|
|
logger.debug("idx getClass-- > " + idx.getClass());
|
|
|
|
|
|
- boolean intChk = CommonUtils.isNumeric(idx);
|
|
|
+ final boolean intChk = CommonUtils.isNumeric(idx);
|
|
|
|
|
|
if (intChk != true) {
|
|
|
map.put("code", "01");
|
|
@@ -411,7 +449,7 @@ public class HospitalSvc {
|
|
|
params.put("formCd", formCd);
|
|
|
params.put("instCd", instCd);
|
|
|
|
|
|
- int rCount = hospitalService.delUserFormSet(params);
|
|
|
+ final int rCount = hospitalService.delUserFormSet(params);
|
|
|
|
|
|
if (rCount == 0) {
|
|
|
map.put("code", "02");
|
|
@@ -427,8 +465,8 @@ public class HospitalSvc {
|
|
|
|
|
|
@RequestMapping(path="getConsentFormCategory", method=RequestMethod.POST)
|
|
|
public ArrayList<HashMap<String, Object>> getConsentFormCategory() {
|
|
|
- ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
- HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
+ final ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
|
|
|
+ final HashMap<String, Object> map = new HashMap<String, Object>();
|
|
|
ArrayList<ConsentFormCategoryVO> categoryList = new ArrayList<ConsentFormCategoryVO>();
|
|
|
|
|
|
categoryList = hospitalService.getConsentFormCategory();
|