HospitalSvc.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. package com.dbs.consentServer.controller;
  2. import org.slf4j.Logger;
  3. import org.slf4j.LoggerFactory;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestMethod;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import io.swagger.annotations.Api;
  9. import java.util.ArrayList;
  10. import java.util.HashMap;
  11. import com.dbs.consentServer.DTO.hospitalDTO.PatientInfoDTO;
  12. import com.dbs.consentServer.DTO.hospitalDTO.PatientListDTO;
  13. import com.dbs.consentServer.VO.hospitalVO.ConsentFormCategoryVO;
  14. import com.dbs.consentServer.VO.hospitalVO.GetDoctorVO;
  15. import com.dbs.consentServer.VO.hospitalVO.GetPatientInfoVO;
  16. import com.dbs.consentServer.VO.hospitalVO.GetPatientVO;
  17. import com.dbs.consentServer.VO.hospitalVO.GetUserDeptVO;
  18. import com.dbs.consentServer.VO.hospitalVO.GetWardDeptVO;
  19. import com.dbs.consentServer.service.HospitalService;
  20. import com.dbs.consentServer.util.CommonUtils;
  21. @Api(tags = {"2. HospitalService "})
  22. @RestController
  23. @RequestMapping("/hospitalSvc")
  24. public class HospitalSvc {
  25. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  26. @Autowired
  27. private HospitalService hospitalService;
  28. /**
  29. * 기본정보 조회
  30. * @param instCd
  31. * @return
  32. */
  33. @RequestMapping(path="/GetBaseData", method=RequestMethod.POST)
  34. public ArrayList<HashMap<String, String>> GetBaseData(String instCd) {
  35. ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String, String>>();
  36. HashMap<String, String> map = new HashMap<String, String>();
  37. String baseData = hospitalService.hospitalMapper.getBaseData(instCd);
  38. if (baseData == null) {
  39. baseData = "";
  40. }
  41. if (baseData.equals("")) {
  42. map.put("code", "01");
  43. } else {
  44. map.put("code", "00");
  45. map.put("data", baseData);
  46. }
  47. result.add(map);
  48. return result;
  49. }
  50. /**
  51. * 기본 탭 설정(입원, 외래 등)
  52. * @param userId 사용자 아이디
  53. * @param status 상태 (입원 : I)
  54. * @param instCd
  55. */
  56. @RequestMapping(path="updateUserSetUp", method=RequestMethod.POST)
  57. public ArrayList<HashMap<String, Object>> updateUserSetup(String userId, String status, String instCd) {
  58. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  59. HashMap<String, Object> map = new HashMap<String, Object>();
  60. HashMap<String, String> params = new HashMap<String, String>();
  61. params.put("instCd", instCd);
  62. params.put("status", status);
  63. params.put("userId", userId);
  64. int rts = hospitalService.updateUserSetUp(params);
  65. if (rts == 0) {
  66. map.put("code", "01");
  67. } else {
  68. map.put("code", "00");
  69. map.put("data", rts);
  70. }
  71. result.add(map);
  72. return result;
  73. }
  74. /**
  75. * 로그인 프로세스
  76. * @param userId 사용자 ID
  77. * @param userPw 사용자 PW
  78. * @param dutInstCd 기관코드
  79. * @param certSucc 인증여부(문자열로 내려옴, true면 공인인증서 로그인을 통해 들어온것)
  80. * @return
  81. */
  82. @RequestMapping(path="/doLogin", method=RequestMethod.POST)
  83. public ArrayList<HashMap<String, Object>> doLogin(final String userId, final String userPw, final String dutInstCd, final String certSucc) {
  84. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  85. HashMap<String, Object> map = new HashMap<String, Object>();
  86. String encryptPw = hospitalService.hospitalMapper.doLogin(userId);
  87. if (encryptPw == null) {
  88. encryptPw = "";
  89. }
  90. if (certSucc.equals("false")) {
  91. if (!encryptPw.equals(userPw)) {
  92. map.put("code", "02");
  93. return result;
  94. }
  95. }
  96. String sysCd = "HIS031";
  97. HashMap<String, String> params = new HashMap<String, String>();
  98. params.put("userId", userId);
  99. params.put("sysCd", sysCd);
  100. ArrayList<GetUserDeptVO> userDeptList = hospitalService.hospitalMapper.getUserDeptList(params);
  101. map.put("code", "00");
  102. map.put("data", userDeptList);
  103. result.add(map);
  104. return result;
  105. }
  106. /**
  107. * 병동 리스트
  108. * @param instCd
  109. * @return
  110. */
  111. @RequestMapping(path="/getWardList", method=RequestMethod.POST)
  112. public ArrayList<HashMap<String, Object>> getWardList(final String instCd) {
  113. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  114. HashMap<String, Object> map = new HashMap<String, Object>();
  115. final ArrayList<GetWardDeptVO> wardList = hospitalService.getWardList(instCd);
  116. if (wardList.size() == 0) {
  117. map.put("code", "01");
  118. } else {
  119. map.put("code", "00");
  120. map.put("data", wardList);
  121. }
  122. result.add(map);
  123. return result;
  124. }
  125. /**
  126. * 진료과 리스트
  127. * @param instCd
  128. * @param ordType
  129. * @return
  130. */
  131. @RequestMapping(path="getDeptList", method=RequestMethod.POST)
  132. public ArrayList<HashMap<String, Object>> getDeptList(String instCd, String ordType) {
  133. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  134. HashMap<String, Object> map = new HashMap<>();
  135. HashMap<String, String> params = new HashMap<String, String>();
  136. params.put("instCd", instCd);
  137. params.put("ordType", ordType);
  138. ArrayList<GetWardDeptVO> deptList = hospitalService.getDeptList(params);
  139. if (deptList.size() == 0) {
  140. map.put("code", "01");
  141. } else {
  142. map.put("code", "00");
  143. map.put("data", deptList);
  144. }
  145. result.add(map);
  146. return result;
  147. }
  148. /**
  149. * 진료과에 따른 진료의 리스트
  150. * @param instCd
  151. * @param ordDeptCd
  152. * @param srchDd
  153. * @return
  154. */
  155. @RequestMapping(path="getDoctorList", method=RequestMethod.POST)
  156. public ArrayList<HashMap<String, Object>> getDoctorList(String instCd, String ordDeptCd, String srchDd) {
  157. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  158. HashMap<String, Object> map = new HashMap<String, Object>();
  159. HashMap<String, String> params = new HashMap<String, String>();
  160. params.put("instCd", instCd);
  161. params.put("ordDeptCd", ordDeptCd);
  162. params.put("srchDd", srchDd);
  163. ArrayList<GetDoctorVO> doctorList = hospitalService.getDoctorList(params);
  164. if (doctorList.size() == 0) {
  165. map.put("code", "01");
  166. } else {
  167. map.put("code", "00");
  168. map.put("data", doctorList);
  169. }
  170. result.add(map);
  171. return result;
  172. }
  173. /**
  174. * 환자 리스트 조회
  175. * @param patientListDTO
  176. * @return
  177. */
  178. @RequestMapping(path="getPatientList", method=RequestMethod.POST)
  179. public ArrayList<HashMap<String, Object>> getPatientList(PatientListDTO patientListDTO) {
  180. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  181. HashMap<String, Object> map = new HashMap<String, Object>();
  182. ArrayList<GetPatientVO> patientList = new ArrayList<>();
  183. if (patientListDTO == null) {
  184. map.put("code", "01");
  185. map.put("data", patientList);
  186. result.add(map);
  187. return result;
  188. }
  189. String selectFlag = patientListDTO.getSelectFlag();
  190. String patientState = patientListDTO.getPatientState();
  191. String myPatient = patientListDTO.getMyPatient();
  192. logger.debug("patientState -- > " + patientListDTO.getPatientState());
  193. if (selectFlag.equals("SR")) {
  194. if (patientState.equals("A")) {
  195. selectFlag = "I";
  196. } else if (patientState.equals("0")) {
  197. selectFlag = "O";
  198. } else if (patientState.equals("1")) {
  199. selectFlag = "1";
  200. }
  201. patientListDTO.setPatientState("");
  202. }
  203. if (myPatient.equals("")) {
  204. myPatient = "N";
  205. }
  206. patientListDTO.setMyPatient(myPatient);
  207. patientList = hospitalService.getPatientList(patientListDTO);
  208. if (patientList.size() == 0) {
  209. map.put("code", "02");
  210. } else {
  211. map.put("code", "00");
  212. }
  213. map.put("data", patientList);
  214. result.add(map);
  215. return result;
  216. }
  217. /**
  218. * 환자상세 정보 조회
  219. * @param patientInfoDTO
  220. * @return
  221. */
  222. @RequestMapping(path="getPatientInfo", method=RequestMethod.POST)
  223. public ArrayList<HashMap<String, Object>> getPatientInfo(PatientInfoDTO patientInfoDTO) {
  224. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  225. HashMap<String, Object> map = new HashMap<String, Object>();
  226. ArrayList<GetPatientInfoVO> patientInfo = new ArrayList<GetPatientInfoVO>();
  227. if (patientInfoDTO == null) {
  228. map.put("code", "01");
  229. map.put("data", patientInfo);
  230. result.add(map);
  231. return result;
  232. }
  233. String opRsrvNo = patientInfoDTO.getOpRsrvNo() == null ? "" : patientInfoDTO.getOpRsrvNo();
  234. patientInfoDTO.setOpRsrvNo(opRsrvNo);
  235. patientInfo = hospitalService.getPatientInfo(patientInfoDTO);
  236. if (patientInfo.size() == 0) {
  237. map.put("code", "02");
  238. } else {
  239. map.put("code", "00");
  240. }
  241. map.put("data", patientInfo);
  242. result.add(map);
  243. return result;
  244. }
  245. /**
  246. * 사용자 즐겨찾기 추가
  247. * 리턴이 0이면 실패 1이면 성공
  248. * @param userId 사용자 아이디
  249. * @param formCd 서식 코드
  250. * @param instCd 기관 코드
  251. */
  252. @RequestMapping(path="setUserFormSetList", method=RequestMethod.POST)
  253. public ArrayList<HashMap<String, Object>> setUserFormSetList(String userId, String formCd, String instCd) {
  254. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  255. HashMap<String, Object> map = new HashMap<String, Object>();
  256. HashMap<String, String> params = new HashMap<String, String>();
  257. params.put("userId", userId);
  258. params.put("formCd", formCd);
  259. params.put("instCd", instCd);
  260. logger.debug("params -- > " + params);
  261. int rCount = hospitalService.setUserFormSet(params);
  262. logger.debug("result -- > " + result);
  263. if (rCount == 0) {
  264. map.put("code", "01");
  265. } else {
  266. map.put("code", "00");
  267. map.put("data", rCount);
  268. }
  269. result.add(map);
  270. return result;
  271. }
  272. /**
  273. * 즐겨찾기 삭제
  274. * 리턴이 0이면 실패 1이면 성공
  275. * @param idx
  276. * @param userId
  277. * @param formCd
  278. * @param instCd
  279. * @return
  280. */
  281. @RequestMapping(path="delUserFormSet", method=RequestMethod.POST)
  282. public ArrayList<HashMap<String, Object>> delUserFormSet(String idx, String userId, String formCd, String instCd) {
  283. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  284. HashMap<String, Object> map = new HashMap<String, Object>();
  285. HashMap<Object, Object> params = new HashMap<Object, Object>();
  286. logger.debug("idx -- > " + idx);
  287. logger.debug("idx getClass-- > " + idx.getClass());
  288. boolean intChk = CommonUtils.isNumeric(idx);
  289. if (intChk != true) {
  290. map.put("code", "01");
  291. result.add(map);
  292. return result;
  293. }
  294. params.put("idx", Integer.parseInt(idx));
  295. params.put("userId", userId);
  296. params.put("formCd", formCd);
  297. params.put("instCd", instCd);
  298. int rCount = hospitalService.delUserFormSet(params);
  299. if (rCount == 0) {
  300. map.put("code", "02");
  301. } else {
  302. map.put("code", "00");
  303. map.put("data", rCount);
  304. }
  305. result.add(map);
  306. return result;
  307. }
  308. @RequestMapping(path="getConsentFormCategory", method=RequestMethod.POST)
  309. public ArrayList<HashMap<String, Object>> getConsentFormCategory() {
  310. ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
  311. HashMap<String, Object> map = new HashMap<String, Object>();
  312. ArrayList<ConsentFormCategoryVO> categoryList = new ArrayList<ConsentFormCategoryVO>();
  313. categoryList = hospitalService.getConsentFormCategory();
  314. if (categoryList.size() == 0) {
  315. map.put("code", "01");
  316. } else {
  317. map.put("code", "00");
  318. map.put("data", categoryList);
  319. }
  320. result.add(map);
  321. return result;
  322. }
  323. }