最新版本升级
This commit is contained in:
97
openhis-server-new/openhis-application/pom.xml
Normal file
97
openhis-server-new/openhis-application/pom.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.openhis</groupId>
|
||||
<artifactId>openhis-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>openhis-application</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<description>
|
||||
应用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring 配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- 领域-->
|
||||
<dependency>
|
||||
<groupId>com.openhis</groupId>
|
||||
<artifactId>openhis-domain</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- liteflow-->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.12.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- junit-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.43</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.openhis;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
import com.openhis.web.ybmanage.config.YbServiceConfig;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"})
|
||||
@EnableConfigurationProperties(YbServiceConfig.class)
|
||||
@EnableAsync
|
||||
public class OpenHisApplication {
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
ConfigurableApplicationContext application = SpringApplication.run(OpenHisApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
System.out.println("\n----------------------------------------------------------\n\t"
|
||||
+ "Application OpenHis is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:" + port + path
|
||||
+ "/\n\t" + "External: \thttp://" + ip + ":" + port + path + "/\n"
|
||||
+ "----------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.openhis.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* http相关配置
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "http")
|
||||
@PropertySource(value = {"classpath:http.yml"})
|
||||
public class HttpConfig {
|
||||
private String appId;
|
||||
private String key;
|
||||
private String url;
|
||||
private String fixmedinsCode;
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.openhis.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.util.CronUtils;
|
||||
import com.openhis.quartz.service.ISysJobService;
|
||||
import com.openhis.quartz.util.ScheduleUtils;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/job")
|
||||
public class SysJobController extends BaseController {
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
|
||||
/**
|
||||
* 查询定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysJob sysJob) {
|
||||
startPage();
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysJob sysJob) {
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||
util.exportExcel(response, list, "定时任务");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定时任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId) {
|
||||
return success(jobService.selectJobById(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:add')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException {
|
||||
if (!CronUtils.isValid(job.getCronExpression())) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.HTTP, Constants.HTTPS})) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||
} else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
||||
}
|
||||
job.setCreateBy(getUsername());
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:edit')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException {
|
||||
if (!CronUtils.isValid(job.getCronExpression())) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.HTTP, Constants.HTTPS})) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||
} else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
||||
}
|
||||
job.setUpdateBy(getUsername());
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException {
|
||||
SysJob newJob = jobService.selectJobById(job.getJobId());
|
||||
newJob.setStatus(job.getStatus());
|
||||
return toAjax(jobService.changeStatus(newJob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务立即执行一次
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/run")
|
||||
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException {
|
||||
boolean result = jobService.run(job);
|
||||
return result ? success() : error("任务不存在或已过期!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException {
|
||||
jobService.deleteJobByIds(jobIds);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.openhis.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.openhis.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 调度日志操作处理
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/jobLog")
|
||||
public class SysJobLogController extends BaseController {
|
||||
@Autowired
|
||||
private ISysJobLogService jobLogService;
|
||||
|
||||
/**
|
||||
* 查询定时任务调度日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysJobLog sysJobLog) {
|
||||
startPage();
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时任务调度日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||
@Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysJobLog sysJobLog) {
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||
util.exportExcel(response, list, "调度日志");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据调度编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
||||
@GetMapping(value = "/{jobLogId}")
|
||||
public AjaxResult getInfo(@PathVariable Long jobLogId) {
|
||||
return success(jobLogService.selectJobLogById(jobLogId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务调度日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "定时任务调度日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobLogIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobLogIds) {
|
||||
return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空定时任务调度日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean() {
|
||||
jobLogService.cleanJobLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.openhis.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志信息信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysJobLogService {
|
||||
/**
|
||||
* 获取quartz调度器日志的计划任务
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogList(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
*
|
||||
* @param jobLogId 调度任务日志ID
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
public SysJobLog selectJobLogById(Long jobLogId);
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
*/
|
||||
public void addJobLog(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
*
|
||||
* @param logIds 需要删除的日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogByIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
*
|
||||
* @param jobId 调度日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogById(Long jobId);
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog();
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.openhis.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysJobService {
|
||||
/**
|
||||
* 获取quartz调度器的计划任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 调度任务集合
|
||||
*/
|
||||
public List<SysJob> selectJobList(SysJob job);
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
public SysJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int pauseJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resumeJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
*
|
||||
* @param jobIds 需要删除的任务ID
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeStatus(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean run(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*
|
||||
* @param cronExpression 表达式
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkCronExpressionIsValid(String cronExpression);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.openhis.quartz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.core.quartz.mapper.SysJobLogMapper;
|
||||
import com.openhis.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysJobLogServiceImpl implements ISysJobLogService {
|
||||
@Autowired
|
||||
private SysJobLogMapper jobLogMapper;
|
||||
|
||||
/**
|
||||
* 获取quartz调度器日志的计划任务
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysJobLog> selectJobLogList(SysJobLog jobLog) {
|
||||
return jobLogMapper.selectJobLogList(jobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
*
|
||||
* @param jobLogId 调度任务日志ID
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysJobLog selectJobLogById(Long jobLogId) {
|
||||
return jobLogMapper.selectJobLogById(jobLogId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
*/
|
||||
@Override
|
||||
public void addJobLog(SysJobLog jobLog) {
|
||||
jobLogMapper.insertJobLog(jobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
*
|
||||
* @param logIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobLogByIds(Long[] logIds) {
|
||||
return jobLogMapper.deleteJobLogByIds(logIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
*
|
||||
* @param jobId 调度日志ID
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobLogById(Long jobId) {
|
||||
return jobLogMapper.deleteJobLogById(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
@Override
|
||||
public void cleanJobLog() {
|
||||
jobLogMapper.cleanJobLog();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.openhis.quartz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.mapper.SysJobMapper;
|
||||
import com.core.quartz.util.CronUtils;
|
||||
import com.openhis.quartz.service.ISysJobService;
|
||||
import com.openhis.quartz.util.ScheduleUtils;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysJobServiceImpl implements ISysJobService {
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
@Autowired
|
||||
private SysJobMapper jobMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() throws SchedulerException, TaskException {
|
||||
scheduler.clear();
|
||||
List<SysJob> jobList = jobMapper.selectJobAll();
|
||||
for (SysJob job : jobList) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取quartz调度器的计划任务列表
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysJob> selectJobList(SysJob job) {
|
||||
return jobMapper.selectJobList(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysJob selectJobById(Long jobId) {
|
||||
return jobMapper.selectJobById(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int pauseJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int resumeJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
job.setStatus(ScheduleConstants.Status.NORMAL.getValue());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
int rows = jobMapper.deleteJobById(jobId);
|
||||
if (rows > 0) {
|
||||
scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
*
|
||||
* @param jobIds 需要删除的任务ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException {
|
||||
for (Long jobId : jobIds) {
|
||||
SysJob job = jobMapper.selectJobById(jobId);
|
||||
deleteJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int changeStatus(SysJob job) throws SchedulerException {
|
||||
int rows = 0;
|
||||
String status = job.getStatus();
|
||||
if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) {
|
||||
rows = resumeJob(job);
|
||||
} else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) {
|
||||
rows = pauseJob(job);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean run(SysJob job) throws SchedulerException {
|
||||
boolean result = false;
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
SysJob properties = selectJobById(job.getJobId());
|
||||
// 参数
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties);
|
||||
JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup);
|
||||
if (scheduler.checkExists(jobKey)) {
|
||||
result = true;
|
||||
scheduler.triggerJob(jobKey, dataMap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param job 调度信息 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertJob(SysJob job) throws SchedulerException, TaskException {
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
int rows = jobMapper.insertJob(job);
|
||||
if (rows > 0) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务的时间表达式
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateJob(SysJob job) throws SchedulerException, TaskException {
|
||||
SysJob properties = selectJobById(job.getJobId());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
updateSchedulerJob(job, properties.getJobGroup());
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*
|
||||
* @param job 任务对象
|
||||
* @param jobGroup 任务组名
|
||||
*/
|
||||
public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException {
|
||||
Long jobId = job.getJobId();
|
||||
// 判断是否存在
|
||||
JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup);
|
||||
if (scheduler.checkExists(jobKey)) {
|
||||
// 防止创建时存在数据问题 先移除,然后在执行创建操作
|
||||
scheduler.deleteJob(jobKey);
|
||||
}
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*
|
||||
* @param cronExpression 表达式
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkCronExpressionIsValid(String cronExpression) {
|
||||
return CronUtils.isValid(cronExpression);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.openhis.quartz.task;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 定时任务例子
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("exampleTask")
|
||||
public class ExampleTask {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationAppService organizationAppService;
|
||||
|
||||
/**
|
||||
* 定时获取机构信息
|
||||
*/
|
||||
public void getOrgInfo() {
|
||||
log.info("定时获取机构信息START,时间:{}", DateUtils.getDate());
|
||||
|
||||
// 处理部分
|
||||
R<?> r = organizationAppService.getOrgInfo(1907249098877554689L);
|
||||
|
||||
log.info("定时获取机构信息END,机构信息:{},时间:{}", r.getData(), DateUtils.getDate());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.quartz.task;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.framework.config.TenantContext;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Component("ryTask")
|
||||
public class RyTask {
|
||||
|
||||
@Resource
|
||||
ILocationService locationService;
|
||||
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
|
||||
// 定时任务指定租户id,示例
|
||||
try {
|
||||
Integer tenantId = i;
|
||||
// 设置当前线程的租户ID
|
||||
TenantContext.setCurrentTenant(tenantId);
|
||||
List<Location> pharmacyList = locationService.getPharmacyList();
|
||||
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
|
||||
} finally {
|
||||
// 清除线程局部变量,防止内存泄漏
|
||||
TenantContext.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ryParams(String params) {
|
||||
System.out.println("执行有参方法:" + params);
|
||||
}
|
||||
|
||||
public void ryNoParams() {
|
||||
System.out.println("执行无参方法");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.openhis.quartz.task;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.openhis.web.inventorymanage.appservice.IProductStocktakingAppService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.framework.config.TenantContext;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
|
||||
/**
|
||||
* 批量盘点定时任务
|
||||
*
|
||||
* @author yuxj
|
||||
*/
|
||||
@Component("stocktakingBatchTask")
|
||||
public class StocktakingBatchTask {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(StocktakingBatchTask.class);
|
||||
@Resource
|
||||
IProductStocktakingAppService productStocktakingAppService;
|
||||
|
||||
public void autoStocktakingBatch(Integer tenantId) {
|
||||
// 定时任务指定租户id,示例
|
||||
try {
|
||||
// 在控制台打印当前时间加执行的功能名
|
||||
System.out.println("执行自动批量盘点START:" + DateUtils.getNowDate());
|
||||
logger.info("执行自动批量盘点START:" + DateUtils.getNowDate());
|
||||
|
||||
// 设置当前线程的租户ID
|
||||
TenantContext.setCurrentTenant(tenantId);
|
||||
//执行自动盘点
|
||||
productStocktakingAppService.autoStocktakingBatch();
|
||||
|
||||
logger.info("执行自动批量盘点END:" + DateUtils.getNowDate());
|
||||
// 在控制台打印当前时间加执行的功能名
|
||||
System.out.println("执行自动批量盘点END:" + DateUtils.getNowDate());
|
||||
} finally {
|
||||
// 清除线程局部变量,防止内存泄漏
|
||||
TenantContext.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.openhis.quartz.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.utils.ExceptionUtil;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.core.common.utils.spring.SpringUtils;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.openhis.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 抽象quartz调用
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public abstract class AbstractQuartzJob implements Job {
|
||||
private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class);
|
||||
|
||||
/**
|
||||
* 线程本地变量
|
||||
*/
|
||||
private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
SysJob sysJob = new SysJob();
|
||||
BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));
|
||||
try {
|
||||
before(context, sysJob);
|
||||
if (sysJob != null) {
|
||||
doExecute(context, sysJob);
|
||||
}
|
||||
after(context, sysJob, null);
|
||||
} catch (Exception e) {
|
||||
log.error("任务执行异常 - :", e);
|
||||
after(context, sysJob, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行前
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
*/
|
||||
protected void before(JobExecutionContext context, SysJob sysJob) {
|
||||
threadLocal.set(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行后
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
*/
|
||||
protected void after(JobExecutionContext context, SysJob sysJob, Exception e) {
|
||||
Date startTime = threadLocal.get();
|
||||
threadLocal.remove();
|
||||
|
||||
final SysJobLog sysJobLog = new SysJobLog();
|
||||
sysJobLog.setJobName(sysJob.getJobName());
|
||||
sysJobLog.setJobGroup(sysJob.getJobGroup());
|
||||
sysJobLog.setInvokeTarget(sysJob.getInvokeTarget());
|
||||
sysJobLog.setStartTime(startTime);
|
||||
sysJobLog.setStopTime(new Date());
|
||||
long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime();
|
||||
sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒");
|
||||
if (e != null) {
|
||||
sysJobLog.setStatus(Constants.FAIL);
|
||||
String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000);
|
||||
sysJobLog.setExceptionInfo(errorMsg);
|
||||
} else {
|
||||
sysJobLog.setStatus(Constants.SUCCESS);
|
||||
}
|
||||
|
||||
// 写入数据库当中
|
||||
SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行方法,由子类重载
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
* @throws Exception 执行过程中的异常
|
||||
*/
|
||||
protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.openhis.quartz.util;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.util.JobInvokeUtil;
|
||||
|
||||
/**
|
||||
* 定时任务处理(禁止并发执行)
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob {
|
||||
@Override
|
||||
protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
|
||||
JobInvokeUtil.invokeMethod(sysJob);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.openhis.quartz.util;
|
||||
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.util.JobInvokeUtil;
|
||||
|
||||
/**
|
||||
* 定时任务处理(允许并发执行)
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
public class QuartzJobExecution extends AbstractQuartzJob {
|
||||
@Override
|
||||
protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
|
||||
JobInvokeUtil.invokeMethod(sysJob);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.openhis.quartz.util;
|
||||
|
||||
import org.quartz.*;
|
||||
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.common.exception.job.TaskException.Code;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.spring.SpringUtils;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.util.CronUtils;
|
||||
|
||||
/**
|
||||
* 定时任务工具类
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
public class ScheduleUtils {
|
||||
/**
|
||||
* 得到quartz任务类
|
||||
*
|
||||
* @param sysJob 执行计划
|
||||
* @return 具体执行任务类
|
||||
*/
|
||||
private static Class<? extends Job> getQuartzJobClass(SysJob sysJob) {
|
||||
boolean isConcurrent = "0".equals(sysJob.getConcurrent());
|
||||
return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务触发对象
|
||||
*/
|
||||
public static TriggerKey getTriggerKey(Long jobId, String jobGroup) {
|
||||
return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务键对象
|
||||
*/
|
||||
public static JobKey getJobKey(Long jobId, String jobGroup) {
|
||||
return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建定时任务
|
||||
*/
|
||||
public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException {
|
||||
Class<? extends Job> jobClass = getQuartzJobClass(job);
|
||||
// 构建job信息
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build();
|
||||
|
||||
// 表达式调度构建器
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);
|
||||
|
||||
// 按新的cronExpression表达式构建一个新的trigger
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup))
|
||||
.withSchedule(cronScheduleBuilder).build();
|
||||
|
||||
// 放入参数,运行时的方法可以获取
|
||||
jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);
|
||||
|
||||
// 判断是否存在
|
||||
if (scheduler.checkExists(getJobKey(jobId, jobGroup))) {
|
||||
// 防止创建时存在数据问题 先移除,然后在执行创建操作
|
||||
scheduler.deleteJob(getJobKey(jobId, jobGroup));
|
||||
}
|
||||
|
||||
// 判断任务是否过期
|
||||
if (StringUtils.isNotNull(CronUtils.getNextExecution(job.getCronExpression()))) {
|
||||
// 执行调度任务
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
}
|
||||
|
||||
// 暂停任务
|
||||
if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) {
|
||||
scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置定时任务策略
|
||||
*/
|
||||
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb)
|
||||
throws TaskException {
|
||||
switch (job.getMisfirePolicy()) {
|
||||
case ScheduleConstants.MISFIRE_DEFAULT:
|
||||
return cb;
|
||||
case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
|
||||
return cb.withMisfireHandlingInstructionIgnoreMisfires();
|
||||
case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
|
||||
return cb.withMisfireHandlingInstructionFireAndProceed();
|
||||
case ScheduleConstants.MISFIRE_DO_NOTHING:
|
||||
return cb.withMisfireHandlingInstructionDoNothing();
|
||||
default:
|
||||
throw new TaskException(
|
||||
"The task misfire policy '" + job.getMisfirePolicy() + "' cannot be used in cron schedule tasks",
|
||||
Code.CONFIG_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查包名是否为白名单配置
|
||||
*
|
||||
* @param invokeTarget 目标字符串
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean whiteList(String invokeTarget) {
|
||||
String packageName = StringUtils.substringBefore(invokeTarget, "(");
|
||||
int count = StringUtils.countMatches(packageName, ".");
|
||||
if (count > 1) {
|
||||
return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR);
|
||||
}
|
||||
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]);
|
||||
String beanPackageName = obj.getClass().getPackage().getName();
|
||||
return StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_WHITELIST_STR)
|
||||
&& !StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_ERROR_STR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.openhis.rule.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("a")
|
||||
public class ACmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
// do your business
|
||||
System.out.println("___aaa");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.openhis.rule.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("b")
|
||||
public class BCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
// do your business
|
||||
System.out.println("___bbb");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.openhis.rule.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("c")
|
||||
public class CCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
// do your business
|
||||
System.out.println("___ccc");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.BodyStructureDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
/**
|
||||
* BodyStructure 应该服务类
|
||||
*/
|
||||
public interface IBodyStructureAppService {
|
||||
/**
|
||||
* 查询身体部位树
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 身体部位树分页列表
|
||||
*/
|
||||
Page<BodyStructureDto> getBodyStructureTree(Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 身体部位信息详情
|
||||
*
|
||||
* @param id 身体部位信息id
|
||||
* @return 身体部位详情
|
||||
*/
|
||||
R<?> getBodyStructureInfo(Long id);
|
||||
|
||||
/**
|
||||
* 添加/编辑体身体部位信息
|
||||
*
|
||||
* @param bodyStructureDto 身体部位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditBodyStructure(BodyStructureDto bodyStructureDto);
|
||||
|
||||
/**
|
||||
* 身体部位信息
|
||||
*
|
||||
* @param ids 身体部位信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteBodyStructure(String ids);
|
||||
|
||||
/**
|
||||
* 身体部位启用
|
||||
*
|
||||
* @param id 身体部位信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> activeBodyStructure(Long id);
|
||||
|
||||
/**
|
||||
* 身体部位停用
|
||||
*
|
||||
* @param id 身体部位信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> inactiveBodyStructure(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.LocationAddOrEditDto;
|
||||
import com.openhis.web.basedatamanage.dto.LocationPageParam;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Location 应该服务类
|
||||
*/
|
||||
public interface ILocationAppService {
|
||||
/**
|
||||
* 位置信息
|
||||
*
|
||||
* @param formList 类型
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param isInHospital 是否为住院
|
||||
* @return 位置信息分页列表
|
||||
*/
|
||||
R<?> getLocationTree(List<Integer> formList, Integer pageNo, Integer pageSize, String isInHospital);
|
||||
|
||||
/**
|
||||
* 位置信息详情
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @return 位置信息详情
|
||||
*/
|
||||
R<?> getLocationById(Long locationId);
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param busNo 位置信息编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteLocation(String busNo);
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param locationPageParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param request 请求
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
R<?> getLocationPage(LocationPageParam locationPageParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 新增位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addLocation(LocationAddOrEditDto locationAddOrEditDto);
|
||||
|
||||
/**
|
||||
* 编辑位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> editLocation(LocationAddOrEditDto locationAddOrEditDto);
|
||||
|
||||
/**
|
||||
* 位置初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> locationInit();
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> enableLocation(List<Long> locationIdList);
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deactivateLocation(List<Long> locationIdList);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
/**
|
||||
* Organization 应该服务类
|
||||
*/
|
||||
public interface IOrganizationAppService {
|
||||
/**
|
||||
* 查询机构树
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构树分页列表
|
||||
*/
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 机构信息详情
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 机构信息详情
|
||||
*/
|
||||
R<?> getOrgInfo(Long orgId);
|
||||
|
||||
/**
|
||||
* 添加/编辑机构信息
|
||||
*
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditOrganization(OrganizationDto organizationDto);
|
||||
|
||||
/**
|
||||
* 机构信息
|
||||
*
|
||||
* @param orgIds 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteOrganization(String orgIds);
|
||||
|
||||
/**
|
||||
* 机构启用
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> activeOrg(Long orgId);
|
||||
|
||||
/**
|
||||
* 机构停用
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> inactiveOrg(Long orgId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
/**
|
||||
* Organization 应该服务类
|
||||
*/
|
||||
public interface IOrganizationLocationAppService {
|
||||
|
||||
/**
|
||||
* 查询机构位置
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构位置分页列表
|
||||
*/
|
||||
R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 添加/编辑机构位置信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto);
|
||||
|
||||
/**
|
||||
* 机构位置信息
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteOrgLoc(Long orgLocId);
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> organizationLocationInit();
|
||||
|
||||
/**
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
R<?> getLocationListByForm(Integer locationForm);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参与者 应该服务类
|
||||
*/
|
||||
public interface IPractitionerAppService {
|
||||
|
||||
/**
|
||||
* 新增用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveUserPractitioner(UserAndPractitionerDto userAndPractitionerDto);
|
||||
|
||||
/**
|
||||
* 查询用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 用户及参与者
|
||||
*/
|
||||
IPage<UserAndPractitionerDto> getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto,
|
||||
String searchKey, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 修改用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> editUserPractitioner(UserAndPractitionerDto userAndPractitionerDto);
|
||||
|
||||
/**
|
||||
* 删除用户及参与者 ; admin不允许删除
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> delUserPractitioner(Long userId);
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
List<SelectableOrgDto> getSelectableOrgList();
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> switchOrg(Long orgId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||
|
||||
/**
|
||||
* PractitionerRole 应该服务类
|
||||
*/
|
||||
public interface IPractitionerRoleAppService {
|
||||
/**
|
||||
* 查询岗位
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 岗位分页列表
|
||||
*/
|
||||
R<?> getPractitionerPage(PractRoleSearchParam practRoleSearchParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 岗位信息详情
|
||||
*
|
||||
* @param practitionerRoleId 岗位信息id
|
||||
* @return 岗位信息详情
|
||||
*/
|
||||
R<?> getPractitionerRoleById(Long practitionerRoleId);
|
||||
|
||||
/**
|
||||
* 添加/编辑岗位信息
|
||||
*
|
||||
* @param practitionerRoleDto 岗位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditPractitionerRole(PractitionerRoleDto practitionerRoleDto);
|
||||
|
||||
/**
|
||||
* 岗位信息
|
||||
*
|
||||
* @param practitionerRoleId 岗位信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deletePractitionerRole(Long practitionerRoleId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.BodyStructure;
|
||||
import com.openhis.administration.service.IBodyStructureService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IBodyStructureAppService;
|
||||
import com.openhis.web.basedatamanage.dto.BodyStructureDto;
|
||||
|
||||
@Service
|
||||
public class BodyStructureAppServiceImpl implements IBodyStructureAppService {
|
||||
|
||||
@Resource
|
||||
private IBodyStructureService bodyStructureService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<BodyStructureDto> getBodyStructureTree(Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 查询身体部位列表
|
||||
Page<BodyStructure> page = bodyStructureService.page(new Page<>(pageNo, pageSize));
|
||||
List<BodyStructure> bodyStructureList = page.getRecords();
|
||||
// 将身体部位列表转为树结构
|
||||
List<BodyStructureDto> orgTree = buildTree(bodyStructureList);
|
||||
Page<BodyStructureDto> orgQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
orgQueryDtoPage.setRecords(orgTree);
|
||||
return orgQueryDtoPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将身体部位列表转换为树结构
|
||||
*
|
||||
* @param records 机构列表
|
||||
* @return tree
|
||||
*/
|
||||
private List<BodyStructureDto> buildTree(List<BodyStructure> records) {
|
||||
// 按b_no的层级排序,确保父节点先处理
|
||||
List<BodyStructure> sortedRecords = records.stream()
|
||||
.sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList());
|
||||
|
||||
Map<String, BodyStructureDto> nodeMap = new HashMap<>();
|
||||
List<BodyStructureDto> tree = new ArrayList<>();
|
||||
|
||||
for (BodyStructure record : sortedRecords) {
|
||||
String bNo = record.getBusNo();
|
||||
String[] parts = bNo.split("\\.");
|
||||
BodyStructureDto node = new BodyStructureDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
node.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, node.getStatusEnum()));
|
||||
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
|
||||
if (parts.length == 1) {
|
||||
// 根节点
|
||||
tree.add(node);
|
||||
} else {
|
||||
// 获取父节点的b_no(去掉最后一部分)
|
||||
String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1));
|
||||
BodyStructureDto parent = nodeMap.get(parentBNo);
|
||||
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
} else {
|
||||
// 处理父节点不存在的情况(例如数据缺失)
|
||||
// 可根据需求调整为将节点加入根或抛出异常
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 身体部位信息详情
|
||||
*
|
||||
* @param id 身体部位id
|
||||
* @return 机构信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBodyStructureInfo(Long id) {
|
||||
BodyStructure bodyStructure = bodyStructureService.getById(id);
|
||||
return R.ok(bodyStructure,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"身体部位信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑部位
|
||||
*
|
||||
* @param bodyStructureDto 身体部位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditBodyStructure(BodyStructureDto bodyStructureDto) {
|
||||
|
||||
// 新增身体部位信息
|
||||
BodyStructure bodyStructure = new BodyStructure();
|
||||
BeanUtils.copyProperties(bodyStructureDto, bodyStructure);
|
||||
|
||||
// 拼音码
|
||||
bodyStructure.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(bodyStructureDto.getName()));
|
||||
// 五笔码
|
||||
bodyStructure.setWbStr(ChineseConvertUtils.toWBFirstLetter(bodyStructureDto.getName()));
|
||||
|
||||
if (bodyStructureDto.getId() != null) {
|
||||
// 更新身体部位信息
|
||||
bodyStructureService.updateById(bodyStructure);
|
||||
} else {
|
||||
bodyStructure.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
// 采番bus_no三位
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.BODY_STRUCTURE_NO.getPrefix(), 3);
|
||||
// 如果传了上级部位 把当前的code拼到后边
|
||||
if (StringUtils.isNotEmpty(bodyStructure.getBusNo())) {
|
||||
bodyStructure.setBusNo(String.format(CommonConstants.Common.MONTAGE_FORMAT, bodyStructure.getBusNo(),
|
||||
CommonConstants.Common.POINT, code));
|
||||
} else {
|
||||
bodyStructure.setBusNo(code);
|
||||
}
|
||||
// 生成待发送的机构信息
|
||||
bodyStructureService.save(bodyStructure);
|
||||
}
|
||||
// 返回身体部位id
|
||||
return R.ok(bodyStructure.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"身体部位信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除身体部位
|
||||
*
|
||||
* @param id 身体部位id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteBodyStructure(String id) {
|
||||
|
||||
List<Long> orgIdList = new ArrayList<>();
|
||||
if (id != null) {
|
||||
orgIdList = Arrays.stream(id.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 删除身体部位信息
|
||||
boolean deleteOrgSuccess = bodyStructureService.removeByIds(orgIdList);
|
||||
return deleteOrgSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"身体部位信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"身体部位信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 身体部位列表启用
|
||||
*
|
||||
* @param id 身体部位列表信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> activeBodyStructure(Long id) {
|
||||
// 机构启用
|
||||
boolean result = bodyStructureService.activeBodyStructure(id);
|
||||
return result
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"身体部位信息启用"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"身体部位信息启用"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 身体部位列表停用
|
||||
*
|
||||
* @param id 身体部位列表信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> inactiveBodyStructure(Long id) {
|
||||
// 机构停用
|
||||
boolean result = bodyStructureService.inactiveBodyStructure(id);
|
||||
return result
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"身体部位信息停用"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"身体部位信息停用"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.*;
|
||||
import com.openhis.administration.domain.EncounterLocation;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.mapper.LocationMapper;
|
||||
import com.openhis.administration.service.IEncounterLocationService;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IPractitionerRoleService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.ILocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.*;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
|
||||
@Service
|
||||
public class LocationAppServiceImpl implements ILocationAppService {
|
||||
|
||||
@Resource
|
||||
private ILocationService locationService;
|
||||
|
||||
@Resource
|
||||
private ICommonService commonService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private LocationMapper locationMapper;
|
||||
|
||||
@Resource
|
||||
private IPractitionerRoleService practitionerRoleService;
|
||||
|
||||
@Resource
|
||||
private IEncounterLocationService encounterLocationService;
|
||||
|
||||
/**
|
||||
* 位置初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> locationInit() {
|
||||
LocationInitDto initDto = new LocationInitDto();
|
||||
// 位置状态
|
||||
List<LocationInitDto.locationStatusOption> locationStatusOptions = new ArrayList<>();
|
||||
locationStatusOptions.add(new LocationInitDto.locationStatusOption(LocationStatus.ACTIVE.getValue(),
|
||||
LocationStatus.ACTIVE.getInfo()));
|
||||
locationStatusOptions.add(new LocationInitDto.locationStatusOption(LocationStatus.INACTIVE.getValue(),
|
||||
LocationStatus.INACTIVE.getInfo()));
|
||||
initDto.setLocationStatusOptions(locationStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> enableLocation(List<Long> locationIdList) {
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList);
|
||||
if (locationIdList != null && !locationIdList.isEmpty()) {
|
||||
for (Location location : locationList) {
|
||||
if (LocationForm.HOUSE.getValue().equals(location.getFormEnum())
|
||||
|| LocationForm.BED.getValue().equals(location.getFormEnum())) {
|
||||
// 获取父节点的busNo(病区)
|
||||
String parentBusNo =
|
||||
location.getBusNo().substring(0, location.getBusNo().indexOf(CommonConstants.Common.POINT));
|
||||
// 查询所有父集位置
|
||||
List<Location> fatherLocations =
|
||||
locationService.list(new LambdaQueryWrapper<Location>().like(Location::getBusNo, parentBusNo)
|
||||
.in(Location::getFormEnum, LocationForm.WARD.getValue(), LocationForm.HOUSE.getValue()));
|
||||
// 启用所有对应的父节点
|
||||
for (Location fatherLocation : fatherLocations) {
|
||||
fatherLocation.setStatusEnum(LocationStatus.ACTIVE.getValue());
|
||||
locationService.updateLocation(fatherLocation);
|
||||
}
|
||||
// 病床单独设置状态为空闲
|
||||
if (LocationForm.BED.getValue().equals(location.getFormEnum())) {
|
||||
location.setStatusEnum(LocationStatus.IDLE.getValue());
|
||||
locationService.updateLocation(location);
|
||||
}
|
||||
} else {
|
||||
location.setStatusEnum(LocationStatus.ACTIVE.getValue());
|
||||
locationService.updateLocation(location);
|
||||
}
|
||||
}
|
||||
return R.ok("启用成功");
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deactivateLocation(List<Long> locationIdList) {
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList);
|
||||
if (locationIdList != null && !locationIdList.isEmpty()) {
|
||||
for (Location location : locationList) {
|
||||
if (LocationForm.BED.getValue().equals(location.getFormEnum())) {
|
||||
List<EncounterLocation> encounterLocationList =
|
||||
encounterLocationService.getEncounterLocationInfo(null, location.getId());
|
||||
if (encounterLocationList != null && !encounterLocationList.isEmpty()) {
|
||||
return R.fail("有被占用的床位,不可停用");
|
||||
}
|
||||
} else if (LocationForm.HOUSE.getValue().equals(location.getFormEnum())) {
|
||||
// 检查病房下是否有启用的病床
|
||||
List<com.openhis.web.common.dto.LocationDto> activeBeds =
|
||||
commonService.getChildLocation(location.getId(), LocationForm.BED.getValue());
|
||||
if ((activeBeds != null && !activeBeds.isEmpty())) {
|
||||
return R.fail("病房下有启用或被占用的床位,不可停用");
|
||||
}
|
||||
} else if (LocationForm.WARD.getValue().equals(location.getFormEnum())) {
|
||||
// 检查病区下是否有启用的病房
|
||||
List<com.openhis.web.common.dto.LocationDto> activeHouses =
|
||||
commonService.getChildLocation(location.getId(), LocationForm.HOUSE.getValue());
|
||||
if ((activeHouses != null && !activeHouses.isEmpty())) {
|
||||
return R.fail("病区下有启用或被占用的病房,不可停用");
|
||||
}
|
||||
}
|
||||
location.setStatusEnum(LocationStatus.INACTIVE.getValue());
|
||||
locationService.updateLocation(location);
|
||||
}
|
||||
return R.ok("停用成功");
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置信息详情
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @return 位置信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationById(Long locationId) {
|
||||
LocationInfoDto locationInfoDto = new LocationInfoDto();
|
||||
BeanUtils.copyProperties(locationService.getById(locationId), locationInfoDto);
|
||||
// 位置类型
|
||||
locationInfoDto
|
||||
.setFormEnum_enumText(EnumUtils.getInfoByValue(LocationForm.class, locationInfoDto.getFormEnum()));
|
||||
// 使用状态
|
||||
locationInfoDto.setOperationalEnum_enumText(
|
||||
EnumUtils.getInfoByValue(LocationOperational.class, locationInfoDto.getOperationalEnum()));
|
||||
// 启用停用
|
||||
locationInfoDto
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, locationInfoDto.getStatusEnum()));
|
||||
return R.ok(locationInfoDto,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param busNo 位置信息编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteLocation(String busNo) {
|
||||
// 删除位置信息(连同子集)
|
||||
boolean result =
|
||||
locationService.remove(new LambdaQueryWrapper<Location>().likeRight(Location::getBusNo, busNo));
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"位置信息删除"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"位置信息删除"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param locationPageParam 查询条件
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationPage(LocationPageParam locationPageParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 数据初始化,不使用eq条件拼接
|
||||
List<Integer> formList = locationPageParam.getLocationFormList();
|
||||
locationPageParam.setLocationFormList(null);
|
||||
String busNo = locationPageParam.getBusNo();
|
||||
locationPageParam.setBusNo(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<Location> queryWrapper = HisQueryUtils.buildQueryWrapper(locationPageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr,
|
||||
CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
// 根据不同的位置类型查询不同的位置分页信息(前端必传默认值)
|
||||
if (formList != null && !formList.isEmpty()) {
|
||||
queryWrapper.lambda().in(Location::getFormEnum, formList);
|
||||
}
|
||||
// 根据父节点编码查询子项
|
||||
queryWrapper.lambda().likeRight(StringUtils.isNotNull(busNo), Location::getBusNo, busNo);
|
||||
if (locationPageParam.getFormEnum() != null) {
|
||||
queryWrapper.lambda().eq(Location::getFormEnum, locationPageParam.getFormEnum());
|
||||
}
|
||||
|
||||
// 查询位置分页列表
|
||||
Page<LocationInfoDto> locationPage =
|
||||
HisPageUtils.selectPage(locationMapper, queryWrapper, pageNo, pageSize, LocationInfoDto.class);
|
||||
locationPage.getRecords().forEach(e -> {
|
||||
// 位置类型
|
||||
e.setFormEnum_enumText(EnumUtils.getInfoByValue(LocationForm.class, e.getFormEnum()));
|
||||
// 使用状态
|
||||
e.setOperationalEnum_enumText(EnumUtils.getInfoByValue(LocationOperational.class, e.getOperationalEnum()));
|
||||
// 启用停用
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
return R.ok(locationPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
location.setFormEnum(Integer.valueOf(locationAddOrEditDto.getFormEnum()));
|
||||
// 新增病床设置状态为空闲
|
||||
if (LocationForm.BED.getValue().equals(Integer.valueOf(locationAddOrEditDto.getFormEnum()))) {
|
||||
location.setStatusEnum(LocationStatus.IDLE.getValue());
|
||||
}
|
||||
// 拼音码
|
||||
location.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 五笔码
|
||||
location.setWbStr(ChineseConvertUtils.toWBFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 采番bus_no三位
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.LOCATION_BUS_NO.getPrefix(), 3);
|
||||
// 如果传了上级 把当前的code拼到后边
|
||||
if (StringUtils.isNotEmpty(location.getBusNo())) {
|
||||
location.setBusNo(String.format(CommonConstants.Common.MONTAGE_FORMAT, location.getBusNo(),
|
||||
CommonConstants.Common.POINT, code));
|
||||
} else {
|
||||
location.setBusNo(code);
|
||||
}
|
||||
boolean result = locationService.addLocation(location);
|
||||
if (result) {
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"库房"}));
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> editLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
// 拼音码
|
||||
location.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 五笔码
|
||||
location.setWbStr(ChineseConvertUtils.toWBFirstLetter(locationAddOrEditDto.getName()));
|
||||
boolean result = locationService.updateLocation(location);
|
||||
if (result) {
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"库房"}));
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表-树型
|
||||
*
|
||||
* @param formList 类型
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param isInHospital 是否住院
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationTree(List<Integer> formList, Integer pageNo, Integer pageSize, String isInHospital) {
|
||||
|
||||
LambdaQueryWrapper<Location> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (formList != null && !formList.isEmpty()) {
|
||||
queryWrapper.in(Location::getFormEnum, formList);
|
||||
}
|
||||
if (Whether.YES.getCode().equals(isInHospital)) {
|
||||
// 当前登录者的id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
List<Long> locationIds = practitionerRoleService.getLocationIdsByPractitionerId(practitionerId);
|
||||
queryWrapper.in(Location::getId, locationIds);
|
||||
}
|
||||
// 查询位置列表
|
||||
Page<Location> page = locationService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
List<Location> locationList = page.getRecords();
|
||||
// 将位置列表转为树结构
|
||||
List<LocationDto> locationTree = buildTree(locationList);
|
||||
Page<LocationDto> locationQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
locationQueryDtoPage.setRecords(locationTree);
|
||||
|
||||
locationQueryDtoPage.getRecords().forEach(e -> {
|
||||
// 物理形式枚举回显赋值
|
||||
e.setFormEnum_enumText(EnumUtils.getInfoByValue(LocationForm.class, e.getFormEnum()));
|
||||
// 状态编码回显赋值
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, e.getStatusEnum()));
|
||||
// 操作状态回显赋值
|
||||
e.setOperationalEnum_enumText(EnumUtils.getInfoByValue(LocationBedStatus.class, e.getOperationalEnum()));
|
||||
// 模式编码回显赋值
|
||||
e.setModeEnum_enumText(EnumUtils.getInfoByValue(LocationMode.class, e.getModeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(locationQueryDtoPage,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将位置列表转换为树结构
|
||||
*
|
||||
* @param records 位置列表
|
||||
* @return tree
|
||||
*/
|
||||
private List<LocationDto> buildTree(List<Location> records) {
|
||||
// 按b_no的层级排序,确保父节点先处理
|
||||
List<Location> sortedRecords = records.stream()
|
||||
.sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList());
|
||||
|
||||
Map<String, LocationDto> nodeMap = new HashMap<>();
|
||||
List<LocationDto> tree = new ArrayList<>();
|
||||
|
||||
for (Location record : sortedRecords) {
|
||||
String bNo = record.getBusNo();
|
||||
String[] parts = bNo.split("\\.");
|
||||
LocationDto node = new LocationDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
|
||||
if (parts.length == 1) {
|
||||
// 根节点
|
||||
tree.add(node);
|
||||
} else {
|
||||
// 获取父节点的b_no(去掉最后一部分)
|
||||
String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1));
|
||||
LocationDto parent = nodeMap.get(parentBNo);
|
||||
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
} else {
|
||||
// 处理父节点不存在的情况(例如数据缺失)
|
||||
// 可根据需求调整为将节点加入根或抛出异常
|
||||
tree.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
@Service
|
||||
public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 查询机构列表
|
||||
Page<Organization> page = organizationService.page(new Page<>(pageNo, pageSize));
|
||||
List<Organization> organizationList = page.getRecords();
|
||||
// 将机构列表转为树结构
|
||||
List<OrganizationDto> orgTree = buildTree(organizationList);
|
||||
Page<OrganizationDto> orgQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
orgQueryDtoPage.setRecords(orgTree);
|
||||
return orgQueryDtoPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将机构列表转换为树结构
|
||||
*
|
||||
* @param records 机构列表
|
||||
* @return tree
|
||||
*/
|
||||
private List<OrganizationDto> buildTree(List<Organization> records) {
|
||||
// 按b_no的层级排序,确保父节点先处理
|
||||
List<Organization> sortedRecords = records.stream()
|
||||
.sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList());
|
||||
|
||||
Map<String, OrganizationDto> nodeMap = new HashMap<>();
|
||||
List<OrganizationDto> tree = new ArrayList<>();
|
||||
|
||||
for (Organization record : sortedRecords) {
|
||||
String bNo = record.getBusNo();
|
||||
String[] parts = bNo.split("\\.");
|
||||
OrganizationDto node = new OrganizationDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
node.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, node.getTypeEnum()));
|
||||
node.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, node.getClassEnum()));
|
||||
node.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, node.getActiveFlag()));
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
|
||||
if (parts.length == 1) {
|
||||
// 根节点
|
||||
tree.add(node);
|
||||
} else {
|
||||
// 获取父节点的b_no(去掉最后一部分)
|
||||
String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1));
|
||||
OrganizationDto parent = nodeMap.get(parentBNo);
|
||||
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
} else {
|
||||
// 处理父节点不存在的情况(例如数据缺失)
|
||||
// 可根据需求调整为将节点加入根或抛出异常
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构信息详情
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 机构信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgInfo(Long orgId) {
|
||||
Organization organization = organizationService.getById(orgId);
|
||||
return R.ok(organization, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑机构
|
||||
*
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditOrganization(OrganizationDto organizationDto) {
|
||||
|
||||
// 新增organization信息
|
||||
Organization organization = new Organization();
|
||||
BeanUtils.copyProperties(organizationDto, organization);
|
||||
|
||||
if (organizationDto.getId() != null) {
|
||||
// 更新机构信息
|
||||
organizationService.updateById(organization);
|
||||
} else {
|
||||
// 活动标识:有效
|
||||
organization.setActiveFlag(AccountStatus.ACTIVE.getValue());
|
||||
// 采番bus_no三位
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.ORGANIZATION_BUS_NO.getPrefix(), 3);
|
||||
// 如果传了上级科室 把当前的code拼到后边
|
||||
if (StringUtils.isNotEmpty(organization.getBusNo())) {
|
||||
organization.setBusNo(String.format(CommonConstants.Common.MONTAGE_FORMAT, organization.getBusNo(),
|
||||
CommonConstants.Common.POINT, code));
|
||||
} else {
|
||||
organization.setBusNo(code);
|
||||
}
|
||||
// 生成待发送的机构信息
|
||||
organizationService.save(organization);
|
||||
}
|
||||
// 返回机构id
|
||||
return R.ok(organization.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构
|
||||
*
|
||||
* @param orgIds 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOrganization(String orgIds) {
|
||||
|
||||
List<Long> orgIdList = new ArrayList<>();
|
||||
if (orgIds != null) {
|
||||
orgIdList = Arrays.stream(orgIds.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 删除机构信息
|
||||
boolean deleteOrgSuccess = organizationService.removeByIds(orgIdList);
|
||||
return deleteOrgSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构启用
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> activeOrg(Long orgId) {
|
||||
// 机构启用
|
||||
boolean result = organizationService.activeOrg(orgId);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息启用"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息启用"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构停用
|
||||
*
|
||||
* @param orgId 机构信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> inactiveOrg(Long orgId) {
|
||||
// 机构停用
|
||||
boolean result = organizationService.inactiveOrg(orgId);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息停用"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息停用"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.OrganizationLocation;
|
||||
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationLocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.LocationForm;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocInitDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
@Service
|
||||
public class OrganizationLocationAppServiceImpl implements IOrganizationLocationAppService {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
|
||||
@Autowired
|
||||
private OrganizationLocationMapper organizationLocationMapper;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationLocationService organizationLocationService;
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> organizationLocationInit() {
|
||||
OrgLocInitDto initDto = new OrgLocInitDto();
|
||||
// 位置类型
|
||||
List<OrgLocInitDto.locationFormOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions
|
||||
.add(new OrgLocInitDto.locationFormOption(LocationForm.CABINET.getValue(), LocationForm.CABINET.getInfo()));
|
||||
chargeItemStatusOptions.add(
|
||||
new OrgLocInitDto.locationFormOption(LocationForm.PHARMACY.getValue(), LocationForm.PHARMACY.getInfo()));
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||
List<OrgLocInitDto.departmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new OrgLocInitDto.departmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setLocationFormOptions(chargeItemStatusOptions).setDepartmentOptions(organizationOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationListByForm(Integer locationForm) {
|
||||
|
||||
OrgLocInitDto orgLocInitDto = new OrgLocInitDto();
|
||||
List<Location> locationList = new ArrayList<>();
|
||||
if (LocationForm.CABINET.getValue().equals(locationForm)) {
|
||||
locationList = locationService.getCabinetList();
|
||||
} else if (LocationForm.PHARMACY.getValue().equals(locationForm)) {
|
||||
locationList = locationService.getPharmacyList();
|
||||
}
|
||||
List<OrgLocInitDto.locationOption> locationOptions = locationList.stream()
|
||||
.map(location -> new OrgLocInitDto.locationOption(location.getId(), location.getName()))
|
||||
.collect(Collectors.toList());
|
||||
orgLocInitDto.setLocationOptions(locationOptions);
|
||||
return R.ok(orgLocInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置关系分页列表
|
||||
*
|
||||
* @param orgLocQueryParam 查询字段
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrganizationLocation> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(orgLocQueryParam, null, null, request);
|
||||
// 查询机构位置分页列表
|
||||
Page<OrgLocQueryDto> orgLocQueryDtoPage =
|
||||
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
|
||||
return R.ok(orgLocQueryDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑机构位置信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto) {
|
||||
|
||||
OrganizationLocation orgLoc = new OrganizationLocation();
|
||||
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
||||
|
||||
if (orgLocQueryDto.getId() != null) {
|
||||
// 更新机构位置信息
|
||||
organizationLocationService.updateById(orgLoc);
|
||||
} else {
|
||||
// 新增机构位置信息
|
||||
organizationLocationService.save(orgLoc);
|
||||
}
|
||||
// 返回机构位置id
|
||||
return R.ok(orgLoc.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构位置信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构位置
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOrgLoc(Long orgLocId) {
|
||||
// 删除机构位置信息
|
||||
boolean deleteOrgLocSuccess = organizationLocationService.removeById(orgLocId);
|
||||
return deleteOrgLocSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构位置信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构位置信息"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,435 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.system.service.ISysTenantService;
|
||||
import com.openhis.administration.domain.BizUser;
|
||||
import com.openhis.administration.domain.BizUserRole;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.domain.PractitionerRole;
|
||||
import com.openhis.administration.service.IBizUserRoleService;
|
||||
import com.openhis.administration.service.IBizUserService;
|
||||
import com.openhis.administration.service.IPractitionerRoleService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
import com.openhis.common.enums.PractitionerRoles;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRolesDto;
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
import com.openhis.web.basedatamanage.mapper.PractitionerAppAppMapper;
|
||||
|
||||
@Service
|
||||
public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
|
||||
@Resource
|
||||
PractitionerAppAppMapper practitionerAppAppMapper;
|
||||
|
||||
@Resource
|
||||
IBizUserService iBizUserService;
|
||||
|
||||
@Resource
|
||||
IBizUserRoleService iBizUserRoleService;
|
||||
|
||||
@Resource
|
||||
IPractitionerService iPractitionerService;
|
||||
|
||||
@Resource
|
||||
IPractitionerRoleService iPractitionerRoleService;
|
||||
|
||||
@Resource
|
||||
ISysTenantService sysTenantService;
|
||||
|
||||
/**
|
||||
* 新增用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveUserPractitioner(UserAndPractitionerDto userAndPractitionerDto) {
|
||||
String userName = userAndPractitionerDto.getUserName();
|
||||
String nickName = userAndPractitionerDto.getNickName();
|
||||
String phonenumber = userAndPractitionerDto.getPhonenumber();
|
||||
String pharPracCertNo = userAndPractitionerDto.getPharPracCertNo(); // 职业证件编号
|
||||
String sex = userAndPractitionerDto.getSex();
|
||||
// 账号唯一性
|
||||
long count = iBizUserService.count(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserName, userName));
|
||||
if (count > 0L) {
|
||||
return R.fail(null, "账号已存在");
|
||||
}
|
||||
// 新增 sys_user
|
||||
BizUser bizUser = new BizUser();
|
||||
bizUser.setUserName(userName); // 账号
|
||||
bizUser.setNickName(nickName); // 昵称
|
||||
bizUser.setEmail(userAndPractitionerDto.getEmail());// 邮箱
|
||||
bizUser.setPhonenumber(phonenumber); // 电话
|
||||
bizUser.setSex(sex); // 性别
|
||||
bizUser.setPassword(SecurityUtils.encryptPassword(userAndPractitionerDto.getPassword())); // 密码
|
||||
bizUser.setStatus(userAndPractitionerDto.getStatus()); // 状态
|
||||
bizUser.setRemark(userAndPractitionerDto.getRemark()); // 备注
|
||||
iBizUserService.save(bizUser);
|
||||
Long userId =
|
||||
iBizUserService.getOne(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserName, userName)).getUserId(); // 用户id
|
||||
|
||||
// 初始化租户绑定
|
||||
sysTenantService.initTenantBind(userId);
|
||||
|
||||
// 新增 sys_user_role
|
||||
List<PractitionerRolesDto> practitionerRoleDtoList = userAndPractitionerDto.getPractitionerRolesDtoList();
|
||||
BizUserRole bizUserRole;
|
||||
for (PractitionerRolesDto practitionerRolesDto : practitionerRoleDtoList) {
|
||||
bizUserRole = new BizUserRole();
|
||||
bizUserRole.setUserId(userId);
|
||||
bizUserRole.setRoleId(practitionerRolesDto.getRoleId());
|
||||
iBizUserRoleService.save(bizUserRole);
|
||||
}
|
||||
// 新增 adm_practitioner
|
||||
Practitioner practitioner = new Practitioner();
|
||||
practitioner.setActiveFlag(AccountStatus.ACTIVE.getValue()); // 活动标记
|
||||
practitioner.setName(nickName); // 姓名
|
||||
practitioner.setGenderEnum(Integer.parseInt(sex)); // 性别
|
||||
practitioner.setBirthDate(userAndPractitionerDto.getBirthDate()); // 出生日期
|
||||
practitioner.setPhone(phonenumber); // 电话
|
||||
practitioner.setAddress(userAndPractitionerDto.getAddress()); // 地址
|
||||
practitioner.setYbNo(userAndPractitionerDto.getYbNo()); // 医保码
|
||||
practitioner.setUserId(userId); // 系统用户id
|
||||
// 责任科室
|
||||
List<PractitionerOrgAndLocationDto> responsibilityOrgDtoList =
|
||||
userAndPractitionerDto.getResponsibilityOrgDtoList();
|
||||
practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id
|
||||
practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码
|
||||
practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码
|
||||
practitioner.setPharPracCertNo(pharPracCertNo); // 职业证件编号
|
||||
iPractitionerService.save(practitioner);
|
||||
Long practitionerId = practitioner.getId();// 参与者id
|
||||
// 新增 adm_practitioner_role
|
||||
PractitionerRole practitionerRole;
|
||||
// 1.责任科室
|
||||
for (PractitionerOrgAndLocationDto responsibilityOrgDto : responsibilityOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setOrgId(responsibilityOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 2.医生出诊科室
|
||||
List<PractitionerOrgAndLocationDto> doctorVisitOrgDtoList = userAndPractitionerDto.getDoctorVisitOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto doctorVisitOrgDto : doctorVisitOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.DOCTOR.getCode());// 角色code
|
||||
practitionerRole.setOrgId(doctorVisitOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 3.管理库房
|
||||
List<PractitionerOrgAndLocationDto> manageLocationDtoList = userAndPractitionerDto.getManageLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageLocationDto : manageLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 4.管理药房
|
||||
List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList =
|
||||
userAndPractitionerDto.getManageMedicationLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto practitionerOrgAndLocationDto : manageMedicationLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.PHARMACIST.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(practitionerOrgAndLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理科室集合
|
||||
List<PractitionerOrgAndLocationDto> manageOrgDtoList = userAndPractitionerDto.getManageOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageOrgDto : manageOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode());// 角色code
|
||||
practitionerRole.setOrgId(manageOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理病区集合
|
||||
List<PractitionerOrgAndLocationDto> manageWardLocationDtoList =
|
||||
userAndPractitionerDto.getManageWardLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageWardLocationDto : manageWardLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageWardLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"人员信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 用户及参与者
|
||||
*/
|
||||
@Override
|
||||
public IPage<UserAndPractitionerDto> getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto,
|
||||
String searchKey, Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<UserAndPractitionerDto> queryWrapper = HisQueryUtils.buildQueryWrapper(userAndPractitionerDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("user_name", "nick_name", "py_str", "wb_str")), null);
|
||||
queryWrapper.orderByDesc("user_id");
|
||||
IPage<UserAndPractitionerDto> userPractitionerPage =
|
||||
practitionerAppAppMapper.getUserPractitionerPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
List<UserAndPractitionerDto> records = userPractitionerPage.getRecords();
|
||||
// 参与者id集合
|
||||
List<Long> practitionerIdList =
|
||||
records.stream().map(UserAndPractitionerDto::getPractitionerId).collect(Collectors.toList());
|
||||
// 角色集合
|
||||
List<PractitionerRolesDto> practitionerRolesDtoList =
|
||||
practitionerAppAppMapper.getPractitionerRolesDtoList(practitionerIdList);
|
||||
// 科室和位置
|
||||
List<PractitionerOrgAndLocationDto> orgAndLocationDtoList =
|
||||
practitionerAppAppMapper.getOrgAndLocationDtoList(practitionerIdList);
|
||||
for (UserAndPractitionerDto record : records) {
|
||||
// 匹配角色
|
||||
List<PractitionerRolesDto> list1 = practitionerRolesDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())).collect(Collectors.toList());
|
||||
record.setPractitionerRolesDtoList(list1);
|
||||
// 匹配责任科室
|
||||
List<PractitionerOrgAndLocationDto> list2 = orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId()) && "".equals(e.getRoleCode()))
|
||||
.collect(Collectors.toList());
|
||||
record.setResponsibilityOrgDtoList(list2);
|
||||
// 匹配医生出诊科室
|
||||
List<PractitionerOrgAndLocationDto> list3 =
|
||||
orgAndLocationDtoList.stream().filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.DOCTOR.getCode().equals(e.getRoleCode())).collect(Collectors.toList());
|
||||
record.setDoctorVisitOrgDtoList(list3);
|
||||
// 匹配管理库房
|
||||
List<PractitionerOrgAndLocationDto> list4 =
|
||||
orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.LOCATION_ADMIN.getCode().equals(e.getRoleCode()))
|
||||
.collect(Collectors.toList());
|
||||
record.setManageLocationDtoList(list4);
|
||||
// 匹配管理药房
|
||||
List<
|
||||
PractitionerOrgAndLocationDto> list5 =
|
||||
orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.PHARMACIST.getCode().equals(e.getRoleCode()))
|
||||
.collect(Collectors.toList());
|
||||
record.setManageMedicationLocationDtoList(list5);
|
||||
// 匹配护士-管理科室
|
||||
List<PractitionerOrgAndLocationDto> list6 = orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.NURSE.getCode().equals(e.getRoleCode()) && e.getOrgId() != null)
|
||||
.collect(Collectors.toList());
|
||||
record.setManageOrgDtoList(list6);
|
||||
// 匹配护士-管理病区
|
||||
List<PractitionerOrgAndLocationDto> list7 = orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.NURSE.getCode().equals(e.getRoleCode()) && e.getLocationId() != null)
|
||||
.collect(Collectors.toList());
|
||||
record.setManageWardLocationDtoList(list7);
|
||||
}
|
||||
return userPractitionerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户及参与者 : 登录账号和密码不允许编辑
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> editUserPractitioner(UserAndPractitionerDto userAndPractitionerDto) {
|
||||
Long userId = userAndPractitionerDto.getUserId(); // 系统用户id
|
||||
Long practitionerId = userAndPractitionerDto.getPractitionerId(); // 参与者id
|
||||
|
||||
String nickName = userAndPractitionerDto.getNickName();
|
||||
String phonenumber = userAndPractitionerDto.getPhonenumber();
|
||||
String sex = userAndPractitionerDto.getSex();
|
||||
String pharPracCertNo = userAndPractitionerDto.getPharPracCertNo(); // 职业证件编号
|
||||
// 编辑 sys_user
|
||||
BizUser bizUser = new BizUser();
|
||||
bizUser.setNickName(nickName); // 昵称
|
||||
bizUser.setEmail(userAndPractitionerDto.getEmail());// 邮箱
|
||||
bizUser.setPhonenumber(phonenumber); // 电话
|
||||
bizUser.setSex(sex); // 性别
|
||||
bizUser.setStatus(userAndPractitionerDto.getStatus()); // 状态
|
||||
bizUser.setRemark(userAndPractitionerDto.getRemark()); // 备注
|
||||
iBizUserService.update(bizUser, new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||
// 先删除,再新增 sys_user_role
|
||||
practitionerAppAppMapper.delUserRole(userId);
|
||||
List<PractitionerRolesDto> practitionerRoleDtoList = userAndPractitionerDto.getPractitionerRolesDtoList();
|
||||
BizUserRole bizUserRole;
|
||||
for (PractitionerRolesDto practitionerRolesDto : practitionerRoleDtoList) {
|
||||
bizUserRole = new BizUserRole();
|
||||
bizUserRole.setUserId(userId);
|
||||
bizUserRole.setRoleId(practitionerRolesDto.getRoleId());
|
||||
iBizUserRoleService.save(bizUserRole);
|
||||
}
|
||||
// 编辑 adm_practitioner
|
||||
Practitioner practitioner = new Practitioner();
|
||||
practitioner.setId(practitionerId);
|
||||
practitioner.setName(nickName); // 姓名
|
||||
practitioner.setGenderEnum(Integer.parseInt(sex)); // 性别
|
||||
practitioner.setBirthDate(userAndPractitionerDto.getBirthDate()); // 出生日期
|
||||
practitioner.setPhone(phonenumber); // 电话
|
||||
practitioner.setAddress(userAndPractitionerDto.getAddress()); // 地址
|
||||
practitioner.setYbNo(userAndPractitionerDto.getYbNo()); // 医保码
|
||||
practitioner.setUserId(userId); // 系统用户id
|
||||
// 责任科室
|
||||
List<PractitionerOrgAndLocationDto> responsibilityOrgDtoList =
|
||||
userAndPractitionerDto.getResponsibilityOrgDtoList();
|
||||
practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id
|
||||
practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码
|
||||
practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码
|
||||
practitioner.setPharPracCertNo(pharPracCertNo);// 职业证件编号
|
||||
iPractitionerService.updateById(practitioner);
|
||||
// 先删除,再新增 adm_practitioner_role
|
||||
practitionerAppAppMapper.delPractitionerRole(practitionerId);
|
||||
PractitionerRole practitionerRole;
|
||||
// 1.责任科室
|
||||
for (PractitionerOrgAndLocationDto responsibilityOrgDto : responsibilityOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setOrgId(responsibilityOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 2.医生出诊科室
|
||||
List<PractitionerOrgAndLocationDto> doctorVisitOrgDtoList = userAndPractitionerDto.getDoctorVisitOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto doctorVisitOrgDto : doctorVisitOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.DOCTOR.getCode());// 角色code
|
||||
practitionerRole.setOrgId(doctorVisitOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 3.管理库房
|
||||
List<PractitionerOrgAndLocationDto> manageLocationDtoList = userAndPractitionerDto.getManageLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageLocationDto : manageLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 4.管理药房
|
||||
List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList =
|
||||
userAndPractitionerDto.getManageMedicationLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto practitionerOrgAndLocationDto : manageMedicationLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.PHARMACIST.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(practitionerOrgAndLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理科室集合
|
||||
List<PractitionerOrgAndLocationDto> manageOrgDtoList = userAndPractitionerDto.getManageOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageOrgDto : manageOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode());// 角色code
|
||||
practitionerRole.setOrgId(manageOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理病区集合
|
||||
List<PractitionerOrgAndLocationDto> manageWardLocationDtoList =
|
||||
userAndPractitionerDto.getManageWardLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageWardLocationDto : manageWardLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageWardLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"人员信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户及参与者 ; admin不允许删除
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> delUserPractitioner(Long userId) {
|
||||
if (1L == userId) {
|
||||
return R.fail(null, "admin不允许删除");
|
||||
}
|
||||
iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||
practitionerAppAppMapper.delUserRole(userId);
|
||||
Practitioner one =
|
||||
iPractitionerService.getOne(new LambdaQueryWrapper<Practitioner>().eq(Practitioner::getUserId, userId));
|
||||
Long practitionerId = one.getId();// 参与者id
|
||||
iPractitionerService.removeById(practitionerId);
|
||||
iPractitionerRoleService
|
||||
.remove(new LambdaQueryWrapper<PractitionerRole>().eq(PractitionerRole::getPractitionerId, practitionerId));
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"人员信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
@Override
|
||||
public List<SelectableOrgDto> getSelectableOrgList() {
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
return practitionerAppAppMapper.getSelectableOrgList(practitionerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> switchOrg(Long orgId) {
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
Practitioner practitioner = new Practitioner();
|
||||
practitioner.setId(practitionerId);
|
||||
practitioner.setOrgId(orgId);
|
||||
iPractitionerService.updateById(practitioner);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"切换科室"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.PractitionerRole;
|
||||
import com.openhis.administration.mapper.PractitionerRoleMapper;
|
||||
import com.openhis.administration.service.IPractitionerRoleService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerRoleAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||
|
||||
@Service
|
||||
public class PractitionerRoleAppServiceImpl implements IPractitionerRoleAppService {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerRoleService practitionerRoleService;
|
||||
@Autowired
|
||||
private PractitionerRoleMapper practitionerRoleMapper;
|
||||
|
||||
@Override
|
||||
public R<?> getPractitionerPage(PractRoleSearchParam practRoleSearchParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PractitionerRole> queryWrapper = HisQueryUtils.buildQueryWrapper(practRoleSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("name")), request);
|
||||
|
||||
// 查询岗位分页列表
|
||||
Page<PractitionerRoleDto> practitionerRoleDtoPage =
|
||||
HisPageUtils.selectPage(practitionerRoleMapper, queryWrapper, pageNo, pageSize, PractitionerRoleDto.class);
|
||||
|
||||
return R.ok(practitionerRoleDtoPage,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"岗位信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位信息详情
|
||||
*
|
||||
* @param practitionerRoleId 岗位信息id
|
||||
* @return 岗位信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPractitionerRoleById(Long practitionerRoleId) {
|
||||
PractitionerRole practitionerRole = practitionerRoleService.getById(practitionerRoleId);
|
||||
if (practitionerRole != null) {
|
||||
return R.ok(practitionerRole,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"岗位信息"}));
|
||||
} else {
|
||||
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"岗位信息查询失败"}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑岗位信息
|
||||
*
|
||||
* @param practitionerRoleDto 岗位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditPractitionerRole(PractitionerRoleDto practitionerRoleDto) {
|
||||
|
||||
PractitionerRole practitionerRole = new PractitionerRole();
|
||||
BeanUtils.copyProperties(practitionerRoleDto, practitionerRole);
|
||||
// if (practitionerRole.getRoleCode() == null) {
|
||||
// return R.fail(PromptMsgConstant.Common.M00007, "角色编码不能为空");
|
||||
// }
|
||||
// if (practitionerRole.getOrgId() == null) {
|
||||
// return R.fail(PromptMsgConstant.Common.M00007, "科室不能为空");
|
||||
// }
|
||||
// if (practitionerRole.getLocationId() == null) {
|
||||
// return R.fail(PromptMsgConstant.Common.M00007, "位置不能为空");
|
||||
// }
|
||||
|
||||
if (practitionerRoleDto.getId() != null) {
|
||||
// 更新岗位信息
|
||||
practitionerRoleService.updateById(practitionerRole);
|
||||
} else {
|
||||
// 新增岗位信息
|
||||
// practitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
|
||||
// 返回岗位id
|
||||
return R.ok(practitionerRole.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"岗位信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*
|
||||
* @param practitionerRoleId 岗位信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deletePractitionerRole(Long practitionerRoleId) {
|
||||
// 删除岗位信息
|
||||
boolean deletePractitionerRole = practitionerRoleService.removeById(practitionerRoleId);
|
||||
return deletePractitionerRole
|
||||
? R.ok(practitionerRoleId,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"岗位信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"岗位信息"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.basedatamanage.appservice.IBodyStructureAppService;
|
||||
import com.openhis.web.basedatamanage.dto.BodyStructureDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 身体部位管理controller
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/body-structure")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class BodyStructureController {
|
||||
|
||||
private final IBodyStructureAppService bodyStructureService;
|
||||
|
||||
/**
|
||||
* 身体部位分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 身体部位分页列表
|
||||
*/
|
||||
@GetMapping(value = "/body")
|
||||
public R<?> getBodyStructurePage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest request) {
|
||||
Page<BodyStructureDto> bodyStructureTree = bodyStructureService.getBodyStructureTree(pageNo, pageSize, request);
|
||||
return R.ok(bodyStructureTree,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"身体部位信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取身体部位需要编辑的信息
|
||||
*
|
||||
* @param id 身体部位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping("/body-getById")
|
||||
public R<?> getOrgInfo(@Validated @RequestParam Long id) {
|
||||
return bodyStructureService.getBodyStructureInfo(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑身体部位
|
||||
*
|
||||
* @param bodyStructureDto 身体部位信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/body")
|
||||
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody BodyStructureDto bodyStructureDto) {
|
||||
return bodyStructureService.addOrEditBodyStructure(bodyStructureDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除身体部位
|
||||
*
|
||||
* @param ids 需要删除的Id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/body")
|
||||
public R<?> deleteBodyStructure(@RequestParam String ids) {
|
||||
return bodyStructureService.deleteBodyStructure(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 身体部位启用
|
||||
*
|
||||
* @param id 启用数据的Id
|
||||
* @return 操作结果
|
||||
*
|
||||
*/
|
||||
@PutMapping("/body-active")
|
||||
public R<?> activeBodyStructure(@RequestParam Long id) {
|
||||
return bodyStructureService.activeBodyStructure(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 身体部位停用
|
||||
*
|
||||
* @param id 停用数据的Id
|
||||
* @return 操作结果
|
||||
*
|
||||
*/
|
||||
@PutMapping("/body-inactive")
|
||||
public R<?> inactiveBodyStructure(@RequestParam Long id) {
|
||||
return bodyStructureService.inactiveBodyStructure(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.Frequency;
|
||||
import com.openhis.administration.service.IFrequencyService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.FrequencyDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationInitDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 频次信息管理controller
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/personalization/frequency")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class FrequencyController {
|
||||
|
||||
private final IFrequencyService frequencyService;
|
||||
|
||||
/**
|
||||
* 频次详情分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 机构分页列表
|
||||
*/
|
||||
@GetMapping(value = "/getPageList")
|
||||
public R<?> getOrganizationPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, String code,HttpServletRequest request) {
|
||||
Page<Frequency> pageList= frequencyService.getPageList(pageNo, pageSize, code,request) ;
|
||||
return R.ok(pageList,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"频次详情信息"}));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
public R<?> addOrEditFrequency(@Validated @RequestBody FrequencyDto frequencyDto) {
|
||||
// 创建 Frequency 对象
|
||||
Frequency frequency = new Frequency();
|
||||
// 使用 BeanUtils 拷贝属性
|
||||
BeanUtils.copyProperties(frequencyDto, frequency);
|
||||
// 获取并转换 dayTimes 字段
|
||||
List<String> dayTimesList = frequencyDto.getDayTimes();
|
||||
if (dayTimesList != null && !dayTimesList.isEmpty()) {
|
||||
Collections.sort(dayTimesList);
|
||||
String dayTimesStr = String.join(",", dayTimesList); // 转换为逗号分隔的字符串
|
||||
frequency.setDayTimes(dayTimesStr); // 将转换后的字符串设置到 Frequency 对象
|
||||
}
|
||||
|
||||
return R.ok(frequencyService.saveOrUpdate(frequency, new LambdaQueryWrapper<Frequency>().eq(Frequency::getRateCode, frequency.getRateCode())),MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"保存频次详情"}));
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
public R<?> deleteFrequency(@PathVariable Long id) {
|
||||
return R.ok(frequencyService.removeById(id),MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"删除频次详情"}));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.ILocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.LocationAddOrEditDto;
|
||||
import com.openhis.web.basedatamanage.dto.LocationPageParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 位置管理Controller业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/location")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class LocationController {
|
||||
|
||||
@Resource
|
||||
private ILocationAppService locationAppService;
|
||||
|
||||
/**
|
||||
* 位置初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return locationAppService.locationInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表-树型
|
||||
*
|
||||
* @param formList 类型
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param isInHospital 是否住院
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@GetMapping(value = "/location-page-tree")
|
||||
public R<?> getLocationPage(@RequestParam List<Integer> formList,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
|
||||
@RequestParam(value = "isInHospital", defaultValue = "0") String isInHospital) {
|
||||
return locationAppService.getLocationTree(formList, pageNo, pageSize, isInHospital);
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param locationPageParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param request 请求
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@GetMapping(value = "/location-page")
|
||||
public R<?> getLocationPage(LocationPageParam locationPageParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return locationAppService.getLocationPage(locationPageParam, searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取位置信息详情
|
||||
*
|
||||
* @param locationId 位置Id
|
||||
* @return 位置信息
|
||||
*/
|
||||
@GetMapping("/location")
|
||||
public R<?> getLocationById(@RequestParam Long locationId) {
|
||||
return locationAppService.getLocationById(locationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/location")
|
||||
public R<?> addLocation(@Validated @RequestBody LocationAddOrEditDto locationAddOrEditDto) {
|
||||
return locationAppService.addLocation(locationAddOrEditDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/location")
|
||||
public R<?> editLocation(@Validated @RequestBody LocationAddOrEditDto locationAddOrEditDto) {
|
||||
return locationAppService.editLocation(locationAddOrEditDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param busNo 位置信息编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/location")
|
||||
public R<?> deleteLocation(@RequestParam String busNo) {
|
||||
return locationAppService.deleteLocation(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/enable")
|
||||
public R<?> enableLocation(@RequestBody List<Long> locationIdList) {
|
||||
return locationAppService.enableLocation(locationIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*
|
||||
* @param locationIdList 位置id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/deactivate")
|
||||
public R<?> deactivateLocation(@RequestBody List<Long> locationIdList) {
|
||||
return locationAppService.deactivateLocation(locationIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationInitDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 机构管理controller
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/organization")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OrganizationController {
|
||||
|
||||
private final IOrganizationAppService iOrganizationAppService;
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return R.ok(new OrganizationInitDto());
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 机构分页列表
|
||||
*/
|
||||
@GetMapping(value = "/organization")
|
||||
public R<?> getOrganizationPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest request) {
|
||||
Page<OrganizationDto> organizationTree = iOrganizationAppService.getOrganizationTree(pageNo, pageSize, request);
|
||||
return R.ok(organizationTree,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构需要编辑的信息
|
||||
*
|
||||
* @param orgId 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping("/organization-getById")
|
||||
public R<?> getOrgInfo(@Validated @RequestParam Long orgId) {
|
||||
return iOrganizationAppService.getOrgInfo(orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑机构信息
|
||||
*
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/organization")
|
||||
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody OrganizationDto organizationDto) {
|
||||
return iOrganizationAppService.addOrEditOrganization(organizationDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构信息
|
||||
*
|
||||
* @param orgIds 需要删除的Id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/organization")
|
||||
public R<?> deleteOrganization(@RequestParam String orgIds) {
|
||||
return iOrganizationAppService.deleteOrganization(orgIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构启用
|
||||
*
|
||||
* @param orgId 启用数据的Id
|
||||
* @return 操作结果
|
||||
*
|
||||
*/
|
||||
@PutMapping("/organization-active")
|
||||
public R<?> activeOrganization(@RequestParam Long orgId) {
|
||||
return iOrganizationAppService.activeOrg(orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构停用
|
||||
*
|
||||
* @param orgId 停用数据的Id
|
||||
* @return 操作结果
|
||||
*
|
||||
*/
|
||||
@PutMapping("/organization-inactive")
|
||||
public R<?> inactiveOrganization(@RequestParam Long orgId) {
|
||||
return iOrganizationAppService.inactiveOrg(orgId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 机构位置关系controller
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/org-loc")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OrganizationLocationController {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationLocationAppService organizationLocationAppService;
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return organizationLocationAppService.organizationLocationInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置关系分页列表
|
||||
*
|
||||
* @param orgLocQueryParam 查询字段
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@GetMapping(value = "/org-loc")
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return organizationLocationAppService.getOrgLocPage(orgLocQueryParam, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@GetMapping(value = "/loc-list")
|
||||
public R<?> getLocationListByForm(@RequestParam Integer locationForm) {
|
||||
return organizationLocationAppService.getLocationListByForm(locationForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/编辑机构位置关系信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置关系信息
|
||||
*/
|
||||
@PostMapping("/org-loc")
|
||||
public R<?> addOrEditOrgLoc(@Validated @RequestBody OrgLocQueryDto orgLocQueryDto) {
|
||||
return organizationLocationAppService.addOrEditOrgLoc(orgLocQueryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机构位置关系信息
|
||||
*
|
||||
* @param orgLocId 主表id
|
||||
*/
|
||||
@DeleteMapping("/org-loc")
|
||||
public R<?> delOrgLoc(@RequestParam Long orgLocId) {
|
||||
return organizationLocationAppService.deleteOrgLoc(orgLocId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 参与者 Controller业务层处理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/practitioner")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PractitionerController {
|
||||
|
||||
private final IPractitionerAppService practitionerAppService;
|
||||
|
||||
/**
|
||||
* 新增用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/user-practitioner")
|
||||
public R<?> saveUserPractitioner(@RequestBody UserAndPractitionerDto userAndPractitionerDto) {
|
||||
return practitionerAppService.saveUserPractitioner(userAndPractitionerDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 用户及参与者
|
||||
*/
|
||||
@GetMapping(value = "/user-practitioner-page")
|
||||
public R<?> getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R
|
||||
.ok(practitionerAppService.getUserPractitionerPage(userAndPractitionerDto, searchKey, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户及参与者详情
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
* @return 用户及参与者详情
|
||||
*/
|
||||
@GetMapping(value = "/user-practitioner-detail")
|
||||
public R<?> getUserPractitionerPage(@RequestParam Long userId) {
|
||||
UserAndPractitionerDto userAndPractitionerDto = new UserAndPractitionerDto();
|
||||
userAndPractitionerDto.setUserId(userId);
|
||||
IPage<UserAndPractitionerDto> userPractitionerPage =
|
||||
practitionerAppService.getUserPractitionerPage(userAndPractitionerDto, "", 1, 1);
|
||||
return R.ok(userPractitionerPage.getRecords().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户及参与者
|
||||
*
|
||||
* @param userAndPractitionerDto 用户及参与者dto
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "/user-practitioner")
|
||||
public R<?> editUserPractitioner(@RequestBody UserAndPractitionerDto userAndPractitionerDto) {
|
||||
return practitionerAppService.editUserPractitioner(userAndPractitionerDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户及参与者 ; admin不允许删除
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
* @return 结果
|
||||
*/
|
||||
@DeleteMapping(value = "/user-practitioner")
|
||||
public R<?> delUserPractitioner(@RequestParam Long userId) {
|
||||
return practitionerAppService.delUserPractitioner(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
@GetMapping(value = "/get-selectable-org-list")
|
||||
public R<?> getSelectableOrgList() {
|
||||
return R.ok(practitionerAppService.getSelectableOrgList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "/switch-org")
|
||||
public R<?> switchOrg(@RequestParam Long orgId) {
|
||||
return practitionerAppService.switchOrg(orgId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerRoleAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractRoleSearchParam;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRoleDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 岗位管理Controller业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/practitioner-role")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PractitionerRoleController {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerRoleAppService practitionerRoleAppService;
|
||||
|
||||
/**
|
||||
* 岗位分页列表
|
||||
*
|
||||
* @param practRoleSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 岗位分页列表
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-role")
|
||||
public R<?> getPractitionerRolePage(PractRoleSearchParam practRoleSearchParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return practitionerRoleAppService.getPractitionerPage(practRoleSearchParam, searchKey, pageNo, pageSize,
|
||||
request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位需要编辑的信息
|
||||
*
|
||||
* @param practitionerRoleId 岗位信息
|
||||
*/
|
||||
@GetMapping("/practitioner-role-getById")
|
||||
public R<?> getPractitionerRoleById(@Validated @RequestParam Long practitionerRoleId) {
|
||||
return practitionerRoleAppService.getPractitionerRoleById(practitionerRoleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑岗位信息
|
||||
*
|
||||
* @param practitionerRoleDto 岗位信息
|
||||
*/
|
||||
@PutMapping("/practitioner-role")
|
||||
public R<?> editPractitionerRole(@Validated @RequestBody PractitionerRoleDto practitionerRoleDto) {
|
||||
return practitionerRoleAppService.addOrEditPractitionerRole(practitionerRoleDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
* @param practitionerRoleId 主表id
|
||||
*/
|
||||
@DeleteMapping("/practitioner-role")
|
||||
public R<?> deletePractitionerRole(@RequestParam Long practitionerRoleId) {
|
||||
return practitionerRoleAppService.deletePractitionerRole(practitionerRoleId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author liuhr
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BodyStructureDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 状态枚举 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 子集合 */
|
||||
private List<BodyStructureDto> children = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/8/25
|
||||
*/
|
||||
@Data
|
||||
public class FrequencyDto {
|
||||
/**
|
||||
* 频次代码,唯一标识与字典表对应
|
||||
*/
|
||||
private String rateCode;
|
||||
|
||||
/**
|
||||
* 频次名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 每天执行的次数
|
||||
*/
|
||||
private Integer dayCount;
|
||||
|
||||
/**
|
||||
* 每次执行之间的间隔(天数)
|
||||
*/
|
||||
private Integer dayInterval;
|
||||
|
||||
/**
|
||||
* 每天的具体执行时间点,逗号分隔
|
||||
*/
|
||||
private List<String> dayTimes;
|
||||
|
||||
/**
|
||||
* 是否周期性每周执行,0 为否,1 为是
|
||||
*/
|
||||
private Integer weekCycleFlag;
|
||||
|
||||
/**
|
||||
* 每周执行的间隔,单位为周
|
||||
*/
|
||||
private Integer weekInterval;
|
||||
|
||||
/**
|
||||
* 每周执行的次数
|
||||
*/
|
||||
private Integer weekTimes;
|
||||
|
||||
/**
|
||||
* 是否为连续执行,0 为否,1 为是
|
||||
*/
|
||||
private Integer continueFlag;
|
||||
|
||||
/**
|
||||
* 执行总次数,记录任务累计执行次数
|
||||
*/
|
||||
private Integer totalExecutionCount;
|
||||
|
||||
/**
|
||||
* 任务执行周期长度
|
||||
*/
|
||||
private Integer executionPeriod;
|
||||
|
||||
/**
|
||||
* 任务执行周期的单位,如 day、week、month
|
||||
*/
|
||||
private String executionPeriodUnit;
|
||||
|
||||
/**
|
||||
* 第三方代码,外部系统使用
|
||||
*/
|
||||
private String thirdCode;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 并发戳,用于版本控制和并发冲突检测
|
||||
*/
|
||||
private Integer concurrencyStamp;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 位置信息新增编辑dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-31
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationAddOrEditDto {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
/** 物理形式枚举 */
|
||||
@NotNull
|
||||
private String formEnum;
|
||||
|
||||
/** 机构编码 */
|
||||
private Long organizationId;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationDto {
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
@NotBlank(message = "位置编码不能为空")
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
@NotBlank(message = "位置名称不能为空")
|
||||
private String name;
|
||||
|
||||
/** 状态编码 */
|
||||
@NotNull(message = "状态编码不能为空")
|
||||
// private LocationStatus statusEnum;
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 操作状态 */
|
||||
@NotNull(message = "操作状态不能为空")
|
||||
// private LocationBedStatus operationalEnum;
|
||||
private Integer operationalEnum;
|
||||
private String operationalEnum_enumText;
|
||||
|
||||
/** 模式编码 */
|
||||
@NotNull(message = "模式编码不能为空")
|
||||
// private LocationMode modeEnum;
|
||||
private Integer modeEnum;
|
||||
private String modeEnum_enumText;
|
||||
|
||||
/** 模式编码 */
|
||||
private String typeCode;
|
||||
|
||||
/** 功能编码 */
|
||||
@NotBlank(message = "功能编码不能为空")
|
||||
private String typeJson;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 物理形式枚举 */
|
||||
@NotNull(message = "物理形式枚举不能为空")
|
||||
// private LocationForm formEnum;
|
||||
private Integer formEnum;
|
||||
private String formEnum_enumText;
|
||||
|
||||
/** 机构编码 */
|
||||
@NotNull(message = "机构编码不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/** 子集合 */
|
||||
private List<LocationDto> children = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 位置信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-31
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationInfoDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 状态编码 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 操作状态 */
|
||||
private Integer operationalEnum;
|
||||
private String operationalEnum_enumText;
|
||||
|
||||
/** 物理形式枚举 */
|
||||
private Integer formEnum;
|
||||
private String formEnum_enumText;
|
||||
|
||||
/** 机构编码 */
|
||||
@Dict(dictCode = "id",dictText = "name",dictTable = "adm_organization")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
private String organizationId_dictText;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 位置信息初始化dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-31
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationInitDto {
|
||||
|
||||
private List<LocationInitDto.locationStatusOption> locationStatusOptions;
|
||||
|
||||
/**
|
||||
* 位置状态
|
||||
*/
|
||||
@Data
|
||||
public static class locationStatusOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public locationStatusOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 位置信息分页查询条件
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-31
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationPageParam {
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 状态编码 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 位置类型 */
|
||||
private Integer formEnum;
|
||||
|
||||
/**
|
||||
* 位置分页默认初始类型(前端传)
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<Integer> locationFormList;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 科室位置关系初始化 dto
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrgLocInitDto {
|
||||
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
private List<OrgLocInitDto.locationFormOption> locationFormOptions;
|
||||
|
||||
/** 科室列表 */
|
||||
private List<OrgLocInitDto.departmentOption> departmentOptions;
|
||||
|
||||
/** 科室列表 */
|
||||
private List<OrgLocInitDto.locationOption> locationOptions;
|
||||
|
||||
/** 位置列表 */
|
||||
@Data
|
||||
public static class locationOption {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public locationOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/** 科室列表 */
|
||||
@Data
|
||||
public static class departmentOption {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public departmentOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
@Data
|
||||
public static class locationFormOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public locationFormOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.sql.Time;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrgLocQueryDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 机构编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
private Long organizationId;
|
||||
private String organizationId_dictText;
|
||||
|
||||
/** 默认药房 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long defLocationId;
|
||||
|
||||
/** 发放类别 */
|
||||
private String distributionCategoryCode;
|
||||
|
||||
/**
|
||||
* 诊疗定义id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "wor_activity_definition")
|
||||
private Long activityDefinitionId;
|
||||
private String activityDefinitionId_dictText;
|
||||
|
||||
/**
|
||||
* 诊疗类型
|
||||
*/
|
||||
@Dict(dictCode = "activity_category_code")
|
||||
private String activityCategoryCode;
|
||||
private String activityCategoryCode_dictText;
|
||||
|
||||
/** 开始时间 */
|
||||
// @JsonFormat(pattern = "HH:mm:ss")
|
||||
private Time startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
// @JsonFormat(pattern = "HH:mm:ss")
|
||||
private Time endTime;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 科室分页查询条件
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrgLocQueryParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 科室id
|
||||
*/
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 药房id
|
||||
*/
|
||||
private Long defLocationId;
|
||||
|
||||
/** 发放类别 */
|
||||
private String distributionCategoryCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrganizationDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 活动标识 */
|
||||
private Integer activeFlag;
|
||||
private String activeFlag_dictText;
|
||||
|
||||
/** 机构类型枚举 */
|
||||
private Integer typeEnum;
|
||||
private String typeEnum_dictText;
|
||||
|
||||
/** 机构分类枚举 */
|
||||
private Integer classEnum;
|
||||
private String classEnum_dictText;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 医保码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 医保名称 */
|
||||
private String ybName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/** 子集合 */
|
||||
private List<OrganizationDto> children = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 科室初始化 dto
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrganizationInitDto {
|
||||
|
||||
private List<OrganizationTypeOption> organizationTypeOptions;
|
||||
|
||||
private List<OrganizationClassOption> organizationClassOptions;
|
||||
|
||||
@Data
|
||||
public static class OrganizationTypeOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public OrganizationTypeOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class OrganizationClassOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public OrganizationClassOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
public OrganizationInitDto() {
|
||||
List<OrganizationTypeOption> organizationTypeOptionList = List.of(
|
||||
new OrganizationTypeOption(OrganizationType.HOSPITAL.getValue(), OrganizationType.HOSPITAL.getInfo()),
|
||||
new OrganizationTypeOption(OrganizationType.DEPARTMENT.getValue(), OrganizationType.DEPARTMENT.getInfo()));
|
||||
|
||||
List<OrganizationClassOption> organizationClassOptionList = List.of(
|
||||
new OrganizationClassOption(OrganizationClass.CLINIC.getValue(), OrganizationClass.CLINIC.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.INPATIENT.getValue(), OrganizationClass.INPATIENT.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.PHARMACY.getValue(), OrganizationClass.PHARMACY.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.STORAGE.getValue(), OrganizationClass.STORAGE.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.FIN.getValue(), OrganizationClass.FIN.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.NS.getValue(), OrganizationClass.NS.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.MANAGER.getValue(), OrganizationClass.MANAGER.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.SUPPORT.getValue(), OrganizationClass.SUPPORT.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.OTHER.getValue(), OrganizationClass.OTHER.getInfo()));
|
||||
|
||||
this.organizationTypeOptions = organizationTypeOptionList;
|
||||
this.organizationClassOptions = organizationClassOptionList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 岗位分页查询条件
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractRoleSearchParam implements Serializable {
|
||||
|
||||
/** 专业编码枚举 */
|
||||
private Integer specialtyEnum;
|
||||
|
||||
/** 机构 */
|
||||
private Long orgId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 员工分页查询条件
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractSearchParam implements Serializable {
|
||||
|
||||
/** 活动标记 */
|
||||
private Integer activeFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractitionerDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 姓名 */
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
private String name;
|
||||
|
||||
/** 其他名称 */
|
||||
private String nameJson;
|
||||
|
||||
/** 性别编码 */
|
||||
// @NotBlank(message = "性别不能为空")
|
||||
// private AdministrativeGender genderEnum;
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 死亡时间 */
|
||||
private Date deceasedDate;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
|
||||
/** 地址 */
|
||||
private String address;
|
||||
|
||||
/** 地址省 */
|
||||
private String addressProvince;
|
||||
|
||||
/** 地址市 */
|
||||
private String addressCity;
|
||||
|
||||
/** 地址区 */
|
||||
private String addressDistrict;
|
||||
|
||||
/** 地址街道 */
|
||||
private String addressStreet;
|
||||
|
||||
/** 患者其他地址 */
|
||||
private String addressJson;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 患者院内编码/病历号 */
|
||||
private String busNo;
|
||||
|
||||
/** 医保码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 系统用户id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 参与者机构和位置 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractitionerOrgAndLocationDto {
|
||||
|
||||
/**
|
||||
* 位置id
|
||||
*/
|
||||
@Dict(dictTable = "adm_location", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 机构id
|
||||
*/
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgId_dictText;
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractitionerRoleDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 名称 */
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
|
||||
/** 角色编码 */
|
||||
@NotBlank(message = "角色编码不能为空")
|
||||
private String role_code;
|
||||
|
||||
/** 活动标识 */
|
||||
@NotNull(message = "活动标识不能为空")
|
||||
private Integer activeFlag;
|
||||
|
||||
/** 参与者Id */
|
||||
@NotNull(message = "参与者Id不能为空")
|
||||
private Long practitionerId;
|
||||
|
||||
/** 机构 */
|
||||
@NotNull(message = "机构不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
|
||||
/** 位置ID */
|
||||
@NotNull(message = "位置ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 服务id */
|
||||
@NotNull(message = "服务id不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long healthcareServiceId;
|
||||
|
||||
/** 专业编码枚举 */
|
||||
@NotNull(message = "专业编码不能为空")
|
||||
private Integer specialtyEnum;
|
||||
|
||||
/** 岗位类型 */
|
||||
@NotBlank(message = "岗位类型不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/** 有效时间 */
|
||||
@NotBlank(message = "有效时间不能为空")
|
||||
private String availabilityJson;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 参与者角色 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractitionerRolesDto {
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 可选择切换科室 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SelectableOrgDto {
|
||||
|
||||
/** 科室ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 用户 及 参与者 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAndPractitionerDto {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@Dict(dictCode = "sys_user_sex")
|
||||
private String sex;
|
||||
private String sex_dictText;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@Dict(dictCode = "sys_normal_disable")
|
||||
private String status;
|
||||
private String status_dictText;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private Date birthDate;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 医保码
|
||||
*/
|
||||
private String ybNo;
|
||||
|
||||
/**
|
||||
* 职业证件编号
|
||||
*/
|
||||
private String pharPracCertNo;
|
||||
|
||||
/**
|
||||
* 机构id
|
||||
*/
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgId_dictText;
|
||||
|
||||
/**
|
||||
* 责任科室
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> responsibilityOrgDtoList;
|
||||
|
||||
/**
|
||||
* 参与者角色集合
|
||||
*/
|
||||
private List<PractitionerRolesDto> practitionerRolesDtoList;
|
||||
|
||||
/**
|
||||
* 医生出诊科室集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> doctorVisitOrgDtoList;
|
||||
|
||||
/**
|
||||
* 管理库房集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageLocationDtoList;
|
||||
|
||||
/**
|
||||
* 管理药房集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList;
|
||||
|
||||
/**
|
||||
* 护士-管理科室集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageOrgDtoList;
|
||||
|
||||
/**
|
||||
* 护士-管理病区集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageWardLocationDtoList;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.openhis.web.basedatamanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRolesDto;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
|
||||
/**
|
||||
* 参与者 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface PractitionerAppAppMapper {
|
||||
|
||||
/**
|
||||
* 查询用户及参与者
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 用户及参与者
|
||||
*/
|
||||
IPage<UserAndPractitionerDto> getUserPractitionerPage(@Param("page") Page<UserAndPractitionerDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<UserAndPractitionerDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询参与者的角色信息
|
||||
*
|
||||
* @param practitionerIdList 参与者id集合
|
||||
* @return 参与者的角色信息
|
||||
*/
|
||||
List<PractitionerRolesDto> getPractitionerRolesDtoList(@Param("practitionerIdList") List<Long> practitionerIdList);
|
||||
|
||||
/**
|
||||
* 查询科室和位置集合
|
||||
*
|
||||
* @param practitionerIdList 参与者id集合
|
||||
* @return 科室和位置集合
|
||||
*/
|
||||
List<PractitionerOrgAndLocationDto>
|
||||
getOrgAndLocationDtoList(@Param("practitionerIdList") List<Long> practitionerIdList);
|
||||
|
||||
/**
|
||||
* 物理删除系统用户与角色的关系
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
*/
|
||||
void delUserRole(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 物理删除参与者与业务角色的关系
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
*/
|
||||
void delPractitionerRole(@Param("practitionerId") Long practitionerId);
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
List<SelectableOrgDto> getSelectableOrgList(@Param("practitionerId") Long practitionerId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basicservice.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ChargeItemDefinition;
|
||||
import com.openhis.administration.domain.HealthcareService;
|
||||
import com.openhis.administration.service.IChargeItemDefinitionService;
|
||||
import com.openhis.administration.service.IHealthcareServiceService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basicservice.dto.*;
|
||||
import com.openhis.web.basicservice.mapper.HealthcareServiceBizMapper;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 服务管理 controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/basic-service/healthcare")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class HealthcareServiceController {
|
||||
|
||||
private final IHealthcareServiceService iHealthcareServiceService;
|
||||
private final IChargeItemDefinitionService iChargeItemDefinitionService;
|
||||
|
||||
private final HealthcareServiceBizMapper healthcareServiceBizMapper;
|
||||
|
||||
private final YbManager ybService;
|
||||
|
||||
/**
|
||||
* 服务管理基础数据初始化
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
HealthcareServiceInitDto healthcareServiceInitDto = new HealthcareServiceInitDto();
|
||||
// 活动标记
|
||||
List<HealthcareServiceInitDto.activeFlagOption> activeFlagOptions = Stream.of(AccountStatus.values())
|
||||
.map(status -> new HealthcareServiceInitDto.activeFlagOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
healthcareServiceInitDto.setActiveFlagOptions(activeFlagOptions);
|
||||
// 是否需要预约
|
||||
List<HealthcareServiceInitDto.appointmentRequiredFlagOption> appointmentRequiredFlagOptions =
|
||||
Stream.of(Whether.values())
|
||||
.map(wh -> new HealthcareServiceInitDto.appointmentRequiredFlagOption(wh.getValue(), wh.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
healthcareServiceInitDto.setAppointmentRequiredFlagOptions(appointmentRequiredFlagOptions);
|
||||
return R.ok(healthcareServiceInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务管理 新增
|
||||
*/
|
||||
@PostMapping(value = "/healthcare-service")
|
||||
public R<?> add(@Validated @RequestBody HealthcareServiceAddOrUpdateParam healthcareServiceAddOrUpdateParam) {
|
||||
// 服务管理-表单数据
|
||||
HealthcareServiceFormData healthcareServiceFormData =
|
||||
healthcareServiceAddOrUpdateParam.getHealthcareServiceFormData();
|
||||
// 费用定价-表单数据
|
||||
ChargeItemDefinitionFormData chargeItemDefinitionFormData =
|
||||
healthcareServiceAddOrUpdateParam.getChargeItemDefinitionFormData();
|
||||
// 服务管理-新增
|
||||
HealthcareService healthcareService = new HealthcareService();
|
||||
BeanUtils.copyProperties(healthcareServiceFormData, healthcareService);
|
||||
HealthcareService healthcareServiceAfterAdd = iHealthcareServiceService.addHealthcareService(healthcareService);
|
||||
// 同时保存费用定价
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
chargeItemDefinitionFormData.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
BeanUtils.copyProperties(chargeItemDefinitionFormData, chargeItemDefinition);
|
||||
boolean res = iChargeItemDefinitionService.addChargeItemDefinitionByHealthcareService(healthcareServiceAfterAdd,
|
||||
chargeItemDefinition);
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
// 医保开关打开并且,页面传了医保编码
|
||||
String ybNo = healthcareServiceFormData.getYbNo();
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(ybNo)) {
|
||||
R<?> r = ybService.directoryCheck(CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
healthcareServiceAfterAdd.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
return res ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"服务管理"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务管理 分页查询
|
||||
*
|
||||
* @param healthcareServiceDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 列表信息
|
||||
*/
|
||||
@GetMapping(value = "/healthcare-service-page")
|
||||
public R<?> getHealthcareServicePage(HealthcareServiceDto healthcareServiceDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper = HisQueryUtils.buildQueryWrapper(healthcareServiceDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("name", "charge_name")), request);
|
||||
IPage<HealthcareServiceDto> healthcareServicePage = healthcareServiceBizMapper.getHealthcareServicePage(
|
||||
new Page<>(pageNo, pageSize), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, queryWrapper);
|
||||
healthcareServicePage.getRecords().forEach(e -> {
|
||||
// 活动标记-枚举类回显赋值
|
||||
e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag()));
|
||||
// 预约要求-枚举类回显赋值
|
||||
e.setAppointmentRequiredFlag_enumText(
|
||||
EnumUtils.getInfoByValue(Whether.class, e.getAppointmentRequiredFlag()));
|
||||
});
|
||||
return R.ok(healthcareServicePage, MessageUtils.createMessage(PromptMsgConstant.Common.M00009, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务管理 详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 详情
|
||||
*/
|
||||
@GetMapping(value = "/healthcare-service-detail")
|
||||
public R<?> getHealthcareServiceDetail(@RequestParam Long id) {
|
||||
HealthcareServiceDto healthcareServiceDto = new HealthcareServiceDto();
|
||||
healthcareServiceDto.setId(id);
|
||||
// 构建查询条件
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(healthcareServiceDto, null, null, null);
|
||||
IPage<HealthcareServiceDto> healthcareServicePage = healthcareServiceBizMapper.getHealthcareServicePage(
|
||||
new Page<>(1, 1), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, queryWrapper);
|
||||
HealthcareServiceDto healthcareServiceDtoDetail = healthcareServicePage.getRecords().get(0);
|
||||
// 枚举赋值
|
||||
healthcareServiceDtoDetail
|
||||
.setActiveFlag_enumText(
|
||||
EnumUtils.getInfoByValue(AccountStatus.class, healthcareServiceDtoDetail.getActiveFlag()))
|
||||
.setAppointmentRequiredFlag_enumText(
|
||||
EnumUtils.getInfoByValue(Whether.class, healthcareServiceDtoDetail.getAppointmentRequiredFlag()));
|
||||
return R.ok(healthcareServiceDtoDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务管理 编辑
|
||||
*
|
||||
* @param healthcareServiceAddOrUpdateParam 表单数据
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping(value = "/healthcare-service")
|
||||
public R<?> edit(@Validated @RequestBody HealthcareServiceAddOrUpdateParam healthcareServiceAddOrUpdateParam) {
|
||||
// 服务管理-表单数据
|
||||
HealthcareServiceFormData healthcareServiceFormData =
|
||||
healthcareServiceAddOrUpdateParam.getHealthcareServiceFormData();
|
||||
HealthcareService healthcareService = new HealthcareService();
|
||||
BeanUtils.copyProperties(healthcareServiceFormData, healthcareService);
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
// 医保开关打开并且,页面传了医保编码
|
||||
String ybNo = healthcareServiceFormData.getYbNo();
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(ybNo)) {
|
||||
R<?> r =
|
||||
ybService.directoryCheck(CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, healthcareService.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
boolean res = iHealthcareServiceService.updateHealthcareService(healthcareService);
|
||||
return res ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"服务管理"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务管理 删除
|
||||
*
|
||||
* @param ids ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping(value = "/healthcare-service")
|
||||
public R<?> delete(@RequestParam String ids) {
|
||||
List<Long> idsList = new ArrayList<>();
|
||||
if (ids != null) {
|
||||
idsList = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
}
|
||||
boolean res = iHealthcareServiceService.removeByIds(idsList);
|
||||
// 同时删除非同定价
|
||||
for (Long id : idsList) {
|
||||
LambdaQueryWrapper<ChargeItemDefinition> QueryWrapper = new LambdaQueryWrapper<>();
|
||||
QueryWrapper.eq(ChargeItemDefinition::getInstanceId, id).eq(ChargeItemDefinition::getInstanceTable,
|
||||
CommonConstants.TableName.ADM_HEALTHCARE_SERVICE);
|
||||
iChargeItemDefinitionService.remove(QueryWrapper);
|
||||
}
|
||||
return res ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"服务管理"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 费用定价管理表单数据
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
public class ChargeItemDefinitionFormData {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String chargeName;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 机构ID
|
||||
*/
|
||||
@NotBlank(message = "机构ID不能为空")
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@NotBlank(message = "描述不能为空")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 代码
|
||||
*/
|
||||
private String instanceTable;
|
||||
|
||||
/**
|
||||
* 关联项目
|
||||
*/
|
||||
private Long instanceId;
|
||||
|
||||
/**
|
||||
* 有效时间开始
|
||||
*/
|
||||
private Date effectiveStart;
|
||||
|
||||
/**
|
||||
* 有效时间结束
|
||||
*/
|
||||
private Date effectiveEnd;
|
||||
|
||||
/**
|
||||
* 财务类别
|
||||
*/
|
||||
@NotBlank(message = "财务类别不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 医保类别
|
||||
*/
|
||||
@NotBlank(message = "医保类别不能为空")
|
||||
private String ybType;
|
||||
|
||||
/**
|
||||
* 是否使用详细价格规则
|
||||
*/
|
||||
@NotBlank(message = "是否使用详细价格规则不能为空")
|
||||
private Integer conditionFlag;
|
||||
|
||||
/**
|
||||
* 基础价格
|
||||
*/
|
||||
@NotBlank(message = "基础价格不能为空")
|
||||
private BigDecimal price;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务项目管理 新增修改参数类
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
public class HealthcareServiceAddOrUpdateParam {
|
||||
/**
|
||||
* 服务管理
|
||||
*/
|
||||
private HealthcareServiceFormData healthcareServiceFormData;
|
||||
|
||||
/**
|
||||
* 费用定价
|
||||
*/
|
||||
private ChargeItemDefinitionFormData chargeItemDefinitionFormData;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 服务管理 Dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class HealthcareServiceDto {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 活动标记
|
||||
*/
|
||||
private Integer activeFlag;
|
||||
private String activeFlag_enumText;
|
||||
|
||||
/**
|
||||
* 提供部门ID
|
||||
*/
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long offeredOrgId;
|
||||
private String offeredOrgId_dictText;
|
||||
|
||||
/**
|
||||
* 服务分类
|
||||
*/
|
||||
@Dict(dictCode = "category_code")
|
||||
private String categoryCode;
|
||||
private String categoryCode_dictText;
|
||||
|
||||
/**
|
||||
* 服务类型
|
||||
*/
|
||||
@Dict(dictCode = "service_type_code")
|
||||
private String typeCode;
|
||||
private String typeCode_dictText;
|
||||
|
||||
/**
|
||||
* 服务专业
|
||||
*/
|
||||
@Dict(dictCode = "specialty_code")
|
||||
private String specialtyCode;
|
||||
private String specialtyCode_dictText;
|
||||
|
||||
/**
|
||||
* 地点
|
||||
*/
|
||||
@Dict(dictTable = "adm_location", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 额外细节
|
||||
*/
|
||||
private String extraDetails;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 预约要求
|
||||
*/
|
||||
private Integer appointmentRequiredFlag;
|
||||
private String appointmentRequiredFlag_enumText;
|
||||
|
||||
/**
|
||||
* 费用定价ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long definitionId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String chargeName;
|
||||
|
||||
/**
|
||||
* 基础价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 诊疗费
|
||||
*/
|
||||
private BigDecimal activityPrice;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务项目管理表单数据
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
public class HealthcareServiceFormData {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 活动标记
|
||||
*/
|
||||
@NotBlank(message = "活动标记不能为空")
|
||||
private Integer activeFlag;
|
||||
|
||||
/**
|
||||
* 提供部门ID
|
||||
*/
|
||||
@NotBlank(message = "提供部门ID不能为空")
|
||||
private Long offeredOrgId;
|
||||
|
||||
/**
|
||||
* 服务分类
|
||||
*/
|
||||
@NotBlank(message = "服务分类不能为空")
|
||||
private String categoryCode;
|
||||
|
||||
/**
|
||||
* 服务类型
|
||||
*/
|
||||
@NotBlank(message = "服务类型不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 服务专业
|
||||
*/
|
||||
@NotBlank(message = "服务专业不能为空")
|
||||
private String specialtyCode;
|
||||
|
||||
/**
|
||||
* 地点
|
||||
*/
|
||||
// @NotBlank(message = "地点不能为空")
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*/
|
||||
@NotBlank(message = "服务名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 额外细节
|
||||
*/
|
||||
private String extraDetails;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
@NotBlank(message = "联系方式不能为空")
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 预约要求
|
||||
*/
|
||||
@NotBlank(message = "预约要求不能为空")
|
||||
private Integer appointmentRequiredFlag;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务管理 init基础数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class HealthcareServiceInitDto {
|
||||
|
||||
|
||||
private List<activeFlagOption> activeFlagOptions;
|
||||
private List<appointmentRequiredFlagOption> appointmentRequiredFlagOptions;
|
||||
|
||||
|
||||
/**
|
||||
* 活动标记
|
||||
*/
|
||||
@Data
|
||||
public static class activeFlagOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public activeFlagOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要预约
|
||||
*/
|
||||
@Data
|
||||
public static class appointmentRequiredFlagOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public appointmentRequiredFlagOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.openhis.web.basicservice.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.basicservice.dto.HealthcareServiceDto;
|
||||
|
||||
/**
|
||||
* 服务管理 自定义Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface HealthcareServiceBizMapper {
|
||||
|
||||
/**
|
||||
* 服务管理 分页查询
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param tableName 定价表名
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 列表信息
|
||||
*/
|
||||
IPage<HealthcareServiceDto> getHealthcareServicePage(@Param("page") Page<HealthcareServiceDto> page,
|
||||
@Param("tableName") String tableName, @Param("activityTableName") String activityTableName,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<HealthcareServiceDto> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.catalogmanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.ybcatalog.domain.CatalogZySyndrome;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 医保目录服务层
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-04-09
|
||||
*/
|
||||
|
||||
public interface ICatalogService {
|
||||
R<?> getPage(Integer catalogType, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.catalogmanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.constant.YbCommonConstants;
|
||||
import com.openhis.common.enums.CatalogType;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.catalogmanage.appservice.ICatalogService;
|
||||
import com.openhis.web.catalogmanage.mapper.CatalogMapper;
|
||||
import com.openhis.ybcatalog.domain.*;
|
||||
import com.openhis.ybcatalog.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* 医保目录服务层
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-04-09
|
||||
*/
|
||||
@Service
|
||||
public class CatalogServiceImpl implements ICatalogService {
|
||||
|
||||
@Autowired
|
||||
CatalogMapper catalogMapper;
|
||||
@Autowired
|
||||
ICatalogDrugInfoService iCatalogDrugInfoService;
|
||||
@Autowired
|
||||
ICatalogMedicalServiceService iCatalogMedicalServiceService;
|
||||
@Autowired
|
||||
ICatalogMedicalConsumablesService iCatalogMedicalConsumablesService;
|
||||
@Autowired
|
||||
ICatalogSurgeryStandardDirectoryService iCatalogSurgeryStandardDirectoryService;
|
||||
@Autowired
|
||||
ICatalogZyDiseaseDiagnosisService iCatalogZyDiseaseDiagnosisService;
|
||||
@Autowired
|
||||
ICatalogWesternDiseaseService iCatalogWesternDiseaseService;
|
||||
@Autowired
|
||||
ICatalogZySyndromeService iCatalogZySyndromeService;
|
||||
@Autowired
|
||||
ICatalogMedicalHerbInfoService iCatalogMedicalHerbInfoService;
|
||||
|
||||
@Override
|
||||
public R<?> getPage(Integer catalogType, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 分类
|
||||
CatalogType catalog = CatalogType.getByValue(catalogType);
|
||||
if (catalog == null) {
|
||||
return R.fail(
|
||||
MessageUtils.createMessage(PromptMsgConstant.Yb.M00001, new String[] {String.valueOf(catalogType)}));
|
||||
}
|
||||
// 查询对应的目录
|
||||
switch (catalog) {
|
||||
case CATALOG_TYPE_1301:
|
||||
return get1301Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1302:
|
||||
return get1302Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1305:
|
||||
return get1305Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1306:
|
||||
return get1306Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1307:
|
||||
return get1307Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1308:
|
||||
return get1308Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1314:
|
||||
return get1314Page(searchKey, pageNo, pageSize, request);
|
||||
case CATALOG_TYPE_1315:
|
||||
return get1315Page(searchKey, pageNo, pageSize, request);
|
||||
default:
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Yb.M00001,
|
||||
new String[] {String.valueOf(catalogType)}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中医证候目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1315Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogZySyndrome> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.SyndromeTypeCode,
|
||||
// YBCommonConstants.FieldName.SyndromeTypeName, YBCommonConstants.FieldName.UniqueRecordId)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1315Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogZySyndrome> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(YbCommonConstants.FieldName.SyndromeTypeCode, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.SyndromeTypeName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.UniqueRecordId, searchKey);
|
||||
return R.ok(iCatalogZySyndromeService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 中医疾病目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1314Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogZyDiseaseDiagnosis> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.DiseaseCategoryName,
|
||||
// YBCommonConstants.FieldName.DiseaseCategoryCode, YBCommonConstants.FieldName.UniqueRecordId)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1314Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogZyDiseaseDiagnosis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(YbCommonConstants.FieldName.DiseaseCategoryName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.DiseaseCategoryCode, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.UniqueRecordId, searchKey);
|
||||
return R.ok(iCatalogZyDiseaseDiagnosisService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 手术标准目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1308Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogSurgeryStandardDirectory> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.CategoryName,
|
||||
// YBCommonConstants.FieldName.SubcategoryName, YBCommonConstants.FieldName.ItemName,
|
||||
// YBCommonConstants.FieldName.ItemName, YBCommonConstants.FieldName.OperationName,
|
||||
// YBCommonConstants.FieldName.OperationCode)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1308Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogSurgeryStandardDirectory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(YbCommonConstants.FieldName.CategoryName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.SubcategoryName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.ItemName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.OperationName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.OperationCode, searchKey);
|
||||
return R.ok(iCatalogSurgeryStandardDirectoryService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 疾病与诊断目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1307Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogWesternDisease> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.CategoryName,
|
||||
// YBCommonConstants.FieldName.SubcategoryName, YBCommonConstants.FieldName.ItemName,
|
||||
// YBCommonConstants.FieldName.ItemName, YBCommonConstants.FieldName.OperationName,
|
||||
// YBCommonConstants.FieldName.OperationCode)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1307Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogWesternDisease> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(YbCommonConstants.FieldName.CategoryName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.SubcategoryName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.ChapterName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.SectionName, searchKey);
|
||||
return R.ok(iCatalogWesternDiseaseService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医用耗材目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1306Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogMedicalConsumables> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.MedicalCatalogCode,
|
||||
// YBCommonConstants.FieldName.ConsumableCategory, YBCommonConstants.FieldName.MaterialType,
|
||||
// YBCommonConstants.FieldName.Specification)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1306Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogMedicalConsumables> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(YbCommonConstants.FieldName.MedicalCatalogCode, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.ConsumableName, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.ConsumableCategory, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.MaterialType, searchKey).or()
|
||||
.like(YbCommonConstants.FieldName.Specification, searchKey);
|
||||
return R.ok(iCatalogMedicalConsumablesService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医疗服务目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1305Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<CatalogMedicalService> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList(YbCommonConstants.FieldName.MedicalCatalogCode,
|
||||
YbCommonConstants.FieldName.MedicalServiceName, YbCommonConstants.FieldName.UniqueRecordId)),
|
||||
request);
|
||||
// 只保留每组中 version_number 最大的记录
|
||||
queryWrapper.eq(YbCommonConstants.FieldName.RowNumMax, 1);
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
return R.ok(catalogMapper.get1305Page(new Page(pageNo, pageSize), queryWrapper, tenantId));
|
||||
|
||||
// QueryWrapper<CatalogMedicalService> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.like(YbCommonConstants.FieldName.MedicalServiceName, searchKey).or()
|
||||
// .like(YbCommonConstants.FieldName.UniqueRecordId, searchKey);
|
||||
// return R.ok(iCatalogMedicalServiceService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 中药饮片目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1302Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
// QueryWrapper<CatalogMedicalHerbInfo> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
// null, searchKey, new HashSet<>(Arrays.asList(YBCommonConstants.FieldName.MedicalServiceName,
|
||||
// YBCommonConstants.FieldName.UniqueRecordId)),
|
||||
// request);
|
||||
//
|
||||
// return R.ok(catalogMapper.get1302Page(new Page(pageNo, pageSize), queryWrapper));
|
||||
QueryWrapper<CatalogMedicalHerbInfo> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.like(YBCommonConstants.FieldName.MedicalServiceName, searchKey).or()
|
||||
// .like(YBCommonConstants.FieldName.UniqueRecordId, searchKey);
|
||||
return R.ok(iCatalogMedicalHerbInfoService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 西药中成药目录
|
||||
*
|
||||
* @param searchKey 模糊条件
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @param request 请求参数
|
||||
* @return 分页内容
|
||||
*/
|
||||
private R<?> get1301Page(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<CatalogDrugInfo> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList(YbCommonConstants.FieldName.MedicalCatalogCode,
|
||||
YbCommonConstants.FieldName.RegisteredName, YbCommonConstants.FieldName.ApprovalNo,
|
||||
YbCommonConstants.FieldName.UniqueRecordId)),
|
||||
request);
|
||||
|
||||
// 只保留每组中 version_number 最大的记录
|
||||
queryWrapper.eq(YbCommonConstants.FieldName.RowNumMax, 1);
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
return R.ok(catalogMapper.get1301Page(new Page(pageNo, pageSize), queryWrapper, tenantId));
|
||||
|
||||
// QueryWrapper<CatalogDrugInfo> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.like(YbCommonConstants.FieldName.MedicalCatalogCode, searchKey).or()
|
||||
// .like(YbCommonConstants.FieldName.RegisteredName, searchKey).or()
|
||||
// .like(YbCommonConstants.FieldName.ApprovalNo, searchKey).or()
|
||||
// .like(YbCommonConstants.FieldName.UniqueRecordId, searchKey);
|
||||
// return R.ok(iCatalogDrugInfoService.page(new Page<>(pageNo, pageSize), queryWrapper));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.catalogmanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.core.common.annotation.Anonymous;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.catalogmanage.appservice.ICatalogService;
|
||||
import com.openhis.web.ybmanage.config.YbServiceConfig;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 医保目录
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-04-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/catalog")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class CatalogController {
|
||||
|
||||
@Autowired
|
||||
ICatalogService iCatalogService;
|
||||
@Autowired
|
||||
YbServiceConfig ybServiceConfig;
|
||||
|
||||
/**
|
||||
* 分页查询医保目录信息,可选条件
|
||||
*
|
||||
* @param catalogType 查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/page")
|
||||
public R<?> getPage(Integer catalogType, @RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
System.out.println(ybServiceConfig.getUrl());
|
||||
return R.ok(iCatalogService.getPage(catalogType, searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.catalogmanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.ybcatalog.domain.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 医保目录Mapper
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-04-09
|
||||
*/
|
||||
@Repository
|
||||
public interface CatalogMapper {
|
||||
|
||||
IPage<CatalogZySyndrome> get1315Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogZySyndrome> queryWrapper);
|
||||
|
||||
IPage<CatalogZyDiseaseDiagnosis> get1314Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogZyDiseaseDiagnosis> queryWrapper);
|
||||
|
||||
IPage<CatalogSurgeryStandardDirectory> get1308Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogSurgeryStandardDirectory> queryWrapper);
|
||||
|
||||
IPage<CatalogWesternDisease> get1307Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogWesternDisease> queryWrapper);
|
||||
|
||||
IPage<CatalogMedicalConsumables> get1306Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogMedicalConsumables> queryWrapper);
|
||||
|
||||
IPage<CatalogMedicalService> get1305Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogMedicalService> queryWrapper,@Param("tenantId") Integer tenantId);
|
||||
|
||||
IPage<CatalogMedicalHerbInfo> get1302Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogMedicalHerbInfo> queryWrapper);
|
||||
|
||||
IPage<CatalogDrugInfo> get1301Page(@Param("page")Page page, @Param(Constants.WRAPPER)QueryWrapper<CatalogDrugInfo> queryWrapper,@Param("tenantId") Integer tenantId);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
|
||||
/**
|
||||
* 门诊收费 service
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
public interface IInpatientChargeAppService {
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
|
||||
String endTime);
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> changeToSelfPay(Long encounterId);
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> changeToMedicalInsurance(Long encounterId);
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> outpatientChargeInit();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊收费 service
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
public interface IOutpatientChargeAppService {
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> changeToSelfPay(Long encounterId);
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> changeToMedicalInsurance(Long encounterId);
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> outpatientChargeInit();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
|
||||
/**
|
||||
* 门诊划价 service
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
public interface IOutpatientPricingAppService {
|
||||
|
||||
/**
|
||||
* 查询就诊患者信息
|
||||
*
|
||||
* @param patientInfoDto 查询条件 (前端可传 statusEnum 区分就诊状态tab)
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 就诊患者信息
|
||||
*/
|
||||
IPage<PatientInfoDto> getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 查询医嘱信息
|
||||
*
|
||||
* @param adviceBaseDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param locationId 药房id
|
||||
* @param organizationId 患者挂号对应的科室id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 医嘱信息
|
||||
*/
|
||||
IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
Long organizationId, Integer pageNo, Integer pageSize);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.RefundItemParam;
|
||||
|
||||
/**
|
||||
* 门诊退费 service
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
public interface IOutpatientRefundAppService {
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者账单列表
|
||||
*/
|
||||
R<?> getEncounterPatientPayment(Long encounterId);
|
||||
|
||||
/**
|
||||
* 根据账单退费
|
||||
*
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> refundPayment(List<RefundItemParam> refundItemList);
|
||||
|
||||
/**
|
||||
* 查询结算过的就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
R<?> getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 门诊退费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> outpatientRefundInit();
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param billDateSTime 收费时间开始
|
||||
* @param billDateETime 收费时间结束
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
R<?> getEncounterPatientRefund(Long encounterId, String billDateSTime, String billDateETime);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
R<?> getRegenerateCharge(Long encounterId);
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
R<?> verifyRefundable(List<Long> chargeItemIdList);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.openhis.web.chargemanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basicservice.dto.HealthcareServiceDto;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 门诊挂号 应用Service
|
||||
*/
|
||||
public interface IOutpatientRegistrationAppService {
|
||||
|
||||
/**
|
||||
* 查询患者信息
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者信息
|
||||
*/
|
||||
Page<PatientMetadata> getPatientMetadataBySearchKey(String searchKey, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 查询门诊科室数据
|
||||
*
|
||||
* @return 门诊科室
|
||||
*/
|
||||
List<OrgMetadata> getOrgMetadata();
|
||||
|
||||
/**
|
||||
* 根据科室id筛选医生
|
||||
*
|
||||
* @param orgId 科室ID
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 筛选医生
|
||||
*/
|
||||
IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long orgId, String searchKey, Integer pageNo,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据机构id筛选服务项目
|
||||
*
|
||||
* @param organizationId 机构id
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 服务项目
|
||||
*/
|
||||
IPage<HealthcareServiceDto> getHealthcareMetadataByOrganizationId(Long organizationId, String searchKey,
|
||||
Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 退号
|
||||
*
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> returnRegister(CancelRegPaymentDto cancelRegPaymentDto);
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelRegister(Long encounterId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.chargemanage.appservice.IInpatientChargeAppService;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageDto;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientInitDto;
|
||||
import com.openhis.web.chargemanage.mapper.InpatientChargeAppMapper;
|
||||
|
||||
/**
|
||||
* 门诊收费 impl
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@Service
|
||||
public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService {
|
||||
|
||||
@Autowired
|
||||
private InpatientChargeAppMapper inpatientChargeAppMapper;
|
||||
@Autowired
|
||||
private IChargeItemService chargeItemService;
|
||||
@Autowired
|
||||
private IAccountService accountService;
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> outpatientChargeInit() {
|
||||
OutpatientInitDto initDto = new OutpatientInitDto();
|
||||
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(),
|
||||
ChargeItemStatus.PLANNED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLABLE.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
ChargeItemStatus.BILLED.getInfo()));
|
||||
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterPatientPageParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
encounterPatientPageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr,
|
||||
CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo,
|
||||
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)),
|
||||
request);
|
||||
// 就诊患者分页列表
|
||||
Page<EncounterPatientPageDto> encounterPatientPage = inpatientChargeAppMapper
|
||||
.selectEncounterPatientPage(EncounterClass.IMP.getValue(), new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
encounterPatientPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
return R.ok(encounterPatientPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@Override
|
||||
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
|
||||
String endTime) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
startTime = startTime + "000000";
|
||||
|
||||
endTime = endTime + "235959";
|
||||
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
try {
|
||||
startDate = sdf.parse(startTime);
|
||||
endDate = sdf.parse(endTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
|
||||
inpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(), startDate, endDate);
|
||||
prescriptionDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
return prescriptionDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> changeToSelfPay(Long encounterId) {
|
||||
// 获取就诊患者的自费账户id
|
||||
Long accountId = accountService.getSelfPayAccount(encounterId);
|
||||
if (accountId == null) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"自费账户"}));
|
||||
}
|
||||
// 医保转自费
|
||||
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00009, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> changeToMedicalInsurance(Long encounterId) {
|
||||
// 获取就诊患者的医保账户id
|
||||
Long accountId = accountService.getMedicalInsuranceAccount(encounterId);
|
||||
if (accountId == null) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"医保账户"}));
|
||||
}
|
||||
// 自费转医保
|
||||
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00009, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientChargeAppService;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageDto;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientInitDto;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientChargeAppMapper;
|
||||
|
||||
/**
|
||||
* 门诊收费 impl
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppService {
|
||||
|
||||
@Autowired
|
||||
private OutpatientChargeAppMapper outpatientChargeAppMapper;
|
||||
@Autowired
|
||||
private IChargeItemService chargeItemService;
|
||||
@Autowired
|
||||
private IAccountService accountService;
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> outpatientChargeInit() {
|
||||
OutpatientInitDto initDto = new OutpatientInitDto();
|
||||
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(),
|
||||
ChargeItemStatus.PLANNED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLABLE.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
ChargeItemStatus.BILLED.getInfo()));
|
||||
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterPatientPageParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
encounterPatientPageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr,
|
||||
CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo,
|
||||
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)),
|
||||
request);
|
||||
// 就诊患者分页列表
|
||||
Page<EncounterPatientPageDto> encounterPatientPage = outpatientChargeAppMapper
|
||||
.selectEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
|
||||
|
||||
encounterPatientPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
return R.ok(encounterPatientPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@Override
|
||||
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId) {
|
||||
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
|
||||
outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
|
||||
prescriptionDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
return prescriptionDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> changeToSelfPay(Long encounterId) {
|
||||
// 获取就诊患者的自费账户id
|
||||
Long accountId = accountService.getSelfPayAccount(encounterId);
|
||||
if (accountId == null) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"自费账户"}));
|
||||
}
|
||||
// 医保转自费
|
||||
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00009, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> changeToMedicalInsurance(Long encounterId) {
|
||||
// 获取就诊患者的医保账户id
|
||||
Long accountId = accountService.getMedicalInsuranceAccount(encounterId);
|
||||
if (accountId == null) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00008, new Object[] {"医保账户"}));
|
||||
}
|
||||
// 自费转医保
|
||||
boolean result = chargeItemService.updateAccountType(encounterId, accountId);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Payment.M00009, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientPricingAppService;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientPricingAppMapper;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationMainAppService;
|
||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊划价 impl
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppService {
|
||||
|
||||
@Resource
|
||||
OutpatientPricingAppMapper outpatientPricingAppMapper;
|
||||
|
||||
@Resource
|
||||
IDoctorStationMainAppService iDoctorStationMainAppService;
|
||||
|
||||
@Resource
|
||||
IDoctorStationAdviceAppService iDoctorStationAdviceAppService;
|
||||
|
||||
/**
|
||||
* 查询就诊患者信息
|
||||
*
|
||||
* @param patientInfoDto 查询条件 (前端传 statusEnum 区分就诊状态tab)
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 就诊患者信息
|
||||
*/
|
||||
@Override
|
||||
public IPage<PatientInfoDto> getPatientInfo(PatientInfoDto patientInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
return iDoctorStationMainAppService.getPatientInfo(patientInfoDto, searchKey, pageNo, pageSize, request,
|
||||
Whether.YES.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询医嘱信息
|
||||
*
|
||||
* @param adviceBaseDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param locationId 药房id
|
||||
* @param organizationId 患者挂号对应的科室id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 医嘱信息
|
||||
*/
|
||||
@Override
|
||||
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
Long organizationId, Integer pageNo, Integer pageSize) {
|
||||
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
|
||||
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.DeviceRequest;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
|
||||
/**
|
||||
* 门诊退费 impl
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppService {
|
||||
|
||||
@Autowired
|
||||
private OutpatientRefundAppMapper outpatientRefundAppMapper;
|
||||
@Autowired
|
||||
private IPaymentReconciliationService paymentReconciliationService;
|
||||
@Autowired
|
||||
private IChargeItemService chargeItemService;
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
@Autowired
|
||||
private IServiceRequestService serviceRequestService;
|
||||
@Autowired
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
@Autowired
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
@Autowired
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
/**
|
||||
* 门诊退费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> outpatientRefundInit() {
|
||||
OutpatientInitDto initDto = new OutpatientInitDto();
|
||||
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
ChargeItemStatus.BILLED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDING.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDED.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(
|
||||
ChargeItemStatus.PART_REFUND.getValue(), ChargeItemStatus.PART_REFUND.getInfo()));
|
||||
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者账单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPayment(Long encounterId) {
|
||||
|
||||
// 患者账单信息列表
|
||||
List<EncounterPatientPaymentDto> encounterPatientPaymentList =
|
||||
outpatientRefundAppMapper.selectEncounterPatientPayment(encounterId, PaymentStatus.SUCCESS.getValue(),
|
||||
PaymentStatus.REFUND_PART.getValue(), PaymentStatus.REFUND_ALL.getValue());
|
||||
|
||||
// 获取付款id集合
|
||||
List<Long> paymentIdList =
|
||||
encounterPatientPaymentList.stream().map(EncounterPatientPaymentDto::getId).collect(Collectors.toList());
|
||||
if (paymentIdList.isEmpty()) {
|
||||
return R.ok(null);
|
||||
}
|
||||
// 根据付款id获取对应收费项目的id列表(费用项id)
|
||||
List<Long> chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList);
|
||||
|
||||
// 根据收费项目id列表查询费用项
|
||||
List<RefundItemDto> refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
refundItemList.forEach(e -> {
|
||||
// 退费状态
|
||||
e.setRefundStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getRefundStatus()));
|
||||
// 发放状态
|
||||
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
|
||||
// 执行状态
|
||||
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
|
||||
|
||||
});
|
||||
|
||||
return R.ok(refundItemList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账单退费
|
||||
*
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> refundPayment(List<RefundItemParam> refundItemList) {
|
||||
|
||||
// 未退费用项,生成新的请求发放费用项
|
||||
List<RefundItemParam> creatList = new ArrayList<>();
|
||||
for (RefundItemParam param : refundItemList) {
|
||||
if (!param.getRefundFlg()) {
|
||||
// 未退费费用项list
|
||||
creatList.add(param);
|
||||
}
|
||||
}
|
||||
|
||||
if (!creatList.isEmpty()) {
|
||||
// 未退费费用项id集合
|
||||
List<Long> creatChargeItemIdList =
|
||||
creatList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
|
||||
// 根据费用项id查询费用项请求发放信息
|
||||
List<RefundItemDto> creatChargeItemList = outpatientRefundAppMapper.selectRefundItem(creatChargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
|
||||
for (RefundItemDto creatdDto : creatChargeItemList) {
|
||||
|
||||
// 未退费用项,生成新的请求,发放,费用项
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 药品请求查询
|
||||
MedicationRequest medicationRequest = medicationRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的药品请求
|
||||
medicationRequest.setId(null); // 药品请求id
|
||||
medicationRequest
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); // 药品请求编码
|
||||
medicationRequest.setPrescriptionNo(String.valueOf("C" + creatdDto.getPrescriptionNo())); // 处方号
|
||||
medicationRequestService.save(medicationRequest);
|
||||
|
||||
// 药品发放查询
|
||||
MedicationDispense medicationDispense =
|
||||
medicationDispenseService.getById(creatdDto.getDispenseId());
|
||||
// 生成新的药品发放
|
||||
medicationDispense.setId(null); // 药品发放id
|
||||
medicationDispense
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4)); // 药品发放编码
|
||||
medicationDispense.setMedReqId(medicationRequest.getId()); // 药品请求id
|
||||
medicationDispenseService.save(medicationDispense);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(medicationRequest.getBusNo())); // 编码
|
||||
chargeItem.setPrescriptionNo(String.valueOf("C" + creatdDto.getPrescriptionNo())); // 处方号
|
||||
chargeItem.setServiceId(medicationRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 服务请求查询
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的服务请求
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); // 服务请求编码
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo())); // 编码
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 耗材请求查询
|
||||
DeviceRequest deviceRequest = deviceRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的耗材请求
|
||||
deviceRequest.setId(null); // 耗材请求id
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
|
||||
deviceRequestService.save(deviceRequest);
|
||||
|
||||
// 耗材发放查询
|
||||
DeviceDispense deviceDispense = deviceDispenseService.getById(creatdDto.getDispenseId());
|
||||
// 生成新的耗材发放
|
||||
deviceDispense.setId(null); // 耗材id
|
||||
deviceDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4)); // 器材发放id
|
||||
deviceDispense.setDeviceReqId(deviceRequest.getId()); // 器材请求id
|
||||
deviceDispenseService.save(deviceDispense);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo())); // 编码
|
||||
chargeItem.setServiceId(deviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 全部退费
|
||||
// 退费费用项id集合
|
||||
List<Long> chargeItemIdList =
|
||||
refundItemList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
|
||||
|
||||
// 根据费用项id查询费用项请求发放信息
|
||||
List<RefundItemDto> chargeItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
|
||||
List<Long> medDisIdList = new ArrayList<>();
|
||||
List<Long> devDisIdList = new ArrayList<>();
|
||||
List<Long> serReqIdList = new ArrayList<>();
|
||||
|
||||
for (RefundItemDto dto : chargeItemList) {
|
||||
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 药品需要先退药
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 药品请求查询
|
||||
MedicationRequest medicationRequest = medicationRequestService.getById(dto.getRequestId());
|
||||
if (medicationRequest.getRefundMedicineId() != null) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 生成药品请求(退药)
|
||||
medicationRequest.setId(null); // 药品请求id
|
||||
medicationRequest
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); // 药品请求编码
|
||||
medicationRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
medicationRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
medicationRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
medicationRequest.setRefundMedicineId(dto.getRequestId()); // 退药id
|
||||
medicationRequest.setPrescriptionNo(String.valueOf("T" + dto.getPrescriptionNo()));
|
||||
medicationRequestService.save(medicationRequest);
|
||||
|
||||
} else {
|
||||
if (DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(dto.getNotPerformedReason())) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
medDisIdList.add(dto.getDispenseId());
|
||||
}
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 诊疗项目需医技科室同意退费
|
||||
if (RequestStatus.COMPLETED.getValue().equals(dto.getServiceStatus())) {
|
||||
// 服务请求查询
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(dto.getRequestId());
|
||||
if (serviceRequest.getRefundServiceId() != null) {
|
||||
throw new ServiceException("已申请退费,请勿重复申请");
|
||||
}
|
||||
// 生成服务请求(取消服务)
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); // 服务请求编码
|
||||
serviceRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
serviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
serviceRequest.setRefundServiceId(dto.getRequestId()); // 退药id
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
} else {
|
||||
if (RequestStatus.STOPPED.getValue().equals(dto.getServiceStatus())) {
|
||||
throw new ServiceException("已申请退费,请勿重复申请");
|
||||
}
|
||||
serReqIdList.add(dto.getServiceId());
|
||||
}
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 耗材需要先退药
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 耗材请求查询
|
||||
DeviceRequest deviceRequest = deviceRequestService.getById(dto.getRequestId());
|
||||
if (deviceRequest.getRefundDeviceId() == null) {
|
||||
// 生成耗材请求(退耗材)
|
||||
deviceRequest.setId(null); // 耗材请求id
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
|
||||
deviceRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
deviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
deviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
deviceRequest.setRefundDeviceId(dto.getRequestId()); // 退药id
|
||||
deviceRequestService.save(deviceRequest);
|
||||
}
|
||||
} else if (!DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())) {
|
||||
devDisIdList.add(dto.getDispenseId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新收费状态:退费中
|
||||
chargeItemService.updateRefundChargeStatus(chargeItemIdList);
|
||||
|
||||
if (!medDisIdList.isEmpty()) {
|
||||
// 更新未发放药品状态:停止发放,停止原因:退费
|
||||
medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
}
|
||||
if (!devDisIdList.isEmpty()) {
|
||||
// 更新未发放耗材状态:停止发放,停止原因:退费
|
||||
deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
}
|
||||
if (!serReqIdList.isEmpty()) {
|
||||
// 更新未执行诊疗状态:停止
|
||||
serviceRequestService.updateStopRequestStatus(serReqIdList);
|
||||
}
|
||||
|
||||
// 返回退费成功信息
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"门诊退费"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结算过的就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterPatientPageParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
encounterPatientPageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr,
|
||||
CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo,
|
||||
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)),
|
||||
request);
|
||||
// 就诊患者分页列表
|
||||
Page<EncounterPatientPageDto> encounterPatientPage =
|
||||
outpatientRefundAppMapper.selectBilledEncounterPatientPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(),
|
||||
AccountType.MEDICAL_ELECTRONIC_CERTIFICATE.getCode(), EncounterClass.AMB.getValue());
|
||||
|
||||
encounterPatientPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate()));
|
||||
// 合同类型枚举
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(ContractCategory.class, e.getCategoryEnum()));
|
||||
});
|
||||
return R.ok(encounterPatientPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param billDateSTime 收费时间开始
|
||||
* @param billDateETime 收费时间结束
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientRefund(Long encounterId, String billDateSTime, String billDateETime) {
|
||||
List<EncounterPatientRefundDto> refundDtoList =
|
||||
outpatientRefundAppMapper.selectEncounterPatientRefund(encounterId, ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(),
|
||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, billDateSTime, billDateETime);
|
||||
refundDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setChargeStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getChargeStatus()));
|
||||
// 支付状态枚举
|
||||
e.setPaymentStatus_enumText(EnumUtils.getInfoByValue(PaymentStatus.class, e.getPaymentStatus()));
|
||||
// 发药状态
|
||||
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
|
||||
// 诊疗执行枚举
|
||||
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
|
||||
});
|
||||
return R.ok(refundDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRegenerateCharge(Long encounterId) {
|
||||
return R.ok(chargeItemService.getRegenerateCharge(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
@Override
|
||||
public R<?> verifyRefundable(List<Long> chargeItemIdList) {
|
||||
// 查询收费项目信息
|
||||
List<ChargeItem> chargeItemList = chargeItemService.listByIds(chargeItemIdList);
|
||||
|
||||
// 分别获取各个请求id列表
|
||||
List<Long> medReqIdList = new ArrayList<>();
|
||||
List<Long> devReqIdList = new ArrayList<>();
|
||||
chargeItemList.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> devReqIdList.add(item.getServiceId());
|
||||
}
|
||||
});
|
||||
|
||||
if (!medReqIdList.isEmpty()) {
|
||||
List<MedicationRequest> medicationRequestList = medicationRequestService.list(
|
||||
new LambdaQueryWrapper<MedicationRequest>().in(MedicationRequest::getRefundMedicineId, medReqIdList));
|
||||
if (!medicationRequestList.isEmpty()) {
|
||||
if (medicationRequestList.stream().map(MedicationRequest::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(RequestStatus.CANCELLED.getValue()))) {
|
||||
throw new ServiceException("请先退药后再退费");
|
||||
}
|
||||
}
|
||||
}
|
||||
String fixmedinsCode =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
if (!HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
|
||||
if (!devReqIdList.isEmpty()) {
|
||||
List<DeviceRequest> deviceRequestList = deviceRequestService
|
||||
.list(new LambdaQueryWrapper<DeviceRequest>().in(DeviceRequest::getRefundDeviceId, devReqIdList));
|
||||
if (!deviceRequestList.isEmpty()) {
|
||||
if (deviceRequestList.stream().map(DeviceRequest::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(RequestStatus.CANCELLED.getValue()))) {
|
||||
throw new ServiceException("请先退耗材后再退费");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.mapper.PatientMapper;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.basicservice.dto.HealthcareServiceDto;
|
||||
import com.openhis.web.basicservice.mapper.HealthcareServiceBizMapper;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService;
|
||||
import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto;
|
||||
import com.openhis.web.chargemanage.dto.OrgMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PatientMetadata;
|
||||
import com.openhis.web.chargemanage.dto.PractitionerMetadata;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||
import com.openhis.web.paymentmanage.appservice.IPaymentRecService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
import com.openhis.yb.model.CancelRegPaymentModel;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 门诊挂号 应用实现类
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistrationAppService {
|
||||
|
||||
@Resource
|
||||
PatientMapper patientMapper;
|
||||
|
||||
@Resource
|
||||
OutpatientRegistrationAppMapper outpatientRegistrationAppMapper;
|
||||
|
||||
@Resource
|
||||
HealthcareServiceBizMapper healthcareServiceBizMapper;
|
||||
|
||||
@Resource
|
||||
IEncounterService iEncounterService;
|
||||
|
||||
@Resource
|
||||
IAccountService iAccountService;
|
||||
|
||||
@Resource
|
||||
IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
IOrganizationService iOrganizationService;
|
||||
|
||||
@Resource
|
||||
YbManager ybManager;
|
||||
|
||||
@Resource
|
||||
IPaymentRecService iPaymentRecService;
|
||||
|
||||
@Resource
|
||||
IPatientIdentifierService patientIdentifierService;
|
||||
|
||||
/**
|
||||
* 门诊挂号 - 查询患者信息
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者信息
|
||||
*/
|
||||
@Override
|
||||
public Page<PatientMetadata> getPatientMetadataBySearchKey(String searchKey, Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<Patient> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("id_card", "name", "py_str", "wb_str")), null);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("update_time");
|
||||
// 通过证件号匹配 patient
|
||||
if (StringUtils.isNotEmpty(searchKey)) {
|
||||
PatientIdentifier patientIdentifier = patientIdentifierService
|
||||
.getOne(new LambdaQueryWrapper<PatientIdentifier>().eq(PatientIdentifier::getIdentifierNo, searchKey));
|
||||
if (patientIdentifier != null) {
|
||||
queryWrapper.or(q -> q.eq("id", patientIdentifier.getPatientId()));
|
||||
}
|
||||
}
|
||||
// 患者信息
|
||||
Page<PatientMetadata> patientMetadataPage =
|
||||
HisPageUtils.selectPage(patientMapper, queryWrapper, pageNo, pageSize, PatientMetadata.class);
|
||||
// 现有就诊过的患者id集合
|
||||
List<Long> patientIdList =
|
||||
iEncounterService.list().stream().map(e -> e.getPatientId()).collect(Collectors.toList());
|
||||
|
||||
patientMetadataPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
// 初复诊
|
||||
e.setFirstEnum_enumText(patientIdList.contains(e.getId()) ? EncounterType.FOLLOW_UP.getInfo()
|
||||
: EncounterType.INITIAL.getInfo());
|
||||
|
||||
});
|
||||
return patientMetadataPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门诊科室数据
|
||||
*
|
||||
* @return 门诊科室
|
||||
*/
|
||||
@Override
|
||||
public List<OrgMetadata> getOrgMetadata() {
|
||||
List<Organization> list =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
|
||||
List<OrgMetadata> orgMetadataList = new ArrayList<>();
|
||||
OrgMetadata orgMetadata;
|
||||
for (Organization organization : list) {
|
||||
orgMetadata = new OrgMetadata();
|
||||
BeanUtils.copyProperties(organization, orgMetadata);
|
||||
orgMetadataList.add(orgMetadata);
|
||||
}
|
||||
return orgMetadataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据科室id筛选医生
|
||||
*
|
||||
* @param orgId 科室ID
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 筛选医生
|
||||
*/
|
||||
@Override
|
||||
public IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long orgId, String searchKey, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<PractitionerMetadata> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
|
||||
IPage<PractitionerMetadata> practitionerMetadataPage =
|
||||
outpatientRegistrationAppMapper.getPractitionerMetadataPage(new Page<>(pageNo, pageSize), orgId,
|
||||
PractitionerRoles.DOCTOR.getCode(), queryWrapper);
|
||||
practitionerMetadataPage.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
});
|
||||
return practitionerMetadataPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构id筛选服务项目
|
||||
*
|
||||
* @param organizationId 机构id
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 服务项目
|
||||
*/
|
||||
@Override
|
||||
public IPage<HealthcareServiceDto> getHealthcareMetadataByOrganizationId(Long organizationId, String searchKey,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
HealthcareServiceDto healthcareServiceDto = new HealthcareServiceDto();
|
||||
healthcareServiceDto.setOfferedOrgId(organizationId);
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper = HisQueryUtils.buildQueryWrapper(healthcareServiceDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("name", "charge_name")), null);
|
||||
return healthcareServiceBizMapper.getHealthcareServicePage(new Page<>(pageNo, pageSize),
|
||||
CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
|
||||
queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退号
|
||||
*
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> returnRegister(CancelRegPaymentDto cancelRegPaymentDto) {
|
||||
Encounter byId = iEncounterService.getById(cancelRegPaymentDto.getEncounterId());
|
||||
if (EncounterStatus.CANCELLED.getValue().equals(byId.getStatusEnum())) {
|
||||
return R.fail(null, "该患者已经退号,请勿重复退号");
|
||||
}
|
||||
iEncounterService.returnRegister(cancelRegPaymentDto.getEncounterId());
|
||||
// 查询账户信息
|
||||
Account account = iAccountService
|
||||
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, cancelRegPaymentDto.getEncounterId())
|
||||
.ne(Account::getTypeCode, AccountType.PERSONAL_CASH_ACCOUNT.getCode())
|
||||
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
|
||||
|
||||
CancelPaymentDto cancelPaymentDto = new CancelPaymentDto();
|
||||
BeanUtils.copyProperties(cancelRegPaymentDto, cancelPaymentDto);
|
||||
|
||||
// 开通医保的处理
|
||||
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
|
||||
&& account != null && !CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(account.getContractNo())) {
|
||||
CancelRegPaymentModel model = new CancelRegPaymentModel();
|
||||
BeanUtils.copyProperties(cancelRegPaymentDto, model);
|
||||
model.setContractNo(account.getContractNo());
|
||||
ybManager.cancelReg(model);
|
||||
cancelPaymentDto.setSetlId(model.getSetlId());
|
||||
// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"医保退号"}));
|
||||
}
|
||||
|
||||
R<?> result = iPaymentRecService.cancelRegPayment(cancelPaymentDto);
|
||||
|
||||
PaymentReconciliation paymentRecon = null;
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation)result.getData();
|
||||
}
|
||||
if (paymentRecon != null) {
|
||||
String[] strings = paymentRecon.getChargeItemIds().split(",");
|
||||
List<Long> chargeItemIds = new ArrayList<>();
|
||||
for (String string : strings) {
|
||||
chargeItemIds.add(Long.parseLong(string));
|
||||
}
|
||||
// 更新收费状态:已退费
|
||||
if (!chargeItemIds.isEmpty()) {
|
||||
iChargeItemService.updatePaymentStatus(chargeItemIds, ChargeItemStatus.REFUNDED.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 2025/05/05 该处保存费用项后,会通过统一收费处理进行收费
|
||||
return R.ok(paymentRecon, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"退号"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
@Override
|
||||
public IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<CurrentDayEncounterDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")),
|
||||
request);
|
||||
|
||||
IPage<CurrentDayEncounterDto> currentDayEncounter = outpatientRegistrationAppMapper.getCurrentDayEncounter(
|
||||
new Page<>(pageNo, pageSize), EncounterClass.AMB.getValue(), ParticipantType.ADMITTER.getCode(),
|
||||
queryWrapper, ChargeItemContext.REGISTER.getValue(), PaymentStatus.SUCCESS.getValue());
|
||||
currentDayEncounter.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 就诊状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(EncounterStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
return currentDayEncounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelRegister(Long encounterId) {
|
||||
iEncounterService.removeById(encounterId);
|
||||
return R.ok("已取消挂号");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.appservice.IInpatientChargeAppService;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊收费 controller
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/inpa-charge")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InpatientChargeController {
|
||||
|
||||
@Autowired
|
||||
private IInpatientChargeAppService inpatientChargeAppService;
|
||||
|
||||
/**
|
||||
* 收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> outpatientChargeInit() {
|
||||
return inpatientChargeAppService.outpatientChargeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/encounter-patient-page")
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(inpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
|
||||
pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-prescription")
|
||||
public R<?> getEncounterPatientPrescription(@RequestParam Long encounterId, @RequestParam String startTime,
|
||||
@RequestParam String endTime) {
|
||||
return R.ok(inpatientChargeAppService.getEncounterPatientPrescription(encounterId, startTime, endTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/self-pay")
|
||||
public R<?> changeToSelfPay(@RequestParam Long encounterId) {
|
||||
return inpatientChargeAppService.changeToSelfPay(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/medical-insurance")
|
||||
public R<?> changeToMedicalInsurance(@RequestParam Long encounterId) {
|
||||
return inpatientChargeAppService.changeToMedicalInsurance(encounterId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientChargeAppService;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊收费 controller
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/charge")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientChargeController {
|
||||
|
||||
@Autowired
|
||||
private IOutpatientChargeAppService outpatientChargeAppService;
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> outpatientChargeInit() {
|
||||
return outpatientChargeAppService.outpatientChargeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/encounter-patient-page")
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(outpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
|
||||
pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-prescription")
|
||||
public R<?> getEncounterPatientPrescription(@RequestParam Long encounterId) {
|
||||
return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/self-pay")
|
||||
public R<?> changeToSelfPay(@RequestParam Long encounterId) {
|
||||
return outpatientChargeAppService.changeToSelfPay(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自费转医保
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/medical-insurance")
|
||||
public R<?> changeToMedicalInsurance(@RequestParam Long encounterId) {
|
||||
return outpatientChargeAppService.changeToMedicalInsurance(encounterId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientPricingAppService;
|
||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊划价 controller
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/pricing")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientPricingController {
|
||||
|
||||
private final IOutpatientPricingAppService iOutpatientPricingAppService;
|
||||
|
||||
/**
|
||||
* 查询就诊患者信息
|
||||
*
|
||||
* @param patientInfoDto 查询条件 (前端可传 statusEnum 区分就诊状态tab)
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 就诊患者信息
|
||||
*/
|
||||
@GetMapping(value = "/patient-info")
|
||||
public R<?> getPatientInfo(PatientInfoDto patientInfoDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(iOutpatientPricingAppService.getPatientInfo(patientInfoDto, searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询医嘱信息
|
||||
*
|
||||
* @param adviceBaseDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param locationId 药房id
|
||||
* @param organizationId 患者挂号对应的科室id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 医嘱信息
|
||||
*/
|
||||
@GetMapping(value = "/advice-base-info")
|
||||
public R<?> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "locationId", required = false) Long locationId,
|
||||
@RequestParam(value = "organizationId") Long organizationId,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(iOutpatientPricingAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, organizationId,
|
||||
pageNo, pageSize));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.RefundItemParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊退费 controller
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/refund")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientRefundController {
|
||||
|
||||
@Autowired
|
||||
private IOutpatientRefundAppService outpatientRefundAppService;
|
||||
|
||||
/**
|
||||
* 门诊退费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> outpatientRefundInit() {
|
||||
return outpatientRefundAppService.outpatientRefundInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询结算过的就诊患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/encounter-patient-page")
|
||||
public R<?> getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return outpatientRefundAppService.getBilledEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的账单(申请退费列表)
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者账单列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-payment")
|
||||
public R<?> getEncounterPatientPayment(@RequestParam Long encounterId) {
|
||||
return outpatientRefundAppService.getEncounterPatientPayment(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账单申请退费
|
||||
*
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping(value = "/refund-payment")
|
||||
public R<?> refundPayment(@RequestBody List<RefundItemParam> refundItemList) {
|
||||
return outpatientRefundAppService.refundPayment(refundItemList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param billDateSTime 收费时间开始
|
||||
* @param billDateETime 收费时间结束
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-refund")
|
||||
public R<?> getEncounterPatientRefund(@RequestParam Long encounterId, @RequestParam String billDateSTime,
|
||||
@RequestParam String billDateETime) {
|
||||
return outpatientRefundAppService.getEncounterPatientRefund(encounterId, billDateSTime, billDateETime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
@GetMapping(value = "/regenerate_charge")
|
||||
public R<?> getRegenerateCharge(@RequestParam Long encounterId) {
|
||||
return outpatientRefundAppService.getRegenerateCharge(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
@GetMapping(value = "/verify_refund")
|
||||
public R<?> verifyRefundable(@RequestParam List<Long> chargeItemIdList) {
|
||||
return outpatientRefundAppService.verifyRefundable(chargeItemIdList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.PriorityLevel;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationInitDto;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊挂号 controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/register")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class OutpatientRegistrationController {
|
||||
|
||||
private final IOutpatientRegistrationAppService iOutpatientRegistrationAppService;
|
||||
|
||||
@Autowired
|
||||
private IEleInvoiceService eleInvoiceService;
|
||||
|
||||
/**
|
||||
* 基础数据初始化
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
OutpatientRegistrationInitDto outpatientRegistrationInitDto = new OutpatientRegistrationInitDto();
|
||||
// 优先级
|
||||
List<OutpatientRegistrationInitDto.priorityLevelOption> priorityLevelOptionOptions =
|
||||
Stream.of(PriorityLevel.values())
|
||||
.map(e -> new OutpatientRegistrationInitDto.priorityLevelOption(e.getValue(), e.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
outpatientRegistrationInitDto.setPriorityLevelOptionOptions(priorityLevelOptionOptions);
|
||||
return R.ok(outpatientRegistrationInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者信息
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者信息
|
||||
*/
|
||||
@GetMapping(value = "/patient-metadata")
|
||||
public R<?> getPatientMetadata(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getPatientMetadataBySearchKey(searchKey, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊科室
|
||||
*
|
||||
* @return 就诊科室集合
|
||||
*/
|
||||
@GetMapping(value = "/org-list")
|
||||
public R<?> getLocationTree() {
|
||||
return R.ok(iOutpatientRegistrationAppService.getOrgMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据科室id筛选医生
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-metadata")
|
||||
public R<?> getPractitionerMetadata(@RequestParam(value = "orgId") Long orgId,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(
|
||||
iOutpatientRegistrationAppService.getPractitionerMetadataByLocationId(orgId, searchKey, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构id筛选服务项目
|
||||
*/
|
||||
@GetMapping(value = "/healthcare-metadata")
|
||||
public R<?> getHealthcareMetadata(@RequestParam(value = "organizationId") Long organizationId,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getHealthcareMetadataByOrganizationId(organizationId, searchKey,
|
||||
pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 退号
|
||||
*
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "return")
|
||||
public R<?> returnRegister(@RequestBody CancelRegPaymentDto cancelRegPaymentDto) {
|
||||
|
||||
R<?> result = iOutpatientRegistrationAppService.returnRegister(cancelRegPaymentDto);
|
||||
// 取消付款成功后,开具发票
|
||||
if (result.getCode() == 200) {
|
||||
PaymentReconciliation paymentRecon = null;
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation)result.getData();
|
||||
}
|
||||
R<?> eleResult =
|
||||
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelRegPaymentDto.getReason());
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因取消付款成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "cancel")
|
||||
public R<?> cancelRegister(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
return iOutpatientRegistrationAppService.cancelRegister(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
@GetMapping(value = "/current-day-encounter")
|
||||
public R<?> getCurrentDayEncounter(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getCurrentDayEncounter(searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.AccountBillingStatus;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊账号 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AccountFormData {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 患者id */
|
||||
@NotNull(message = "患者id不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 状态枚举 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 结账状态枚举 */
|
||||
private Integer billingStatusEnum;
|
||||
|
||||
/** 账户类型编码 */
|
||||
private String typeCode; // 【01医保电子凭证 | 02 居民身份证 | 03 社会保障卡 | 04 个人现金账户】
|
||||
|
||||
/** 名称 */
|
||||
private String name; // 刷医保卡时应该会带出该信息
|
||||
|
||||
/** 账户余额 */
|
||||
private BigDecimal balanceAmount; // 刷医保卡时应该会带出该信息
|
||||
|
||||
/** 医保区域编码 */
|
||||
private String ybAreaNo; // 刷医保卡时应该会带出该信息
|
||||
|
||||
/** 合同编码 */
|
||||
private String contractNo; // 从选择的费用性质里选择合同编码
|
||||
|
||||
/** 欠费限制额度 */
|
||||
private BigDecimal limitAccount; // 刷医保卡时应该会带出该信息
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
public AccountFormData() {
|
||||
this.contractNo = CommonConstants.BusinessName.DEFAULT_CONTRACT_NO;
|
||||
this.statusEnum = AccountStatus.ACTIVE.getValue();
|
||||
this.billingStatusEnum = AccountBillingStatus.OPEN.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 费用项管理 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ChargeItemFormData {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 患者id */
|
||||
@NotNull(message = "患者id不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 层级 */
|
||||
private String busNo;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 类别 */
|
||||
private Integer contextEnum;
|
||||
|
||||
/** 发生时间 */
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 执行人Id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long performerId;
|
||||
|
||||
/** 费用定价ID */
|
||||
@NotNull(message = "费用定价ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long definitionId;
|
||||
|
||||
/** 开立人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long entererId;
|
||||
|
||||
/** 开立时间 */
|
||||
private Date enteredDate;
|
||||
|
||||
/** 医疗服务类型 */
|
||||
private String serviceTable;
|
||||
|
||||
/** 医疗服务ID */
|
||||
@NotNull(message = "医疗服务ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long serviceId;
|
||||
|
||||
/** 总价 */
|
||||
@NotNull(message = "总价不能为空")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 关联账户ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
public ChargeItemFormData() {
|
||||
this.statusEnum = ChargeItemStatus.PLANNED.getValue();
|
||||
this.contextEnum = ChargeItemContext.REGISTER.getValue();
|
||||
this.occurrenceTime = new Date();
|
||||
this.performerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
this.entererId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
this.enteredDate = new Date();
|
||||
this.serviceTable = CommonConstants.TableName.ADM_HEALTHCARE_SERVICE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 费用性质 元数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ContractMetadata {
|
||||
/** 合同名称 */
|
||||
private String contractName;
|
||||
/** 合同编码 */
|
||||
private String busNo;
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 当天就诊信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CurrentDayEncounterDto {
|
||||
|
||||
/** 租户ID */
|
||||
private Integer tenantId;
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 科室ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
/**
|
||||
* 挂号类型
|
||||
*/
|
||||
private String healthcareName;
|
||||
|
||||
/**
|
||||
* 专家账号id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerUserId;
|
||||
|
||||
/**
|
||||
* 专家
|
||||
*/
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 费用性质
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 患者性别
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 证件号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 就诊状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 挂号日期/时间
|
||||
*/
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 账户名称
|
||||
*/
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 挂号人
|
||||
*/
|
||||
private String entererName;
|
||||
|
||||
/**
|
||||
* 收费项目ids
|
||||
*/
|
||||
private String chargeItemIds;
|
||||
|
||||
/**
|
||||
* 付款id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long paymentId;
|
||||
|
||||
/**
|
||||
* 发票url地址
|
||||
*/
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private String age;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 就诊诊断 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterDiagnosisFormData {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 诊断ID
|
||||
*/
|
||||
@NotBlank(message = "诊断ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long conditionId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.*;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterFormData {
|
||||
|
||||
/**
|
||||
* 患者ID
|
||||
*/
|
||||
@NotNull(message = "患者ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 状态编码
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 类别编码
|
||||
*/
|
||||
private Integer classEnum;
|
||||
|
||||
/**
|
||||
* 类别医保编码
|
||||
*/
|
||||
private Integer ybClassEnum;
|
||||
|
||||
/**
|
||||
* 类别医保文本
|
||||
*/
|
||||
private String ybClassText; // 医保接口获取
|
||||
|
||||
/**
|
||||
* 优先级编码
|
||||
*/
|
||||
@NotNull(message = "优先级编码不能为空")
|
||||
private Integer priorityEnum;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private Integer typeEnum;
|
||||
|
||||
/**
|
||||
* 服务ID
|
||||
*/
|
||||
@NotNull(message = "服务ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long serviceTypeId;
|
||||
|
||||
/**
|
||||
* 就诊对象状态
|
||||
*/
|
||||
private Integer subjectStatusEnum;
|
||||
|
||||
/**
|
||||
* 机构ID
|
||||
*/
|
||||
@NotNull(message = "机构ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
public EncounterFormData() {
|
||||
this.statusEnum = EncounterStatus.PLANNED.getValue();
|
||||
this.classEnum = EncounterClass.AMB.getValue();
|
||||
this.ybClassEnum = EncounterYbClass.ORDINARY_OUTPATIENT.getValue();
|
||||
this.typeEnum = OutpatientClass.GENERAL_OUTPATIENT_SERVICE.getValue();
|
||||
this.subjectStatusEnum = EncounterSubjectStatus.TRIAGED.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.EncounterLocationStatus;
|
||||
import com.openhis.common.enums.LocationForm;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 就诊位置 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterLocationFormData {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 位置ID
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/** 状态枚举 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 物理形式枚举 */
|
||||
private Integer formEnum;
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
public EncounterLocationFormData() {
|
||||
this.statusEnum = EncounterLocationStatus.PLANNED.getValue();
|
||||
this.formEnum = LocationForm.ROOM.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.ParticipantType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊参数者 表单数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterParticipantFormData {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 参与者类型 */
|
||||
private String typeCode;
|
||||
|
||||
/** 参与者ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
public EncounterParticipantFormData() {
|
||||
this.typeCode = ParticipantType.REGISTRATION_DOCTOR.getCode();// 挂号医生
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊患者分页dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterPatientPageDto {
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 患者院内编码/病历号
|
||||
*/
|
||||
private String patientBusNo;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 拼音码
|
||||
*/
|
||||
private String patientPyStr;
|
||||
|
||||
/**
|
||||
* 五笔码
|
||||
*/
|
||||
private String patientWbStr;
|
||||
|
||||
/**
|
||||
* 就诊编码
|
||||
*/
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 性别编码
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthDate;
|
||||
|
||||
/**
|
||||
* 账户类型编码
|
||||
*/
|
||||
@Dict(dictCode = "account_code")
|
||||
private String typeCode;
|
||||
private String typeCode_dictText;
|
||||
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private BigDecimal balanceAmount;
|
||||
|
||||
/**
|
||||
* 接诊时间
|
||||
*/
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private String age;
|
||||
|
||||
/** 收费状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 医保总额
|
||||
*/
|
||||
private BigDecimal insuranceAmount;
|
||||
|
||||
/**
|
||||
* 自费总额
|
||||
*/
|
||||
private BigDecimal selfAmount;
|
||||
|
||||
/**
|
||||
* 付款总额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/** 合同类型 */
|
||||
private Integer categoryEnum;
|
||||
private String categoryEnum_enumText;
|
||||
|
||||
/**
|
||||
* 结算时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date maxBillDate;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊患者分页查询条件
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterPatientPageParam {
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 患者院内编码/病历号
|
||||
*/
|
||||
private String patientBusNo;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 拼音码
|
||||
*/
|
||||
private String patientPyStr;
|
||||
|
||||
/**
|
||||
* 五笔码
|
||||
*/
|
||||
private String patientWbStr;
|
||||
|
||||
/**
|
||||
* 就诊编码
|
||||
*/
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 接诊时间
|
||||
*/
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 住院开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 收费时间
|
||||
*/
|
||||
private Date billTime;
|
||||
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊患者账单 dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterPatientPaymentDto {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 就诊ID */
|
||||
private Long encounterId;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 关联账户ID */
|
||||
private Long accountId;
|
||||
|
||||
/** 支付状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 关联ID */
|
||||
private Long relationId;
|
||||
|
||||
/** 支付的业务标识符 */
|
||||
private String paymentNo;
|
||||
|
||||
/** 付款类别 */
|
||||
private Integer paymentEnum;
|
||||
|
||||
/** 支付位置 */
|
||||
@Dict(dictTable = "adm_location", dictText = "name", dictCode = "id")
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
|
||||
/** 到期时间 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 应收金额 */
|
||||
private BigDecimal tenderedAmount;
|
||||
|
||||
/** 找零金额 */
|
||||
private BigDecimal returnedAmount;
|
||||
|
||||
/** 付款总额 */
|
||||
private BigDecimal displayAmount;
|
||||
|
||||
/** 合同编码 */
|
||||
private String contractNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 就诊患者处方 dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterPatientPrescriptionDto {
|
||||
|
||||
/** 收费项目类型 */
|
||||
private Integer contextEnum;
|
||||
private String contextEnum_enumText;
|
||||
|
||||
/** 收费状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 患者id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 开立科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestingOrgId;
|
||||
|
||||
/** 数量 */
|
||||
private Long quantityValue;
|
||||
|
||||
/** 单位 */
|
||||
private String quantityUnit;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 业务编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 收款人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
private Long entererId;
|
||||
private String entererId_dictText;
|
||||
|
||||
/** 开立时间 */
|
||||
private Date enteredDate;
|
||||
|
||||
/** 收费时间 */
|
||||
private Date billDate;
|
||||
|
||||
/** 关联账户ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long accountId;
|
||||
|
||||
/** 物品编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 物品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 特病标识 */
|
||||
@Dict(dictCode = "med_type")
|
||||
private String medTypeCode;
|
||||
private String medTypeCode_dictText;
|
||||
|
||||
/** 合同编码 */
|
||||
private String contractNo;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 合同名称 */
|
||||
private String contractName;
|
||||
|
||||
/** 服务所在表 */
|
||||
private String serviceTable;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import com.openhis.yb.dto.PaymentDetailDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 患者退款信息列表
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-05-05
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterPatientRefundDto {
|
||||
|
||||
/** 支付ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long paymentId;
|
||||
|
||||
/** 收款人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long entererId;
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 支付的患者ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 发放ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 收费项目编号 */
|
||||
private String busNo;
|
||||
|
||||
/** 合同编号 */
|
||||
private String contractNo;
|
||||
|
||||
/** 项目名 */
|
||||
private String itemName;
|
||||
|
||||
/** 项目名 */
|
||||
private String orgName;
|
||||
|
||||
/** 收费项目ids */
|
||||
private String chargeItemIds;
|
||||
|
||||
/** 收款人 */
|
||||
private String entererName;
|
||||
|
||||
/** 服务表名 */
|
||||
private String serviceTable;
|
||||
|
||||
/** 收费状态 */
|
||||
private Integer chargeStatus;
|
||||
private String chargeStatus_enumText;
|
||||
|
||||
/** 支付状态 */
|
||||
private Integer paymentStatus;
|
||||
private String paymentStatus_enumText;
|
||||
|
||||
/** 发放状态 */
|
||||
private Integer dispenseStatus;
|
||||
private String dispenseStatus_enumText;
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer serviceStatus;
|
||||
private String serviceStatus_enumText;
|
||||
|
||||
/** 数量 */
|
||||
private Integer quantityValue;
|
||||
|
||||
/** 已发药数量 */
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/** 单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String quantityUnit;
|
||||
private String quantityUnit_dictText;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 结算时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date billDate;
|
||||
|
||||
/**
|
||||
* 支付明细列表
|
||||
*/
|
||||
private List<PaymentDetailDto> paymentDetailList;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 门诊科室信息 元数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrgMetadata {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊费用相关初始化
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-30
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientInitDto {
|
||||
|
||||
private List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions;
|
||||
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
@Data
|
||||
public static class chargeItemStatusOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public chargeItemStatusOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user