liusheng
昨天 a4c8c09a33ae26a460c7422f59b4d2f93d0f6dc5
代码提交
已添加1个文件
已修改6个文件
152 ■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentPageReqVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/patient/PatDetails.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/appointment/AppointmentMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/enums/AppointmentTypeEnum.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,8 +104,7 @@
    @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) {
    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));
    }
@@ -116,8 +124,7 @@
    @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);
        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")
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;
        // èŽ·å–æ—¶é—´æ®µ
        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
        int bookTimeslot = Integer.parseInt(startTime.replace(":", "")) * 10000 + Integer.parseInt(endTime.replace(":", ""));
            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);