jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -26,6 +26,7 @@ import cn.lihu.jh.framework.excel.core.util.ExcelUtils; import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog; import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*; import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; @@ -73,6 +74,14 @@ return success(true); } @PostMapping("/updateStatus") @Operation(summary = "æ´æ°ç³è¯·ç¶æ") @PreAuthorize("@ss.hasPermission('ecg:appointment:update')") public CommonResult<Boolean> updateAppointmentStatus(@Valid @RequestBody AppointmentSaveReqVO updateReqVO) { appointmentService.updateAppointmentStatus(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "å é¤é¢çº¦") @Parameter(name = "id", description = "ç¼å·", required = true) @@ -95,9 +104,8 @@ @Operation(summary = "æ ¹æ®æ£è ç¼å·.æ¥è¯¢å½å¤©é¢çº¦") @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('ecg:appointment:query')") public CommonResult<AppointmentRespVO> getCurAppointmentByPatId(@RequestParam("patId") String patId, @RequestParam("checkType") Integer checkType) { AppointmentDO appointment = appointmentService.getCurAppointmentByPatIdAndCheckType( patId, checkType ); public CommonResult<AppointmentRespVO> getCurAppointmentByPatId(@RequestParam("patId") String patId, @RequestParam("checkType") Integer checkType) { AppointmentDO appointment = appointmentService.getCurAppointmentByPatIdAndCheckType(patId, checkType); return success(BeanUtils.toBean(appointment, AppointmentRespVO.class)); } @@ -106,7 +114,7 @@ @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('ecg:appointment:query')") public CommonResult<List<AppointmentRespVO>> queryAndCreateAppointmentByPatId(@RequestParam("patId") String patId) { List<AppointmentDO> appointmentDOList = appointmentService.queryAndCreateAppointmentByPatId( patId ); List<AppointmentDO> appointmentDOList = appointmentService.queryAndCreateAppointmentByPatId(patId); return success(BeanUtils.toBean(appointmentDOList, AppointmentRespVO.class)); } @@ -115,9 +123,8 @@ @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('ecg:appointment:query')") public CommonResult<AppointmentRespVO> queryHisByPatient(@RequestParam("patId") String patId) { List<AppointmentDO> appointmentList = appointmentService.getAppointmentExtermal( patId ); if ( 0 == appointmentList.size() ) return error(APPOINTMENT_NOT_BILLING); List<AppointmentDO> appointmentList = appointmentService.getAppointmentExtermal(patId); if (0 == appointmentList.size()) return error(APPOINTMENT_NOT_BILLING); return success(BeanUtils.toBean(appointmentList.get(0), AppointmentRespVO.class)); } @@ -125,7 +132,6 @@ @Operation(summary = "è·å¾é¢çº¦å页") @PreAuthorize("@ss.hasPermission('ecg:appointment:query')") public CommonResult<PageResult<AppointmentRespVO>> getAppointmentPage(@Valid AppointmentPageReqVO pageReqVO) { pageReqVO.setStatus("1"); PageResult<AppointmentDO> pageResult = appointmentService.getAppointmentPage(pageReqVO); return success(BeanUtils.toBean(pageResult, AppointmentRespVO.class)); } @@ -134,13 +140,11 @@ @Operation(summary = "导åºé¢çº¦ Excel") @PreAuthorize("@ss.hasPermission('ecg:appointment:export')") @ApiAccessLog(operateType = EXPORT) public void exportAppointmentExcel(@Valid AppointmentPageReqVO pageReqVO, HttpServletResponse response) throws IOException { public void exportAppointmentExcel(@Valid AppointmentPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List<AppointmentDO> list = appointmentService.getAppointmentPage(pageReqVO).getList(); // å¯¼åº Excel ExcelUtils.write(response, "é¢çº¦.xls", "æ°æ®", AppointmentRespVO.class, BeanUtils.toBean(list, AppointmentRespVO.class)); ExcelUtils.write(response, "é¢çº¦.xls", "æ°æ®", AppointmentRespVO.class, BeanUtils.toBean(list, AppointmentRespVO.class)); } @PostMapping("/confirm") @@ -148,7 +152,7 @@ @PreAuthorize("@ss.hasPermission('ecg:appointment:confirm')") public CommonResult<Integer> appointmentConfirm(@RequestBody AppointmentConfirmReqVO confirmReqVO) { confirmReqVO.setIsVip(0); Integer newSeqNo = appointmentService.appoitmentConfirm( confirmReqVO ); Integer newSeqNo = appointmentService.appoitmentConfirm(confirmReqVO); return success(newSeqNo); } @@ -157,8 +161,8 @@ @PreAuthorize("@ss.hasPermission('ecg:appointment:confirm')") public CommonResult<Integer> appointmentConfirmVip(@RequestBody AppointmentConfirmReqVO confirmReqVO) { confirmReqVO.setIsVip(1); confirmReqVO.setBookDate( LocalDate.now() ); Integer newSeqNo = appointmentService.appoitmentConfirm( confirmReqVO ); confirmReqVO.setBookDate(LocalDate.now()); Integer newSeqNo = appointmentService.appoitmentConfirm(confirmReqVO); return success(newSeqNo); } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java
@@ -80,7 +80,7 @@ private String bookSrc; @Schema(description = "ç³è¯·åç¶æ") private String status; private String[] status; @Schema(description = "已仿¬¾") private Integer paid; jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java
@@ -1,5 +1,6 @@ package cn.lihu.jh.module.ecg.dal.dataobject.patient; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -9,6 +10,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) public class PatDetails { String Id; String Name; jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java
@@ -40,7 +40,7 @@ .eqIfPresent(AppointmentDO::getBookCheckType, reqVO.getBookCheckType()) .eqIfPresent(AppointmentDO::getBookSrc, reqVO.getBookSrc()) .eqIfPresent(AppointmentDO::getPaid, reqVO.getPaid()) .eqIfPresent(AppointmentDO::getStatus, reqVO.getStatus()) .inIfPresent(AppointmentDO::getStatus, reqVO.getStatus()) .orderByDesc(AppointmentDO::getId)); } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/enums/AppointmentTypeEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,46 @@ package cn.lihu.jh.module.ecg.enums; import lombok.AllArgsConstructor; import lombok.Getter; /** * Actionç±»åæä¸¾ */ @Getter @AllArgsConstructor public enum AppointmentTypeEnum { SQDKL(" 1", " ç³è¯·åå¼ç«"), SQDCX(" 2", "ç³è¯·åæ¤é"), JCDJ(" 3 ", "æ£æ¥ç»è®°"), QXJC(" 4", " åæ¶æ£æ¥"), JCKS(" 5", " æ£æ¥å¼å§"), GZYJ(" 6", " ç»é å½±å"), JCJS(" 7", " æ£æ¥ç»æ"), BGSC(" 8", " æ¥åçæ"), BGCX(" 9", " æ¥åæ¤é"), BGSH(" 10", " æ¥åå®¡æ ¸"); /** * ç±»å */ private final String type; /** * æè¿° */ private final String description; /** * æ ¹æ®ç±»åè·åæä¸¾ * * @param type ç±»å * @return æä¸¾ */ public static String getByType(String type) { for (AppointmentTypeEnum value : values()) { if (value.getType().equals(type)) { return value.getDescription(); } } return null; } } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java
@@ -33,6 +33,13 @@ void updateAppointment(@Valid AppointmentSaveReqVO updateReqVO); /** * æ´æ°é¢çº¦ç¶æ * * @param updateReqVO æ´æ°ä¿¡æ¯ */ void updateAppointmentStatus(@Valid AppointmentSaveReqVO updateReqVO); /** * å é¤é¢çº¦ * * @param id ç¼å· @@ -47,7 +54,6 @@ */ AppointmentDO getAppointment(Long id); /** * è·å¾é¢çº¦å页 * @@ -55,7 +61,6 @@ * @return é¢çº¦å页 */ PageResult<AppointmentDO> getAppointmentPage(AppointmentPageReqVO pageReqVO); /** * ç³è¯·åå建 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java
@@ -11,13 +11,17 @@ import cn.lihu.jh.module.ecg.dal.dataobject.patient.PatDetails; import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper; import cn.lihu.jh.module.ecg.enums.AppointmentTypeEnum; import cn.lihu.jh.module.ecg.enums.HisCheckCodeEnum; import cn.lihu.jh.module.ecg.feign.RemoteDataService; import cn.lihu.jh.module.ecg.service.config.EcgConfigService; import cn.lihu.jh.module.ecg.service.devrent.ApplicationTemplate; import cn.lihu.jh.module.ecg.service.queue.QueueService; import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService; import cn.lihu.jh.module.ecg.webservice.WebServiceClient; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +65,9 @@ @Resource private AppointmentMapper appointmentMapper; @Autowired private WebServiceClient webServiceClient; @Override public Long createAppointment(AppointmentSaveReqVO createReqVO) { // æå ¥ @@ -83,6 +90,56 @@ // æ´æ° AppointmentDO updateObj = BeanUtils.toBean(updateReqVO, AppointmentDO.class); appointmentMapper.updateById(updateObj); } @Override public void updateAppointmentStatus(AppointmentSaveReqVO updateReqVO) { // æ ¡éªåå¨ validateAppointmentExists(updateReqVO.getId()); // è·å宿´çé¢çº¦ä¿¡æ¯ AppointmentDO appointment = appointmentMapper.selectById(updateReqVO.getId()); if (appointment == null) { throw exception(APPOINTMENT_NOT_EXISTS); } // æ´æ°ç¶æ appointment.setStatus(updateReqVO.getStatus()); // è°ç¨HISç³»ç»æ´æ°ç¶æ String action = "S0405"; ApplicationTemplate app = new ApplicationTemplate(); String statusName = AppointmentTypeEnum.getByType(appointment.getStatus()); String message = app.getXML( appointment.getApplyNo(), appointment.getStatus(), statusName, null, appointment.getPatDeptCode(), appointment.getPatDeptDesc(), appointment.getPatWardCode(), appointment.getPatWardDesc(), appointment.getPatBedNo(), appointment.getEpisodeId(), String.valueOf(appointment.getBookSrc()), appointment.getPatId(), appointment.getPatName() ); try { String response = webServiceClient.callJHFWTYRK(action, "", message); if (response.contains("æ´æ°æå")) { // æ´æ°æ¬å°æ°æ®åº appointmentMapper.updateById(appointment); } else { throw exception(APPOINTMENT_UPDATE_FAIL); } } catch (Exception e) { log.error("[updateAppointmentStatus][æ´æ°é¢çº¦ç¶æå¤±è´¥ appointment({})]", appointment, e); throw exception(APPOINTMENT_UPDATE_FAIL); } } @Override @@ -371,7 +428,6 @@ // å°AppointmentDO转æ¢ä¸ºAppointmentSaveReqVOå¹¶ä¿å AppointmentSaveReqVO saveReqVO = BeanUtils.toBean(appointment, AppointmentSaveReqVO.class); saveReqVO.setStatus("1"); return createAppointment(saveReqVO); } catch (Exception e) { log.error("[handleAppointmentCreate][å¤çé¢çº¦å建失败 dataMap({})]", dataMap, e); @@ -559,22 +615,27 @@ // è§£æé¢çº¦æ¶é´ LocalDateTime bookTime = LocalDateTime.parse(bookTimeStr, DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); LocalDate bookDate = bookTime.toLocalDate(); Integer bookTimeslot = null; // è·åæ¶é´æ®µ String timeRange = (String) ((Map<String, Object>) actAppointment.get("ZDY")).get("time"); String[] time1 = timeRange.split(" "); String[] times = time1[1].split("-"); String startTime = times[0].trim(); String endTime = times[1].trim(); // è½¬æ¢æ¶é´æ®µæ ¼å¼ä¸ºhhmmhhmm int bookTimeslot = Integer.parseInt(startTime.replace(":", "")) * 10000 + Integer.parseInt(endTime.replace(":", "")); try { // String timeRange = (String) ((Map<String, Object>) actAppointment.get("ZDY")).get("time");è¿è¡å¦ææ¯æ´æ°æä½çæ¶åï¼æå¯è½æ¥ç©ºæé(ä½ä¸å½±åï¼å¯ä»¥ä¸ç¨ç®¡) String timeRange = (String) ((Map<String, Object>) actAppointment.get("ZDY")).get("time"); String[] time1 = timeRange.split(" "); String[] times = time1[1].split("-"); String startTime = times[0].trim(); String endTime = times[1].trim(); // è½¬æ¢æ¶é´æ®µæ ¼å¼ä¸ºhhmmhhmm bookTimeslot = Integer.parseInt(startTime.replace(":", "")) * 10000 + Integer.parseInt(endTime.replace(":", "")); } catch (Exception e) { e.printStackTrace(); } // æ´æ°é¢çº¦ä¿¡æ¯ appointment.setBookDate(bookDate); appointment.setBookTimeslot(bookTimeslot); appointment.setBookTime(bookTime); appointment.setBookSrc(Integer.parseInt(bookSrc)); appointment.setStatus((String) ((Map<String, Object>) actAppointment.get("ZDY")).get("statusCode")); // ä¿åæ´æ° appointmentMapper.updateById(appointment);