Compare commits
2 Commits
1276dc4adb
...
v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99773d092e | ||
|
|
0dbed951d2 |
@@ -1,60 +0,0 @@
|
||||
package com.core.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.system.domain.dto.SaveTenantOptionDetailDto;
|
||||
import com.core.system.domain.dto.TenantOptionDto;
|
||||
import com.core.system.service.ISysTenantOptionService;
|
||||
|
||||
/**
|
||||
* 租户配置项信息controller
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/tenant-option")
|
||||
public class SysTenantOptionController extends BaseController {
|
||||
@Autowired
|
||||
private ISysTenantOptionService sysTenantOptionService;
|
||||
|
||||
/**
|
||||
* 查询租户配置项详情列表
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @return 租户配置项详情列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||
@GetMapping("/detail-list/{tenantId}")
|
||||
public R<List<TenantOptionDto>> getTenantOptionDetailList(@PathVariable Integer tenantId) {
|
||||
return R.ok(sysTenantOptionService.getTenantOptionDetailList(tenantId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存租户配置项详情列表
|
||||
*
|
||||
* @param saveTenantOptionDetailDto 参数DTO
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||
@PostMapping("/detail-list")
|
||||
public R<?> saveTenantOptionDetailList(@RequestBody SaveTenantOptionDetailDto saveTenantOptionDetailDto) {
|
||||
return sysTenantOptionService.saveTenantOptionDetailList(saveTenantOptionDetailDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户配置项前端form表单列表
|
||||
*
|
||||
* @return 租户配置项前端form表单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||
@GetMapping("/form-list")
|
||||
public R<?> getTenantOptionFormList() {
|
||||
return R.ok(sysTenantOptionService.getTenantOptionFormList());
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.core.web.util;
|
||||
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
|
||||
/**
|
||||
* 租户配置工具类
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public class TenantOptionUtil {
|
||||
|
||||
/**
|
||||
* 获取租户配置项内容
|
||||
*
|
||||
* @param optionDict 租户配置项字典
|
||||
* @return 租户配置项内容
|
||||
*/
|
||||
public static String getOptionContent(TenantOptionDict optionDict) {
|
||||
LoginUser loginUser;
|
||||
try {
|
||||
loginUser = SecurityUtils.getLoginUser();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
if (loginUser == null) {
|
||||
return null;
|
||||
}
|
||||
if (loginUser.getOptionMap() == null || loginUser.getOptionMap().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return loginUser.getOptionMap().get(optionDict.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package com.core.common.enums;
|
||||
|
||||
/**
|
||||
* 租户配置项字典(不存在DB中,以此文件为基准,新增修改只需在这里改)
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public enum TenantOptionDict {
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
HOSPITAL_NAME("hospitalName", "医院名称", 0),
|
||||
/**
|
||||
* 医疗机构等级
|
||||
*/
|
||||
MEDINS_LV("medinsLv", "医疗机构等级", 1),
|
||||
/**
|
||||
* 定点医药机构编号
|
||||
*/
|
||||
FIXMEDINS_CODE("fixmedinsCode", "定点医药机构编号", 2),
|
||||
/**
|
||||
* 电子发票appid
|
||||
*/
|
||||
APP_ID("app_id", "电子发票appid", 3),
|
||||
/**
|
||||
* 电子发票key
|
||||
*/
|
||||
KEY("key", "电子发票key", 4),
|
||||
/**
|
||||
* 电子发票url
|
||||
*/
|
||||
URL("url", "电子发票url", 5),
|
||||
/**
|
||||
* 医保开关
|
||||
*/
|
||||
YB_SWITCH("yb_switch", "医保开关", 6),
|
||||
/**
|
||||
* 客户端私钥
|
||||
*/
|
||||
CLI_PRV_KEY("cliPrvKey", "客户端私钥", 7),
|
||||
/**
|
||||
* 客户端公钥
|
||||
*/
|
||||
CLI_PUB_KEY("cliPubKey", "客户端公钥", 8),
|
||||
/**
|
||||
* 服务端公钥
|
||||
*/
|
||||
SERVER_PUB_KEY("serverPubKey", "服务端公钥", 9),
|
||||
/**
|
||||
* 定点医药机构名称
|
||||
*/
|
||||
FIXMEDINS_NAME("fixmedinsName", "定点医药机构名称", 10),
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
ADMVS("admvs", "行政区划", 11),
|
||||
/**
|
||||
* 授权范围
|
||||
*/
|
||||
SCOPE("scope", "授权范围", 12),
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
GRANT_TYPE("grantType", "授权类型", 13),
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
PASSWORD("password", "密码", 14),
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
USERNAME("username", "用户名", 15),
|
||||
/**
|
||||
* 客户端安全码
|
||||
*/
|
||||
CLIENT_SECRET("clientSecret", "客户端安全码", 16),
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
CLIENT_ID("clientId", "客户端ID", 17),
|
||||
/**
|
||||
* 生产环境客户端公钥
|
||||
*/
|
||||
PROD_CLI_PUB_KEY("prod_cliPubKey", "生产环境客户端公钥", 18),
|
||||
/**
|
||||
* 生产环境客户端私钥
|
||||
*/
|
||||
PROD_CLI_PRV_KEY("prod_cliPrvKey", "生产环境客户端私钥", 19),
|
||||
/**
|
||||
* 生产环境客户端ID
|
||||
*/
|
||||
PROD_CLIENT_ID("prod_clientId", "生产环境客户端ID", 20),
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
FILE_PATH("filePath", "文件路径", 21),
|
||||
/**
|
||||
* 电子地址
|
||||
*/
|
||||
ELE_ADDRESS("eleAddress", "电子地址", 22),
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
ADDRESS("address", "服务地址", 23),
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
TIME("time", "超时时间", 24),
|
||||
/**
|
||||
* 是否加密
|
||||
*/
|
||||
IS_ENCRYPT("isEncrypt", "是否加密", 25),
|
||||
/**
|
||||
* 医保区划
|
||||
*/
|
||||
INSUPLC_ADMDVS("insuplc_admdvs", "医保区划", 26),
|
||||
/**
|
||||
* 电子处方appId
|
||||
*/
|
||||
PRE_APP_ID("pre_app_id", "电子处方appId", 27),
|
||||
/**
|
||||
* 电子处方appSecret
|
||||
*/
|
||||
PRE_APP_SECRET("pre_app_secret", "电子处方appSecret", 28),
|
||||
/**
|
||||
* 电子处方私钥
|
||||
*/
|
||||
APP_PRVKEY("APP_PRVKEY", "电子处方私钥", 29),
|
||||
/**
|
||||
* 电子处方公钥
|
||||
*/
|
||||
PLAF_PUBKEY("PLAF_PUBKEY", "电子处方公钥", 30),
|
||||
/**
|
||||
* 医保客户端ID
|
||||
*/
|
||||
YB_CLIENT_ID("ybClientId", "医保客户端ID", 31),
|
||||
/**
|
||||
* 医保客户端安全码
|
||||
*/
|
||||
YB_CLIENT_SECRET("ybClientSecret", "医保客户端安全码", 32),
|
||||
/**
|
||||
* 医保用户名
|
||||
*/
|
||||
YB_USERNAME("ybUsername", "医保用户名", 33),
|
||||
/**
|
||||
* 医保密码
|
||||
*/
|
||||
YB_PASSWORD("ybPassword", "医保密码", 34),
|
||||
/**
|
||||
* 医保授权类型
|
||||
*/
|
||||
YB_GRANT_TYPE("ybGrantType", "医保授权类型", 35),
|
||||
/**
|
||||
* 医保授权范围
|
||||
*/
|
||||
YB_SCOPE("ybScope", "医保授权范围", 36),
|
||||
/**
|
||||
* 医保密钥
|
||||
*/
|
||||
YB_CLI_PRV_KEY("ybCliPrvKey", "医保密钥", 37),
|
||||
/**
|
||||
* 医保服务URL
|
||||
*/
|
||||
YB_URL("ybUrl", "医保服务URL", 38),
|
||||
/**
|
||||
* 医院等级
|
||||
*/
|
||||
HOSPITAL_LV("hospital_lv", "医院等级", 39),
|
||||
/**
|
||||
* LIS接口地址
|
||||
*/
|
||||
LIS_API_URL("lisApiUrl", "LIS接口地址", 40),
|
||||
/**
|
||||
* LISAppId
|
||||
*/
|
||||
LIS_APP_ID("lisAppId", "LISAppId", 41),
|
||||
/**
|
||||
* LISAppSecret
|
||||
*/
|
||||
LIS_APP_SECRET("lisAppSecret", "LISAppSecret", 42),
|
||||
/**
|
||||
* PACS接口地址
|
||||
*/
|
||||
PACS_API_URL("pacsApiUrl", "PACS接口地址", 43),
|
||||
/**
|
||||
* PACSAppId
|
||||
*/
|
||||
PACS_APP_ID("pacsAppId", "PACSAppId", 44),
|
||||
/**
|
||||
* PACSAppSecret
|
||||
*/
|
||||
PACS_APP_SECRET("pacsAppSecret", "PACSAppSecret", 45),
|
||||
/**
|
||||
* PACSAppSecret
|
||||
*/
|
||||
INVOICE_URL("invoiceUrl", "电子发票中转服务的路径", 46),
|
||||
/**
|
||||
* PACSAppSecret
|
||||
*/
|
||||
FORWARD_SWITCH("forwardSwitch", "电子发票中转服务开关", 47);
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
private final Integer sort;
|
||||
|
||||
TenantOptionDict(String code, String name, Integer sort) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public static TenantOptionDict getByCode(String code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (TenantOptionDict val : values()) {
|
||||
if (val.getCode().equals(code)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.core.common.utils;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 时间处理工具类
|
||||
*/
|
||||
public class TimeUtils {
|
||||
private static final ZoneId DEFAULT_ZONE = ZoneId.systemDefault();
|
||||
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(DEFAULT_ZONE);
|
||||
|
||||
/**
|
||||
* 解析时间字符串
|
||||
*/
|
||||
public static LocalTime parseTime(String timeStr) {
|
||||
if (timeStr == null) {
|
||||
throw new IllegalArgumentException("时间未设定");
|
||||
}
|
||||
|
||||
try {
|
||||
if (timeStr.length() == 4) {
|
||||
// 处理"0200"格式
|
||||
int hours = Integer.parseInt(timeStr.substring(0, 2));
|
||||
int minutes = Integer.parseInt(timeStr.substring(2, 4));
|
||||
return LocalTime.of(hours, minutes);
|
||||
} else if (timeStr.contains(":")) {
|
||||
// 处理"HH:mm"格式
|
||||
return LocalTime.parse(timeStr, DateTimeFormatter.ofPattern("HH:mm"));
|
||||
} else {
|
||||
throw new IllegalArgumentException("不支持的时间格式: " + timeStr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("时间解析失败: " + timeStr, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* LocalTime转Date
|
||||
*/
|
||||
public static Date localTimeToDate(LocalTime localTime) {
|
||||
LocalDateTime localDateTime = LocalDateTime.of(LocalDate.now(), localTime);
|
||||
return Date.from(localDateTime.atZone(DEFAULT_ZONE).toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转LocalDate
|
||||
*/
|
||||
public static LocalDate dateToLocalDate(Date date) {
|
||||
return date.toInstant().atZone(DEFAULT_ZONE).toLocalDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转字符串(HH:mm:ss)
|
||||
*/
|
||||
public static String dateToTimeString(Date date) {
|
||||
return date.toInstant()
|
||||
.atZone(DEFAULT_ZONE)
|
||||
.toLocalTime()
|
||||
.format(TIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转字符串(yyyy-MM-dd)
|
||||
*/
|
||||
public static String dateToDateString(Date date) {
|
||||
return date.toInstant()
|
||||
.atZone(DEFAULT_ZONE)
|
||||
.toLocalDate()
|
||||
.format(DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期时间字符串
|
||||
*/
|
||||
public static LocalDateTime parseDateTime(String dateStr) {
|
||||
return LocalDateTime.parse(dateStr, DATE_TIME_FORMATTER);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.core.system.domain.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 保存租户配置项详情Dto
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SaveTenantOptionDetailDto {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private Integer tenantId;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private List<TenantOptionDto> optionList;
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.core.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.system.domain.SysTenantOption;
|
||||
import com.core.system.domain.dto.SaveTenantOptionDetailDto;
|
||||
import com.core.system.domain.dto.TenantOptionDto;
|
||||
|
||||
/**
|
||||
* 租户配置项表Service接口
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysTenantOptionService extends IService<SysTenantOption> {
|
||||
|
||||
/**
|
||||
* 查询全部租户配置项
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @return 全部租户配置项
|
||||
*/
|
||||
Map<String, String> getAllTenantOption(Integer tenantId);
|
||||
|
||||
/**
|
||||
* 查询租户配置项详情列表
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @return 租户配置项详情列表
|
||||
*/
|
||||
List<TenantOptionDto> getTenantOptionDetailList(Integer tenantId);
|
||||
|
||||
/**
|
||||
* 保存租户配置项详情列表
|
||||
*
|
||||
* @param saveTenantOptionDetailDto 参数DTO
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveTenantOptionDetailList(SaveTenantOptionDetailDto saveTenantOptionDetailDto);
|
||||
|
||||
/**
|
||||
* 查询租户配置项前端form表单列表
|
||||
*
|
||||
* @return 租户配置项前端form表单列表
|
||||
*/
|
||||
List<TenantOptionDto> getTenantOptionFormList();
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package com.core.system.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.system.domain.SysTenantOption;
|
||||
import com.core.system.domain.dto.SaveTenantOptionDetailDto;
|
||||
import com.core.system.domain.dto.TenantOptionDto;
|
||||
import com.core.system.mapper.SysTenantOptionMapper;
|
||||
import com.core.system.service.ISysTenantOptionService;
|
||||
|
||||
/**
|
||||
* 租户配置项表Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysTenantOptionServiceImpl extends ServiceImpl<SysTenantOptionMapper, SysTenantOption>
|
||||
implements ISysTenantOptionService {
|
||||
|
||||
/**
|
||||
* 查询全部租户配置项
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @return 全部租户配置项
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getAllTenantOption(Integer tenantId) {
|
||||
// 查询该租户所有配置项
|
||||
List<SysTenantOption> sysTenantOptionList =
|
||||
baseMapper.selectList(new LambdaQueryWrapper<SysTenantOption>().eq(SysTenantOption::getTenantId, tenantId));
|
||||
if (sysTenantOptionList.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
// 作成Map
|
||||
return sysTenantOptionList.stream()
|
||||
.collect(Collectors.toMap(SysTenantOption::getOptionCode, SysTenantOption::getOptionContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户配置项详情列表
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @return 租户配置项详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<TenantOptionDto> getTenantOptionDetailList(Integer tenantId) {
|
||||
// 获取全部租户配置项字典,并按照指定顺序排序
|
||||
TenantOptionDict[] optionDictArray = TenantOptionDict.values();
|
||||
List<TenantOptionDict> optionDictList = Arrays.stream(optionDictArray)
|
||||
.sorted(Comparator.comparing(TenantOptionDict::getSort)).collect(Collectors.toList());
|
||||
// 查询该租户所有配置项,并作成Map
|
||||
List<SysTenantOption> sysTenantOptionList =
|
||||
baseMapper.selectList(new LambdaQueryWrapper<SysTenantOption>().eq(SysTenantOption::getTenantId, tenantId));
|
||||
Map<String, String> sysTenantOptionMap = sysTenantOptionList.stream()
|
||||
.collect(Collectors.toMap(SysTenantOption::getOptionCode, SysTenantOption::getOptionContent));
|
||||
// 循环查询结果,返回字典项和实际配置的值
|
||||
List<TenantOptionDto> dtoList = new ArrayList<>();
|
||||
TenantOptionDto dto;
|
||||
for (TenantOptionDict dict : optionDictList) {
|
||||
dto = new TenantOptionDto();
|
||||
dto.setCode(dict.getCode()).setName(dict.getName()).setContent(sysTenantOptionMap.get(dict.getCode()));
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存租户配置项详情列表
|
||||
*
|
||||
* @param saveTenantOptionDetailDto 参数DTO
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveTenantOptionDetailList(SaveTenantOptionDetailDto saveTenantOptionDetailDto) {
|
||||
// 入参配置项详情列表作成Map
|
||||
Map<String, TenantOptionDto> tenantOptionDtoMap = saveTenantOptionDetailDto.getOptionList().stream()
|
||||
.collect(Collectors.toMap(TenantOptionDto::getCode, Function.identity()));
|
||||
// 查询该租户所有配置项,并作成Map
|
||||
List<SysTenantOption> sysTenantOptionList = baseMapper.selectList(new LambdaQueryWrapper<SysTenantOption>()
|
||||
.eq(SysTenantOption::getTenantId, saveTenantOptionDetailDto.getTenantId()));
|
||||
Map<String, SysTenantOption> sysTenantOptionMap =
|
||||
sysTenantOptionList.stream().collect(Collectors.toMap(SysTenantOption::getOptionCode, Function.identity()));
|
||||
// 循环配置项字典
|
||||
List<SysTenantOption> newOptionList = new ArrayList<>();
|
||||
List<SysTenantOption> existOptionList = new ArrayList<>();
|
||||
SysTenantOption newOption;
|
||||
for (TenantOptionDict dict : TenantOptionDict.values()) {
|
||||
// 根据是否输入,是否已存在,区分并作成新增列表和更新列表
|
||||
TenantOptionDto inputOption = tenantOptionDtoMap.getOrDefault(dict.getCode(), new TenantOptionDto());
|
||||
SysTenantOption existOption = sysTenantOptionMap.get(dict.getCode());
|
||||
if (existOption == null) {
|
||||
newOption = new SysTenantOption().setTenantId(saveTenantOptionDetailDto.getTenantId())
|
||||
.setOptionCode(dict.getCode())
|
||||
.setOptionContent(Optional.ofNullable(inputOption.getContent()).orElse(""));
|
||||
newOptionList.add(newOption);
|
||||
} else {
|
||||
existOption.setOptionContent(Optional.ofNullable(inputOption.getContent()).orElse(""));
|
||||
existOptionList.add(existOption);
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
if (!newOptionList.isEmpty()) {
|
||||
this.saveBatch(newOptionList);
|
||||
}
|
||||
// 更新
|
||||
if (!existOptionList.isEmpty()) {
|
||||
this.updateBatchById(existOptionList);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户配置项前端form表单列表
|
||||
*
|
||||
* @return 租户配置项前端form表单列表
|
||||
*/
|
||||
@Override
|
||||
public List<TenantOptionDto> getTenantOptionFormList() {
|
||||
return Arrays.stream(TenantOptionDict.values()).sorted(Comparator.comparing(TenantOptionDict::getSort))
|
||||
.map(dict -> new TenantOptionDto().setCode(dict.getCode()).setName(dict.getName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
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[] {"身体部位信息停用"}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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[] {"删除频次详情"}));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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<>();
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.chargemanage.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageDto;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
|
||||
/**
|
||||
* 门诊收费 appMapper
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-13
|
||||
*/
|
||||
@Repository
|
||||
public interface InpatientChargeAppMapper {
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
Page<EncounterPatientPageDto> selectEncounterPatientPage(@Param("classEnum") Integer classEnum,
|
||||
@Param("page") Page<EncounterPatientPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterPatientPageParam> queryWrapper);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param activity 项目
|
||||
* @param medication 药品
|
||||
* @param device 耗材
|
||||
* @param register 挂号费
|
||||
* @param planned 收费状态:待收费
|
||||
* @param billable 收费状态:待结算
|
||||
* @param billed 收费状态:已结算
|
||||
* @param refunding 收费状态:退费中
|
||||
* @param refunded 收费状态:全部退费
|
||||
* @param partRefund 收费状态:部分退费
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId,
|
||||
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device,
|
||||
@Param("register") Integer register, @Param("planned") Integer planned, @Param("billable") Integer billable,
|
||||
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.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 lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 执行信息dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PerformInfoDto {
|
||||
|
||||
/** 请求id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 医嘱项目id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 住院id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 发放id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 执行id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long procedureId;
|
||||
|
||||
/** 请求所在表 */
|
||||
private String requestTable;
|
||||
|
||||
/** 执行位置 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 执行开始时间 */
|
||||
private Date exeStartTime;
|
||||
|
||||
/** 执行结束时间 */
|
||||
private Date exeEndTime;
|
||||
|
||||
/** 组号 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
|
||||
/** 执行时间列表 */
|
||||
private List<String> executeTimes;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 执行记录dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PerformRecordDto {
|
||||
|
||||
/** 执行id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long procedureId;
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 执行时间 */
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 执行位置 */
|
||||
private String locationName;
|
||||
|
||||
/** 执行科室 */
|
||||
private String orgName;
|
||||
|
||||
/** 项目id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 执行开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
/** 执行结束时间 */
|
||||
private Date endTime;
|
||||
|
||||
/** 执行人 */
|
||||
private String practitionerName;
|
||||
|
||||
/** 取消执行id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long refundId;
|
||||
|
||||
/** 操作时间 */
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 追溯码查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SearchTraceNoParam {
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private Integer itemType; // 1:药品 , 2: 耗材 , 3:诊疗
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 药房药库
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 产品批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package com.openhis.web.datadictionary.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 药品目录导入Dto
|
||||
*
|
||||
* @author GuoRui
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedicationImportDto {
|
||||
|
||||
// ---------------------- 药品定义 med_medication_definition -------------------------------------
|
||||
|
||||
/** 药品名称 */
|
||||
@Excel(name = "药品名称")
|
||||
private String name;
|
||||
|
||||
/** 药品版本 */
|
||||
@Excel(name = "药品版本")
|
||||
private String version;
|
||||
|
||||
/** 英文药名 */
|
||||
@Excel(name = "英文药名")
|
||||
private String nameEn;
|
||||
|
||||
/** 药品分类 */
|
||||
@Excel(name = "药品分类", dictType = "med_category_code", comboReadDict = true)
|
||||
private String categoryCode;
|
||||
|
||||
/** 商品名称 */
|
||||
@Excel(name = "商品名称")
|
||||
private String merchandiseName;
|
||||
|
||||
/** 药品单位 */
|
||||
@Excel(name = "药品单位", dictType = "unit_code", comboReadDict = true)
|
||||
private String unitCode;
|
||||
|
||||
/** 最小单位 */
|
||||
@Excel(name = "最小单位", dictType = "unit_code", comboReadDict = true)
|
||||
private String minUnitCode;
|
||||
|
||||
/** 拆零比 */
|
||||
@Excel(name = "拆零比")
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 剂量形式 */
|
||||
@Excel(name = "剂量形式", dictType = "dose_from_code", comboReadDict = true)
|
||||
private String doseFrom;
|
||||
|
||||
/** 批准文号 */
|
||||
@Excel(name = "批准文号")
|
||||
private String approvalNumber;
|
||||
|
||||
/** 医保是否对码 */
|
||||
@Excel(name = "医保是否对码", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String ybMatchFlag;
|
||||
|
||||
/** 医保编码 */
|
||||
@Excel(name = "医保编码")
|
||||
private String ybNo;
|
||||
|
||||
/** 是否皮试 */
|
||||
@Excel(name = "是否皮试", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String skinTestFlag;
|
||||
|
||||
/** 是否为注射药物 */
|
||||
@Excel(name = "是否为注射药物", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String injectFlag;
|
||||
|
||||
/** 生产厂商文本 */
|
||||
@Excel(name = "生产厂商文本")
|
||||
private String manufacturerText;
|
||||
|
||||
/** 是否限制使用 */
|
||||
@Excel(name = "是否限制使用", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String restrictedFlag;
|
||||
|
||||
/** 限制使用范围 */
|
||||
@Excel(name = "限制使用范围")
|
||||
private String restrictedScope;
|
||||
|
||||
/** 儿童用药标志 */
|
||||
@Excel(name = "儿童用药标志", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String childrenFlag;
|
||||
|
||||
/** 贯标国家编码 */
|
||||
@Excel(name = "贯标国家编码")
|
||||
private String nationalDrugCode;
|
||||
|
||||
/** 拆分属性 */
|
||||
@Excel(name = "拆分属性", readConverterExp = "1=门诊按最小单位每次量向上取整,2=门诊按包装单位不可拆分,3=门诊按最小单位总量向上取整,4=门诊按包装单位每次量向上取整",
|
||||
combo = "门诊按最小单位每次量向上取整,门诊按包装单位不可拆分,门诊按最小单位总量向上取整,门诊按包装单位每次量向上取整")
|
||||
private String partAttributeEnum;
|
||||
|
||||
/** 是否抗生素 */
|
||||
@Excel(name = "是否抗生素", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String antibioticFlag;
|
||||
|
||||
/** 抗生素分类 */
|
||||
@Excel(name = "抗生素分类", dictType = "antibiotic_type_code", comboReadDict = true)
|
||||
private String antibioticCode;
|
||||
|
||||
/** 权限限制 */
|
||||
@Excel(name = "权限限制", readConverterExp = "1=非限制使用,2=限制使用,3=特殊使用", combo = "非限制使用,限制使用,特殊使用")
|
||||
private String restrictedEnum;
|
||||
|
||||
/** 是否自制 */
|
||||
@Excel(name = "是否自制", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String selfFlag;
|
||||
|
||||
/** 基药标识 */
|
||||
@Excel(name = "基药标识", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String basicFlag;
|
||||
|
||||
/** 住院临时医嘱拆分属性 */
|
||||
@Excel(name = "住院临时医嘱拆分属性",
|
||||
readConverterExp = "1=临时医嘱按最小单位每次量向上取整,2=临时医嘱按包装单位开立,3=临时医嘱按最小单位总量向上取整,4=临时医嘱按包装单位每次量向上取整",
|
||||
combo = "临时医嘱按最小单位每次量向上取整,临时医嘱按包装单位开立,临时医嘱按最小单位总量向上取整,临时医嘱按包装单位每次量向上取整")
|
||||
private String thoPartAttributeEnum;
|
||||
|
||||
/** 剂量单位换算比 */
|
||||
@Excel(name = "剂量单位换算比")
|
||||
private BigDecimal unitConversionRatio;
|
||||
|
||||
/** 医保等级 */
|
||||
@Excel(name = "医保等级", dictType = "chrgitm_lv", comboReadDict = true)
|
||||
private String chrgitmLv;
|
||||
|
||||
/** 处方标志 */
|
||||
@Excel(name = "处方标志", readConverterExp = "0=否,1=是", combo = "否,是")
|
||||
private String rxFlag;
|
||||
|
||||
// ---------------------- 药品基本信息 med_medication ----------------------------------------------
|
||||
|
||||
/** 所在位置名称(locationId) */
|
||||
@Excel(name = "所在位置名称")
|
||||
private String locationName;
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
private String totalVolume;
|
||||
|
||||
/** 用法 */
|
||||
@Excel(name = "用法", dictType = "method_code", comboReadDict = true)
|
||||
private String methodCode;
|
||||
|
||||
/** 用药频次 */
|
||||
@Excel(name = "用药频次", dictType = "rate_code", comboReadDict = true)
|
||||
private String rateCode;
|
||||
|
||||
/** 单次剂量 */
|
||||
@Excel(name = "单次剂量")
|
||||
private BigDecimal dose;
|
||||
|
||||
/** 剂量单位 */
|
||||
@Excel(name = "剂量单位", dictType = "unit_code", comboReadDict = true)
|
||||
private String doseUnitCode;
|
||||
|
||||
/** 单次最大剂量 */
|
||||
@Excel(name = "单次最大剂量")
|
||||
private BigDecimal maxUnit;
|
||||
|
||||
// ---------------------- 费用定价 adm_charge_item_definition ----------------------------------------------
|
||||
|
||||
/** 财务类别 */
|
||||
@Excel(name = "财务类别", dictType = "fin_type_code", comboReadDict = true)
|
||||
private String typeCode;
|
||||
|
||||
/** 医保费用类别 */
|
||||
@Excel(name = "医保费用类别", dictType = "med_chrgitm_type", comboReadDict = true)
|
||||
private String ybType;
|
||||
|
||||
// ---------------------- 费用定价子表 adm_charge_item_def_detail ----------------------------------------------
|
||||
|
||||
/** 购入价 */
|
||||
@Excel(name = "购入价")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
/** 零售价 */
|
||||
@Excel(name = "零售价")
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 最高零售价 */
|
||||
@Excel(name = "最高零售价")
|
||||
private BigDecimal maximumRetailPrice;
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
/**
|
||||
* 科室材料共通方法
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentCommonService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
DepartmentInitDto init();
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 单据列表
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param locationFlg 仓库flg
|
||||
* @param supplyType 单据类型
|
||||
* @return 订货单据分页列表
|
||||
*/
|
||||
R<?> getPage(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request,String locationFlg,Integer supplyType);
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteOrder(String busNo);
|
||||
|
||||
// /**
|
||||
// * 提交审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> submitApproval(String busNo);
|
||||
|
||||
// /**
|
||||
// * 同意审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> agreeApproval(String busNo);
|
||||
|
||||
// /**
|
||||
// * 撤回审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> withdrawApproval(String busNo);
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentIssuanceOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 添加/编辑发出单
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean addOrEditIssuanceOrder(List<Long> dispenseIdList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentProfitLossOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditProfitLossOrder(List<DepartmentDetailDto> profitLossOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料审批方法
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentReceiptApprovalService {
|
||||
|
||||
/**
|
||||
* 请领单同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> requisitionOrderAgreeApproval(String busNo);
|
||||
|
||||
/**
|
||||
* 药房入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> stockInOrderAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 科室材料退库审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> returnToWarehouseAgreeApproved(String busNo);
|
||||
|
||||
|
||||
// /**
|
||||
// * 药房发药审批通过
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> dispensingAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房损益单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> profitLossAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房盘点单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> stocktakingAgreepproved(String busNo);
|
||||
/**
|
||||
* 药房调入单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> transferInAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房调出单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> transferOutAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 根据单据号获取供应单据及供应项相关详细信息
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 供应单据及供应项相关详细信息
|
||||
*/
|
||||
List<SupplyItemDetailDto> getSupplyItemDetail(String busNo);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentRequisitionOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑请领单
|
||||
*
|
||||
* @param requisitionOrderDtoList 请领信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditRequisitionOrder(List<DepartmentDetailDto> requisitionOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentReturnToWarehouseOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditReturnToWarehouseOrder(List<DepartmentDetailDto> returnToDispensaryOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentStockInOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditStockInOrder(List<DepartmentDetailDto> stockInOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentStocktakingOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditStocktakingOrder(List<DepartmentDetailDto> stocktakingOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentTransferInOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferInOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditTransferInOrder(List<DepartmentDetailDto> transferInOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentTransferOutOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferOutOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditTransferOutOrder(List<DepartmentDetailDto> transferOutOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
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.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.enums.*;
|
||||
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.Practitioner;
|
||||
import com.openhis.administration.domain.Supplier;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDeviceInfoDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料订货单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentCommonServiceImpl implements IDepartmentCommonService {
|
||||
|
||||
@Resource
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@Resource
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Resource
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
@Resource
|
||||
private ICommonService commonServiceImpl;
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public DepartmentInitDto init() {
|
||||
DepartmentInitDto orderInitDto = new DepartmentInitDto();
|
||||
|
||||
// 查询供应商列表
|
||||
List<Supplier> supplierList = supplierService.getList();
|
||||
// 查询经手人列表
|
||||
List<Practitioner> practitionerList = practitionerService.getList();
|
||||
// 经手人信息
|
||||
List<DepartmentInitDto.LongOption> practitionerListOption = practitionerList.stream()
|
||||
.map(practitioner -> new DepartmentInitDto.LongOption(practitioner.getId(), practitioner.getName()))
|
||||
.collect(Collectors.toList());
|
||||
// 供应商信息
|
||||
List<DepartmentInitDto.SupplierOption> supplierListOption = supplierList.stream()
|
||||
.map(supplier -> new DepartmentInitDto.SupplierOption(supplier.getId(), supplier.getName() ,supplier.getPhone()))
|
||||
.collect(Collectors.toList());
|
||||
// 审批状态
|
||||
List<DepartmentInitDto.IntegerOption> supplyStatusOption = Stream.of(SupplyStatus.values()).map(
|
||||
supplyStatus -> new DepartmentInitDto.IntegerOption(supplyStatus.getValue(), supplyStatus.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 包装情况
|
||||
List<DepartmentInitDto.IntegerOption> packagingConditionOption = Stream.of(PackagingCondition.values())
|
||||
.map(packagingCondition -> new DepartmentInitDto.IntegerOption(packagingCondition.getValue(),
|
||||
packagingCondition.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 验收结果
|
||||
List<DepartmentInitDto.IntegerOption> acceptanceResultOption = Stream.of(AcceptanceResult.values())
|
||||
.map(acceptanceResult -> new DepartmentInitDto.IntegerOption(acceptanceResult.getValue(),
|
||||
acceptanceResult.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 仓库列表
|
||||
List<LocationDto> warehouseList = commonServiceImpl.getWarehouseList();
|
||||
// 科室列表
|
||||
List<Organization> departmentList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||
|
||||
orderInitDto.setWarehouseListOptions(warehouseList).setDepartmentListOptions(departmentList)
|
||||
.setSupplierOption(supplierListOption).setPractitionerOption(practitionerListOption)
|
||||
.setSupplyStatusOptions(supplyStatusOption).setPackagingConditionOptions(packagingConditionOption)
|
||||
.setAcceptanceResultoryOptions(acceptanceResultOption);
|
||||
|
||||
return orderInitDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
|
||||
Long locationId = purchaseOrderSearchParam.getLocationId();
|
||||
purchaseOrderSearchParam.setLocationId(null);
|
||||
Long supplierId = purchaseOrderSearchParam.getSupplierId();
|
||||
purchaseOrderSearchParam.setSupplierId(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<DepartmentSearchParam> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(purchaseOrderSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr)), request);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc(CommonConstants.FieldName.Name);
|
||||
|
||||
Page<DepartmentDeviceInfoDto> medicationInfoDto = departmentCommonMapper
|
||||
.getDeviceInfo(new Page<>(pageNo, pageSize), queryWrapper, locationId, supplierId);
|
||||
|
||||
for (DepartmentDeviceInfoDto item : medicationInfoDto.getRecords()) {
|
||||
List<DepartmentDeviceInfoDto.Option> unitList = new ArrayList<>();
|
||||
unitList
|
||||
.add(new DepartmentDeviceInfoDto.Option(item.getUnitCode(), item.getUnitCode_dictText()));
|
||||
unitList.add(
|
||||
new DepartmentDeviceInfoDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(medicationInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单据列表
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param locationFlg 仓库flg
|
||||
* @param supplyType 单据类型
|
||||
* @return 订货单据分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPage(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request, String locationFlg,Integer supplyType) {
|
||||
//判断哪个画面使用
|
||||
if (supplyType != null) {
|
||||
purchaseOrderSearchParam.setTypeEnum(supplyType);
|
||||
}
|
||||
// if (locationForm != null) {
|
||||
// purchaseOrderSearchParam.setLocationTypeEnum(locationForm);
|
||||
// }
|
||||
String originalBusNoFlg = purchaseOrderSearchParam.getOriginalBusNoFlg();
|
||||
purchaseOrderSearchParam.setOriginalBusNoFlg(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<DepartmentSearchParam> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(purchaseOrderSearchParam, searchKey,
|
||||
new HashSet<>(
|
||||
Arrays.asList(CommonConstants.FieldName.SupplyBusNo, CommonConstants.FieldName.ApplicantName)),
|
||||
request);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc(CommonConstants.FieldName.SupplyBusNo);
|
||||
// 查询订货单分页列表
|
||||
Page<DepartmentDto> purchaseOrderDtoPage =
|
||||
departmentCommonMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper,originalBusNoFlg, locationFlg);
|
||||
|
||||
purchaseOrderDtoPage.getRecords().forEach(e -> {
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(purchaseOrderDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOrder(String busNo) {
|
||||
// 根据原始单据号查询信息
|
||||
List<SupplyRequest> supplyRequest = supplyRequestService.getSupplyByOriginalBusNo(busNo);
|
||||
if (!supplyRequest.isEmpty()) {
|
||||
// 将原始单据号信息的原始单据号删除
|
||||
boolean flg = supplyRequestService.updateByBusNo(supplyRequest.get(0).getBusNo());
|
||||
if (!flg) {
|
||||
R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
// 删除单据
|
||||
boolean result = supplyRequestService.removeByBusNo(busNo);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentIssuanceOrderMapper;
|
||||
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryDetailDto;
|
||||
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryInitDto;
|
||||
import com.openhis.web.pharmacyDispensarymanage.mapper.PharmacyDispensaryDispensingOrderMapper;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentIssuanceOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentIssuanceOrderServiceImpl implements IDepartmentIssuanceOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Resource
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
@Autowired
|
||||
private DepartmentIssuanceOrderMapper departmentIssuanceOrderMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto issuanceOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption
|
||||
.add(new DepartmentInitDto.IntegerOption(SupplyCategory.OUTPATIENT_PATIENT_DISPENSING.getValue(),
|
||||
SupplyCategory.OUTPATIENT_PATIENT_DISPENSING.getInfo()));
|
||||
supplyCategoryOption
|
||||
.add(new DepartmentInitDto.IntegerOption(SupplyCategory.INPATIENT_PATIENT_DISPENSING.getValue(),
|
||||
SupplyCategory.INPATIENT_PATIENT_DISPENSING.getInfo()));
|
||||
supplyCategoryOption.add(
|
||||
new DepartmentInitDto.IntegerOption(SupplyCategory.INPATIENT_PATIENT_SUMMARY_DISPENSING.getValue(),
|
||||
SupplyCategory.INPATIENT_PATIENT_SUMMARY_DISPENSING.getInfo()));
|
||||
|
||||
issuanceOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(issuanceOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> issuanceOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
issuanceOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(issuanceOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
public String getBusNo() {
|
||||
return assignSeqUtil.getSeqByDay(AssignSeqEnum.DISPENSING_ORDER.getPrefix(), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑发出单
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean addOrEditIssuanceOrder(List<Long> dispenseIdList) {
|
||||
|
||||
// 获取单据号
|
||||
String busNo = this.getBusNo();
|
||||
// 获取更表所需信息
|
||||
List<DepartmentDetailDto> detailDto =
|
||||
departmentIssuanceOrderMapper.getInfo(dispenseIdList, DispenseStatus.COMPLETED.getValue());
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
SupplyRequest supplyRequest;
|
||||
List<SupplyDelivery> supplyDeliveryList = new ArrayList<>();
|
||||
SupplyDelivery supplyDelivery;
|
||||
for (DepartmentDetailDto item : detailDto) {
|
||||
// 供应申请
|
||||
supplyRequest = new SupplyRequest().setBusNo(busNo).setTypeEnum(SupplyType.DISPENSING_ORDER.getValue())
|
||||
.setStatusEnum(SupplyStatus.AGREE.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setLotNumber(item.getLotNumber())
|
||||
.setSourceTypeEnum(LocationForm.CABINET.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(item.getApplyTime()).setApproverId(item.getApproverId())
|
||||
.setApprovalTime(item.getApprovalTime());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
// 供应发放
|
||||
supplyDelivery = new SupplyDelivery().setRequestId(supplyRequest.getId())
|
||||
.setStatusEnum(DispenseStatus.COMPLETED.getValue()).setTypeEnum(supplyRequest.getTypeEnum())
|
||||
.setItemTable(supplyRequest.getItemTable()).setItemId(supplyRequest.getItemId())
|
||||
.setBasedOnTable(CommonConstants.TableName.WOR_DEVICE_DISPENSE).setBasedOnIds(item.getDispenseIds())
|
||||
.setUnitCode(supplyRequest.getUnitCode()).setQuantity(supplyRequest.getItemQuantity())
|
||||
.setLotNumber(supplyRequest.getLotNumber())
|
||||
.setPractitionerId(supplyRequest.getApplicantId()).setOccurrenceTime(supplyRequest.getApprovalTime())
|
||||
.setReceiverId(supplyRequest.getPurposeLocationId()).setReceiveTime(supplyRequest.getApprovalTime());
|
||||
|
||||
supplyDeliveryList.add(supplyDelivery);
|
||||
}
|
||||
|
||||
// 更新供应请求表
|
||||
boolean requestFlg = supplyRequestService.saveBatch(supplyRequestList);
|
||||
if (!requestFlg) {
|
||||
return false;
|
||||
}
|
||||
// 更新供应发放表
|
||||
boolean deliveryFlg = supplyDeliveryService.saveBatch(supplyDeliveryList);
|
||||
if (!deliveryFlg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentProfitLossOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentProfitLossOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentProfitLossOrderServiceImpl implements IDepartmentProfitLossOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.GENERAL_PROFIT_AND_LOSS.getValue(),
|
||||
SupplyCategory.GENERAL_PROFIT_AND_LOSS.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.STOCKTAKING_PROFIT_AND_LOSS.getValue(),
|
||||
SupplyCategory.STOCKTAKING_PROFIT_AND_LOSS.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.STANDBY_RESCUE_MEDICINES.getValue(),
|
||||
SupplyCategory.STANDBY_RESCUE_MEDICINES.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.DAMAGED_EXPIRED_MEDICINES.getValue(),
|
||||
SupplyCategory.DAMAGED_EXPIRED_MEDICINES.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.DONATED_MEDICINES.getValue(),
|
||||
SupplyCategory.DONATED_MEDICINES.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> profitLossOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
profitLossOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : profitLossOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(profitLossOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_PRPFITLOSS.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditProfitLossOrder(List<DepartmentDetailDto> profitLossOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(profitLossOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : profitLossOrderDtoList) {
|
||||
SupplyRequest supplyRequest =
|
||||
new SupplyRequest().setBusNo(item.getBusNo()).setTypeEnum(SupplyType.DEPARTMENT_PRPFITLOSS.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setPrice(item.getPrice())
|
||||
.setTotalPrice(item.getTotalPrice()).setRetailPrice(item.getRetailPrice())
|
||||
.setTotalRetailPrice(item.getTotalRetailPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setStartTime(item.getStartTime())
|
||||
.setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setReason(item.getReason())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,933 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.common.enums.TraceNoStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.enums.ybenums.YbRxFlag;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.inventorymanage.appservice.IReceiptApprovalAppService;
|
||||
import com.openhis.web.inventorymanage.appservice.ITraceNoAppService;
|
||||
import com.openhis.web.inventorymanage.assembler.InventoryManageAssembler;
|
||||
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.inventorymanage.mapper.ReceiptApprovalMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import com.openhis.yb.dto.Medical3503Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3501Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3502Param;
|
||||
import com.openhis.yb.dto.MedicalPurchase3504Param;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 科室材料审批
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentReceiptApprovalServiceImpl implements IDepartmentReceiptApprovalService {
|
||||
@Autowired
|
||||
private ITraceNoAppService traceNoAppService;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
@Autowired
|
||||
private IInventoryItemService inventoryItemService;
|
||||
@Autowired
|
||||
private ReceiptApprovalMapper receiptApprovalMapper;
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
@Autowired
|
||||
private IReceiptApprovalAppService receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 请领单同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> requisitionOrderAgreeApproval(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// // 获取审批通过后的供应请求id列表
|
||||
// List<Long> supplyReqIdList = agreedList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
//
|
||||
// // 校验(已经审批通过的单号(发放状态是已完成),不能再重复审批通过)
|
||||
// boolean validation = supplyDeliveryService.supplyDeliveryValidation(supplyReqIdList);
|
||||
// if (validation) {
|
||||
// throw new ServiceException("请勿重复审批");
|
||||
// }
|
||||
// // 根据单据,生成供应发放单
|
||||
// List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
// if (deliveredList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> stockInOrderAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
InventoryItem inventoryItemPurpose = null;
|
||||
// 新增库存信息
|
||||
List<SupplyItemDetailDto> supplyList = new ArrayList<>();
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,仓库id 查询仓库库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItemPurpose = inventoryItemList.get(0);
|
||||
}
|
||||
|
||||
if (inventoryItemPurpose == null) {
|
||||
// 新增库存信息
|
||||
supplyList.add(supplyItemDetailDto);
|
||||
} else {
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemPurpose.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 源仓库库存+(调拨数量*拆零比)
|
||||
minQuantity = minQuantity
|
||||
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存+调拨数量
|
||||
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
// 更新源仓库库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
|
||||
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!supplyList.isEmpty()) {
|
||||
// 将供应项目的详细信息装配为库存项目
|
||||
List<InventoryItem> inventoryItemList = InventoryManageAssembler.assembleInventoryItem(supplyList);
|
||||
// 入库
|
||||
inventoryItemService.stockIn(inventoryItemList);
|
||||
}
|
||||
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
|
||||
SupplyType.PURCHASE_STOCKIN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 调用医保商品采购接口 todo 科室材料相关医保接口未对应
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.PURCHASE_IN, false, true, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3503商品采购上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3503商品采购上传成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 药库退库审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> returnToWarehouseAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询仓库库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemSource;
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItemSource = inventoryItemList.get(0);
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemSource.getQuantity();
|
||||
|
||||
// 计算退货后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 仓库库存-(退货数量*拆零比)
|
||||
minQuantity = minQuantity.subtract(
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
}
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 仓库库存-退货数量
|
||||
minQuantity = minQuantity.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
}
|
||||
// 更新仓库库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
|
||||
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
|
||||
SupplyType.PURCHASE_RETURN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 调用医保采购退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.RETURN_OUT, false, false, true, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3504采购退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 科室材料发药审批通过 todo 发药只查询,没有审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// @Override
|
||||
// public R<?> dispensingAgreeApproved(String busNo) {
|
||||
// // 获取当前时间
|
||||
// Date now = DateUtils.getNowDate();
|
||||
// // 审批单据并返回单据详情
|
||||
// List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
// if (agreedList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
// // 根据单据,发放物品
|
||||
// List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
// if (deliveredList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
//
|
||||
// // 查询供应项目的详细信息
|
||||
// List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
//
|
||||
// if (!supplyItemDetailList.isEmpty()) {
|
||||
//
|
||||
// for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// // 根据项目id,产品批号,源仓库id 查询源仓库库存表信息
|
||||
// List<InventoryItem> inventoryItemSourceList = inventoryItemService.selectInventoryByItemId(
|
||||
// supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
// supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
// InventoryItem inventoryItemSource = new InventoryItem();
|
||||
// if (!inventoryItemSourceList.isEmpty()) {
|
||||
// inventoryItemSource = inventoryItemSourceList.get(0);
|
||||
//
|
||||
// // 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
// BigDecimal baseQuantitySource = inventoryItemSource.getQuantity();
|
||||
// // 最小数量(最小单位库存数量)
|
||||
// BigDecimal minQuantitySource = inventoryItemSource.getQuantity();
|
||||
//
|
||||
// // 供应申请的物品计量单位与包装单位相同
|
||||
// if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// if (minQuantitySource.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// // 库存数量不足
|
||||
// return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
// } else {
|
||||
// // 源仓库库存-(领用数量*拆零比)
|
||||
// minQuantitySource = minQuantitySource.subtract(
|
||||
// supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
// }
|
||||
// } else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// if (minQuantitySource.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// // 库存数量不足
|
||||
// return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
// } else {
|
||||
// // 供应申请的物品计量单位与最小单位相同
|
||||
// // 源仓库库存-领用数量
|
||||
// minQuantitySource = minQuantitySource.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
// }
|
||||
// }
|
||||
// // 更新源仓库库存数量
|
||||
// Boolean aBooleanSource = inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(),
|
||||
// baseQuantitySource, minQuantitySource, now, supplyItemDetailDto.getTraceNo());
|
||||
//
|
||||
// if (!aBooleanSource) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 科室材料损益单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> profitLossAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,生成供应发放单
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据id,产品批号,仓库 查询库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItem = inventoryItemList.get(0);
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = null;
|
||||
|
||||
// 计算报损后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 数量*拆零比
|
||||
minQuantity =
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity());
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 数量
|
||||
minQuantity = supplyItemDetailDto.getItemQuantity();
|
||||
}
|
||||
// 更新库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 追加追溯码信息
|
||||
boolean flg =
|
||||
traceNoAppService.updateTraceNoList(supplyItemDetailList, SupplyType.PURCHASE_PRPFITLOSS.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 调用医保库存变更接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList = this.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.DESTRUCTION, false, false, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3502库存变更上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料盘点单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> stocktakingAgreepproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,生成供应发放单
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 首次盘存列表
|
||||
List<SupplyItemDetailDto> firstSupplyItemDetailList = new ArrayList<>();
|
||||
// 药品/耗材发放列表
|
||||
List<MedicationDispense> medicationDispenses = null;
|
||||
List<DeviceDispense> deviceDispenses = null;
|
||||
// 返回信息
|
||||
String stocktakingReturnMsg = null;
|
||||
String changeReturnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
// 获取盘盈列表(itemQuantity > 0)
|
||||
List<SupplyItemDetailDto> positiveList = supplyItemDetailList.stream()
|
||||
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) > 0)
|
||||
.collect(Collectors.toList());
|
||||
// 获取盘亏列表(itemQuantity < 0)
|
||||
List<SupplyItemDetailDto> negativeList = supplyItemDetailList.stream()
|
||||
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) < 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据id,产品批号,仓库 查询库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
// 查看该批号的药品/耗材是否发放过(用于证明是否首次盘存)
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
medicationDispenses = medicationDispenseService.list(new LambdaQueryWrapper<MedicationDispense>()
|
||||
.eq(MedicationDispense::getLotNumber, supplyItemDetailDto.getLotNumber()));
|
||||
if (medicationDispenses.isEmpty()) {
|
||||
firstSupplyItemDetailList.add(supplyItemDetailDto);
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
deviceDispenses = deviceDispenseService.list(new LambdaQueryWrapper<DeviceDispense>()
|
||||
.in(DeviceDispense::getLotNumber, supplyItemDetailDto.getLotNumber()));
|
||||
if (deviceDispenses.isEmpty()) {
|
||||
firstSupplyItemDetailList.add(supplyItemDetailDto);
|
||||
}
|
||||
}
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
InventoryItem inventoryItem = inventoryItemList.get(0);
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItem.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = null;
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
minQuantity =
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getTotalQuantity());
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
minQuantity = supplyItemDetailDto.getTotalQuantity();
|
||||
}
|
||||
// 更新库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
String ybSwitch =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 如果首次盘点信息不为空
|
||||
if (!firstSupplyItemDetailList.isEmpty()) {
|
||||
// 调用医保盘存接口,盘盈
|
||||
List<String> uploadFailedNoList = this.ybInventoryIntegrated(firstSupplyItemDetailList,
|
||||
YbInvChgType.INVENTORY_GAIN, true, false, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
stocktakingReturnMsg = "3501盘存上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
List<String> uploadFailedGainList = null;
|
||||
List<String> uploadFailedLossList = null;
|
||||
if (!positiveList.isEmpty()) {
|
||||
// 调用医保库存变更接口,盘盈
|
||||
uploadFailedGainList = this.ybInventoryIntegrated(positiveList, YbInvChgType.INVENTORY_GAIN,
|
||||
false, false, false, now);
|
||||
}
|
||||
if (!negativeList.isEmpty()) {
|
||||
// 调用医保库存变更接口,盘亏
|
||||
uploadFailedLossList = this.ybInventoryIntegrated(negativeList, YbInvChgType.INVENTORY_LOSS,
|
||||
false, false, false, now);
|
||||
}
|
||||
if (uploadFailedGainList != null || uploadFailedLossList != null) {
|
||||
changeReturnMsg = "3502库存变更上传错误,错误项目编码" + uploadFailedGainList + uploadFailedLossList;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg =
|
||||
traceNoAppService.updateTraceNoList(supplyItemDetailList, SupplyType.PURCHASE_STOCKTAKING.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(stocktakingReturnMsg + changeReturnMsg,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料调入单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> transferInAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
|
||||
// 新增库存信息
|
||||
List<SupplyItemDetailDto> supplylList = new ArrayList<>();
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询目的仓库库存表信息
|
||||
List<InventoryItem> inventoryItemPurposeList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemPurpose = null;
|
||||
if (!inventoryItemPurposeList.isEmpty()) {
|
||||
inventoryItemPurpose = inventoryItemPurposeList.get(0);
|
||||
}
|
||||
|
||||
if (inventoryItemPurpose == null) {
|
||||
// 新增库存信息
|
||||
supplylList.add(supplyItemDetailDto);
|
||||
} else {
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItemPurpose.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemPurpose.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 源仓库库存+(退库数量*拆零比)
|
||||
minQuantity = minQuantity
|
||||
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存+退库数量
|
||||
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
// 更新目的仓库库存数量
|
||||
Boolean bBooleanPurpose =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
|
||||
if (!bBooleanPurpose) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!supplylList.isEmpty()) {
|
||||
// 将供应项目的详细信息装配为库存项目
|
||||
List<InventoryItem> inventoryItemList = InventoryManageAssembler.assembleInventoryItem(supplylList);
|
||||
// 入库
|
||||
inventoryItemService.stockIn(inventoryItemList);
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
|
||||
SupplyType.PURCHASE_TRANSFERIN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料调出单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> transferOutAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询目的仓库库存表信息
|
||||
List<InventoryItem> inventoryItemSourceList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemSource = null;
|
||||
if (!inventoryItemSourceList.isEmpty()) {
|
||||
inventoryItemSource = inventoryItemSourceList.get(0);
|
||||
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItemSource.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemSource.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 源仓库库存-(退库数量*拆零比)
|
||||
minQuantity = minQuantity.subtract(
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
}
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存-退库数量
|
||||
minQuantity = minQuantity.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
}
|
||||
// 更新目的仓库库存数量
|
||||
Boolean bBooleanSource =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
|
||||
if (!bBooleanSource) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
|
||||
SupplyType.PURCHASE_TRANSFEROUT.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单据号获取供应单据及供应项相关详细信息
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 供应单据及供应项相关详细信息
|
||||
*/
|
||||
@Override
|
||||
public List<SupplyItemDetailDto> getSupplyItemDetail(String busNo) {
|
||||
return receiptApprovalMapper.selectSupplyDetail(busNo, DispenseStatus.COMPLETED.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保库存相关进销存接口
|
||||
*
|
||||
* @param supplyItemDetailList 供应申请项目详细信息
|
||||
* @param ybInvChgType 库存变更类型
|
||||
* @param firstFlag 首次盘存标识
|
||||
* @param now 库存变更时间
|
||||
* @return 上传失败的id集合
|
||||
*/
|
||||
private List<String> ybInventoryIntegrated(List<SupplyItemDetailDto> supplyItemDetailList,
|
||||
YbInvChgType ybInvChgType, Boolean firstFlag, Boolean purchaseFlag, Boolean returnFlag, Date now) {
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
R<?> result;
|
||||
R<?> firstResult = R.ok();
|
||||
R<?> returnResult = R.ok();
|
||||
R<?> purchaseResult = R.ok();
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
if (supplyItemDetailDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
switch (ybInvChgType) {
|
||||
case ALLOCATION_IN:
|
||||
case ALLOCATION_OUT:
|
||||
case INVENTORY_GAIN:
|
||||
case INVENTORY_LOSS:
|
||||
case DESTRUCTION:
|
||||
case OTHER_IN:
|
||||
case OTHER_OUT:
|
||||
case DONATION_IN:
|
||||
case DONATION_RETURN_OUT:
|
||||
case PURCHASE_IN:
|
||||
case RETURN_OUT:
|
||||
if (firstFlag) {
|
||||
firstResult =
|
||||
ybService.uploadInventoryCount(getMedicalInventory3501Param(supplyItemDetailDto, now), now);
|
||||
if (firstResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
if (returnFlag) {
|
||||
returnResult =
|
||||
ybService.cancelProcurement(getMedicalPurchase3504Param(supplyItemDetailDto, now));
|
||||
if (returnResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
if (purchaseFlag) {
|
||||
purchaseResult = ybService.procurement(getMedical3503Param(supplyItemDetailDto, now));
|
||||
if (purchaseResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
result = ybService.updateInventoryCount(
|
||||
getMedicalInventory3502Param(supplyItemDetailDto, now, ybInvChgType.getValue()));
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("未知的库存变更类型: " + ybInvChgType);
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private MedicalPurchase3504Param getMedicalPurchase3504Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
|
||||
MedicalPurchase3504Param medicalPurchase3504Param = new MedicalPurchase3504Param();
|
||||
medicalPurchase3504Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setSplerName(supplyItemDetailDto.getSupplierName()).setPurcInvoNo(supplyItemDetailDto.getInvoiceNo())
|
||||
.setManuDate(supplyItemDetailDto.getStartTime()).setExpyEnd(supplyItemDetailDto.getEndTime())
|
||||
.setPurcRetnCnt(supplyItemDetailDto.getItemQuantity()).setPurcRetnStoinTime(now)
|
||||
.setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
return medicalPurchase3504Param;
|
||||
}
|
||||
|
||||
private Medical3503Param getMedical3503Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
|
||||
Medical3503Param medical3503Param = new Medical3503Param();
|
||||
medical3503Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setSplerName(supplyItemDetailDto.getSupplierName()).setManuLotnum(supplyItemDetailDto.getLotNumber())
|
||||
.setProdentpName(supplyItemDetailDto.getManufacturerText())
|
||||
.setAprvno(supplyItemDetailDto.getApprovalNumber()).setManuDate(supplyItemDetailDto.getStartTime())
|
||||
.setExpyEnd(supplyItemDetailDto.getEndTime()).setPurcRetnCnt(supplyItemDetailDto.getItemQuantity())
|
||||
.setPurcRetnStoinTime(now).setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
|
||||
return medical3503Param;
|
||||
}
|
||||
|
||||
private MedicalInventory3502Param getMedicalInventory3502Param(SupplyItemDetailDto supplyItemDetailDto, Date now,
|
||||
String ybInvChgType) {
|
||||
MedicalInventory3502Param medicalInventory3502Param = new MedicalInventory3502Param();
|
||||
// 查库存信息
|
||||
List<InventoryItem> inventoryItemList =
|
||||
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
|
||||
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
|
||||
// 查询商品价格信息
|
||||
List<ItemChargeDetailDto> itemChargeDetailList =
|
||||
receiptApprovalAppService.getItemChargeDetail(List.of(supplyItemDetailDto.getItemId()));
|
||||
if (!inventoryItemList.isEmpty() && !itemChargeDetailList.isEmpty()) {
|
||||
// 获取该项目所有的数量(最小单位)
|
||||
BigDecimal totalQuantity = inventoryItemList.stream()
|
||||
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 最小单位售卖价格
|
||||
BigDecimal minPrice = BigDecimal.ZERO;
|
||||
Optional<BigDecimal> price = itemChargeDetailList.stream()
|
||||
.filter(x -> x.getConditionValue().equals(supplyItemDetailDto.getLotNumber()))
|
||||
.map(ItemChargeDetailDto::getSellPrice).findFirst();
|
||||
if (price.isPresent()) {
|
||||
if (supplyItemDetailDto.getPartPercent().compareTo(BigDecimal.ZERO) > 0) {
|
||||
minPrice = price.get().divide(supplyItemDetailDto.getPartPercent(), RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
// 转换为JSON
|
||||
JSONArray medicalTraceNo = new JSONArray();
|
||||
// 获取追溯码信息
|
||||
if (supplyItemDetailDto.getTraceNo() != null) {
|
||||
List<String> traceNoList =
|
||||
Arrays.stream(supplyItemDetailDto.getTraceNo().split(CommonConstants.Common.COMMA))
|
||||
.map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
for (String traceNo : traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
traceNoMap.put("drug_trac_codg", traceNo);
|
||||
medicalTraceNo.add(traceNoMap);
|
||||
}
|
||||
}
|
||||
medicalInventory3502Param.setMedListCodg(supplyItemDetailDto.getYbNo()).setInvChgType(ybInvChgType)
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setPric(minPrice).setCnt(totalQuantity)
|
||||
.setInvChgTime(now).setDrugtracinfo(medicalTraceNo);
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
}
|
||||
return medicalInventory3502Param;
|
||||
}
|
||||
|
||||
private MedicalInventory3501Param getMedicalInventory3501Param(SupplyItemDetailDto supplyItemDetailDto, Date date) {
|
||||
MedicalInventory3501Param medicalInventory3501Param = new MedicalInventory3501Param();
|
||||
// 查库存信息
|
||||
List<InventoryItem> inventoryItemList =
|
||||
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
|
||||
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
// 获取该项目所有的数量(最小单位)
|
||||
BigDecimal totalQuantity = inventoryItemList.stream()
|
||||
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
medicalInventory3501Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setInvdate(date).setInvCnt(totalQuantity)
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setManuDate(supplyItemDetailDto.getStartTime())
|
||||
.setExpyEnd(supplyItemDetailDto.getEndTime());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
}
|
||||
return medicalInventory3501Param;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentRequisitionOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentRequisitionOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentRequisitionOrderServiceImpl implements IDepartmentRequisitionOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto requisitionOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.PURCHASE_APPLICATION.getValue(),
|
||||
SupplyCategory.PURCHASE_APPLICATION.getInfo()));
|
||||
|
||||
requisitionOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(requisitionOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> requisitionOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
requisitionOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : requisitionOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(requisitionOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_REQUISITION.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑请领单
|
||||
*
|
||||
* @param requisitionOrderDtoList 请领信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditRequisitionOrder(List<DepartmentDetailDto> requisitionOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(requisitionOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
for (DepartmentDetailDto item : requisitionOrderDtoList) {
|
||||
SupplyRequest supplyRequest =
|
||||
new SupplyRequest().setBusNo(item.getBusNo()).setTypeEnum(SupplyType.DEPARTMENT_REQUISITION.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.CABINET.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(item.getApplyTime()).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReturnToWarehouseOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentReturnToWarehouseOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentReturnToWarehouseOrderServiceImpl implements IDepartmentReturnToWarehouseOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> returnToDispensaryOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
returnToDispensaryOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : returnToDispensaryOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(returnToDispensaryOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_RETURN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditReturnToWarehouseOrder(List<DepartmentDetailDto> returnToDispensaryOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(returnToDispensaryOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : returnToDispensaryOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_RETURN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setStartTime(item.getStartTime()).setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setSupplierId(item.getSupplierId()).setReason(item.getReason())
|
||||
.setSourceTypeEnum(LocationForm.DEPARTMENT.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.WAREHOUSE.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStockInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentStockInOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentStockInOrderServiceImpl implements IDepartmentStockInOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> stockInOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
stockInOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : stockInOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(stockInOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_STOCKIN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditStockInOrder(List<DepartmentDetailDto> stockInOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(stockInOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
//添加原始单据号
|
||||
if(stockInOrderDtoList.get(0).getOriginalBusNo()!=null){
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.addOriginalBusNo(stockInOrderDtoList.get(0).getOriginalBusNo(), stockInOrderDtoList.get(0).getBusNo());
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : stockInOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_STOCKIN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setStartTime(item.getStartTime()).setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setSupplierId(item.getSupplierId()).setReason(item.getReason())
|
||||
.setSourceTypeEnum(LocationForm.WAREHOUSE.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStocktakingOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentStocktakingOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentStocktakingOrderServiceImpl implements IDepartmentStocktakingOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(
|
||||
SupplyCategory.GENERAL_STOCKTAKING.getValue(), SupplyCategory.GENERAL_STOCKTAKING.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(
|
||||
SupplyCategory.MONTHLY_STOCKTAKING.getValue(), SupplyCategory.MONTHLY_STOCKTAKING.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> stocktakingOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
stocktakingOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : stocktakingOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(stocktakingOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_STOCKTAKING.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditStocktakingOrder(List<DepartmentDetailDto> stocktakingOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList =
|
||||
supplyRequestService.getSupplyByBusNo(stocktakingOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : stocktakingOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_STOCKTAKING.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setTotalQuantity(item.getTotalQuantity()).setPrice(item.getPrice()).setTotalPrice(item.getTotalPrice())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setBatchInventory(item.getBatchInventory()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setReasonCode(item.getReasonCode()).setReason(item.getReason())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentTransferInOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentTransferInOrderServiceImpl implements IDepartmentTransferInOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> transferInOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
transferInOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : transferInOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(transferInOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_TRANSFERIN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferInOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditTransferInOrder(List<DepartmentDetailDto> transferInOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(transferInOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : transferInOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_TRANSFERIN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setRetailPrice(item.getPrice())
|
||||
.setTotalRetailPrice(item.getTotalPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setEndTime(item.getEndTime())
|
||||
.setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferOutOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentTransferOutOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentTransferOutOrderServiceImpl implements IDepartmentTransferOutOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> transferOutOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
transferOutOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : transferOutOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(transferOutOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_TRANSFEROUT.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferOutOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditTransferOutOrder(List<DepartmentDetailDto> transferOutOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(transferOutOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : transferOutOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_TRANSFEROUT.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setRetailPrice(item.getPrice())
|
||||
.setTotalRetailPrice(item.getTotalPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setEndTime(item.getEndTime())
|
||||
.setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentIssuanceOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/issuance-order")
|
||||
@Slf4j
|
||||
public class DepartmentIssuanceOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentIssuanceOrderService departmentIssuanceOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 发出单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentIssuanceOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发出单单据列表
|
||||
*
|
||||
* @param issuanceOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 发出单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/issuance-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam issuanceOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(issuanceOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DISPENSING_ORDER.getValue());
|
||||
}
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/issuance-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentIssuanceOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentProfitLossOrderService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/profitLoss-order")
|
||||
@Slf4j
|
||||
public class DepartmentProfitLossOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentProfitLossOrderService departmentProfitLossOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 损益单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentProfitLossOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 损益单单据列表
|
||||
*
|
||||
* @param profitLossOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 损益单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/profitLoss-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam profitLossOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(profitLossOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_PRPFITLOSS.getValue());
|
||||
}
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/profitLoss-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentProfitLossOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentProfitLossOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-profitLossOrder")
|
||||
public R<?> addOrEditProfitLossOrder(@Validated @RequestBody List<DepartmentDetailDto> profitLossOrderDtoList) {
|
||||
return departmentProfitLossOrderService.addOrEditProfitLossOrder(profitLossOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-profitLossOrder")
|
||||
public R<?> deleteProfitLossOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.profitLossAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentRequisitionOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/requisition-order")
|
||||
@Slf4j
|
||||
public class DepartmentRequisitionOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentRequisitionOrderService departmentRequisitionOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 请领单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentRequisitionOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param requisitionOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam requisitionOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(requisitionOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领单单据列表
|
||||
*
|
||||
* @param requisitionOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 请领单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/requisition-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam requisitionOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(requisitionOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_REQUISITION.getValue());
|
||||
}
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/requisition-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentRequisitionOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentRequisitionOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param requisitionOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-requisitionOrder")
|
||||
public R<?> addOrEditRequisitionOrder(@Validated @RequestBody List<DepartmentDetailDto> requisitionOrderDtoList) {
|
||||
return departmentRequisitionOrderService.addOrEditRequisitionOrder(requisitionOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-requisitionOrder")
|
||||
public R<?> deleteRequisitionOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.requisitionOrderAgreeApproval(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReturnToWarehouseOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/returnToWarehouse-order")
|
||||
@Slf4j
|
||||
public class DepartmentReturnToWarehouseOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReturnToWarehouseOrderService departmentReturnToWarehouseOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 退库单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentReturnToWarehouseOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退库单单据列表
|
||||
*
|
||||
* @param returnToDispensaryOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 退库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/returnToDispensary-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam returnToDispensaryOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(returnToDispensaryOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DEPARTMENT_RETURN.getValue());
|
||||
}
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/returnToDispensary-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentReturnToWarehouseOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentReturnToWarehouseOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-returnToDispensaryOrder")
|
||||
public R<?> addOrEditReturnToDispensaryOrder(@Validated @RequestBody List<DepartmentDetailDto> returnToDispensaryOrderDtoList) {
|
||||
return departmentReturnToWarehouseOrderService.addOrEditReturnToWarehouseOrder(returnToDispensaryOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-returnToDispensaryOrder")
|
||||
public R<?> deleteReturnToDispensaryOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.returnToWarehouseAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStockInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/stockIn-order")
|
||||
@Slf4j
|
||||
public class DepartmentStockInOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentStockInOrderService departmentStockInOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 入库单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentStockInOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单单据列表
|
||||
*
|
||||
* @param stockInOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 入库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/stockIn-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam stockInOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(stockInOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_STOCKIN.getValue());
|
||||
}
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/stockIn-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentStockInOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentStockInOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-stockInOrder")
|
||||
public R<?> addOrEditStockInOrder(@Validated @RequestBody List<DepartmentDetailDto> stockInOrderDtoList) {
|
||||
return departmentStockInOrderService.addOrEditStockInOrder(stockInOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-stockInOrder")
|
||||
public R<?> deleteStockInOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.stockInOrderAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStocktakingOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/stocktaking-order")
|
||||
@Slf4j
|
||||
public class DepartmentStocktakingOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentStocktakingOrderService departmentStocktakingOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 盘点单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentStocktakingOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点单单据列表
|
||||
*
|
||||
* @param stocktakingOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 盘点单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/stocktaking-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam stocktakingOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(stocktakingOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_STOCKTAKING.getValue());
|
||||
}
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/stocktaking-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentStocktakingOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentStocktakingOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-stocktakingOrder")
|
||||
public R<?> addOrEditStocktakingOrder(@Validated @RequestBody List<DepartmentDetailDto> stocktakingOrderDtoList) {
|
||||
return departmentStocktakingOrderService.addOrEditStocktakingOrder(stocktakingOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-stocktakingOrder")
|
||||
public R<?> deleteStocktakingOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.stocktakingAgreepproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/transferIn-order")
|
||||
@Slf4j
|
||||
public class DepartmentTransferInOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentTransferInOrderService departmentTransferInOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
|
||||
/**
|
||||
* 调入单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentTransferInOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
/**
|
||||
* 调入单单据列表
|
||||
*
|
||||
* @param transferInOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 调入单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/transferIn-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam transferInOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(transferInOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_TRANSFERIN.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/transferIn-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentTransferInOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentTransferInOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param transferInOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-transferInOrder")
|
||||
public R<?> addOrEditTransferInOrder(@Validated @RequestBody List<DepartmentDetailDto> transferInOrderDtoList) {
|
||||
return departmentTransferInOrderService.addOrEditTransferInOrder(transferInOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-transferInOrder")
|
||||
public R<?> deleteTransferInOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.transferInAgreeApproved(busNo);
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferOutOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/transferOut-order")
|
||||
@Slf4j
|
||||
public class DepartmentTransferOutOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentTransferOutOrderService departmentTransferOutOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
|
||||
/**
|
||||
* 调出单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentTransferOutOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
/**
|
||||
* 调出单单据列表
|
||||
*
|
||||
* @param transferOutOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 调出单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/transferOut-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam transferOutOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(transferOutOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DEPARTMENT_TRANSFEROUT.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/transferOut-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentTransferOutOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentTransferOutOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param transferOutOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-transferOutOrder")
|
||||
public R<?> addOrEditTransferOutOrder(@Validated @RequestBody List<DepartmentDetailDto> transferOutOrderDtoList) {
|
||||
return departmentTransferOutOrderService.addOrEditTransferOutOrder(transferOutOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-transferOutOrder")
|
||||
public R<?> deleteTransferOutOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.transferOutAgreeApproved(busNo);
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 单据详细信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDetailDto implements Serializable {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
/** 再生成单据号 */
|
||||
private String originalBusNo;
|
||||
|
||||
/** 药品编码 */
|
||||
private String itemBusNo;
|
||||
|
||||
/** 物品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 物品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 选择单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 常规单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String maxUnitCode;
|
||||
private String maxUnitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
|
||||
/** 拆零比 */
|
||||
private String partPercent;
|
||||
|
||||
/** 数量 */
|
||||
private BigDecimal itemQuantity;
|
||||
|
||||
/** 合计数量 */
|
||||
private BigDecimal totalQuantity;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 零价金额 */
|
||||
private BigDecimal totalRetailPrice;
|
||||
|
||||
/** 厂家/产地 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 批准文号 */
|
||||
private String approvalNumber;
|
||||
|
||||
/** 批次库存 */
|
||||
private BigDecimal batchInventory;
|
||||
/** 规格库存 */
|
||||
private BigDecimal specificationInventory;
|
||||
|
||||
/** 备注 */
|
||||
private String remake;
|
||||
|
||||
/** 理由类型 */
|
||||
private String reasonCode;
|
||||
|
||||
/** 摘要(理由) */
|
||||
private String reason;
|
||||
|
||||
/** 供应商 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 源仓库类型 */
|
||||
private Integer sourceTypeEnum;
|
||||
/** 源仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sourceLocationId;
|
||||
|
||||
/** 目的仓库类型 */
|
||||
private Integer purposeTypeEnum;
|
||||
/** 目的仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long purposeLocationId;
|
||||
|
||||
/** 采购员 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
|
||||
/** 审批人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long approverId;
|
||||
/** 审批时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date approvalTime;
|
||||
|
||||
/** 申请时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date applyTime;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
private String typeEnum_enumText;
|
||||
|
||||
/** 单据分类 */
|
||||
private Integer categoryEnum;
|
||||
private String categoryEnum_enumText;
|
||||
|
||||
/** 供应商联系人 */
|
||||
private String phone;
|
||||
|
||||
/** 仓库员 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/** 发票号 */
|
||||
private String invoiceNo;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 生产日期 */
|
||||
private Date startTime;
|
||||
|
||||
/** 失效日期 */
|
||||
private Date endTime;
|
||||
|
||||
/** 追溯码*/
|
||||
private String traceNo;
|
||||
|
||||
/** 追溯码单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String traceNoUnitCode;
|
||||
private String traceNoUnitCode_dictText;
|
||||
|
||||
/** 包装情况 */
|
||||
private Integer packagingConditionEnum;
|
||||
private String packagingConditionEnum_enumText;
|
||||
|
||||
/** 验收结果 */
|
||||
private Integer acceptanceResultEnum;
|
||||
private String acceptanceResultEnum_enumText;
|
||||
|
||||
/** 禁用日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 药品发放id */
|
||||
private String dispenseIds;
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
public Option() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
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 lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 物资信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDeviceInfoDto implements Serializable {
|
||||
|
||||
/** 物品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 物品编号 */
|
||||
private String busNo;
|
||||
|
||||
/** 物品名称 */
|
||||
private String name;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 包装单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
|
||||
// /** 价格单位 */
|
||||
// @Dict(dictCode = "unit_code")
|
||||
// private String conditionUnitCode;
|
||||
// private String conditionUnitCode_dictText;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 厂家/产地 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 批准文号 */
|
||||
private String approvalNumber;
|
||||
|
||||
/** 库存最小警戒线 */
|
||||
private BigDecimal itemMinQuantity;
|
||||
|
||||
/** 批次库存 */
|
||||
private BigDecimal batchInventory;
|
||||
/** 规格库存 */
|
||||
private BigDecimal specificationInventory;
|
||||
|
||||
/** 供应商 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date productionDate;
|
||||
|
||||
/** 失效日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date expirationDate;
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 单据信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDto implements Serializable {
|
||||
/** 单据号 */
|
||||
private String supplyBusNo;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
private String typeEnum_enumText;
|
||||
|
||||
/** 供应商 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 仓库类型 */
|
||||
private Integer locationTypeEnum;
|
||||
private String locationTypeEnum_enumText;
|
||||
|
||||
/** 仓库 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_location")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
|
||||
/** 采购员 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
private String applicantId_dictText;
|
||||
|
||||
/** 审批人 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long approverId;
|
||||
private String approverId_dictText;
|
||||
|
||||
/** 审批时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date approvalTime;
|
||||
|
||||
/** 制单日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date applyTime;
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 单据初期信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentInitDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 库房类型列表
|
||||
*/
|
||||
private List<DispensaryOption> warehouseTypeOption;
|
||||
|
||||
/**
|
||||
* 库房列表
|
||||
*/
|
||||
private List<LongOption> warehouseOption;
|
||||
|
||||
/**
|
||||
* 供应商列表
|
||||
*/
|
||||
private List<SupplierOption> supplierOption;
|
||||
|
||||
/**
|
||||
* 人员列表
|
||||
*/
|
||||
private List<LongOption> practitionerOption;
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
private List<IntegerOption> supplyStatusOptions;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private List<IntegerOption> supplyTypeOptions;
|
||||
|
||||
/**
|
||||
* 单据分类
|
||||
*/
|
||||
private List<IntegerOption> supplyCategoryOptions;
|
||||
/**
|
||||
* 包装情况
|
||||
*/
|
||||
private List<IntegerOption> packagingConditionOptions;
|
||||
/**
|
||||
* 包装情况
|
||||
*/
|
||||
private List<IntegerOption> acceptanceResultoryOptions;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private List<LocationDto> WarehouseListOptions;
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
private List<Organization> departmentListOptions;
|
||||
|
||||
@Data
|
||||
public static class LongOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public LongOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SupplierOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
private String phone;
|
||||
|
||||
public SupplierOption(Long value, String label, String phone) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IntegerOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public IntegerOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DispensaryOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
private List<LocationDto> locationOption;
|
||||
private List<DispensaryItemOption> orderOption;
|
||||
|
||||
public DispensaryOption(Integer value, String label,List<LocationDto> locationOption,List<DispensaryItemOption> orderOption) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.locationOption = locationOption;
|
||||
this.orderOption = orderOption;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DispensaryItemOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public DispensaryItemOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 单据查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentSearchParam implements Serializable {
|
||||
/** id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
|
||||
/** 采购员 */
|
||||
private String applicantName;
|
||||
|
||||
/** 项目名 */
|
||||
private String name;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 供应商id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
|
||||
/** 仓库类型 */
|
||||
private Integer locationTypeEnum;
|
||||
|
||||
/** 仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
|
||||
/** 单据状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 再生成单据号flg */
|
||||
private String originalBusNoFlg;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.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.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDeviceInfoDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
/**
|
||||
* 科室材料共通 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentCommonMapper {
|
||||
/**
|
||||
* 根据供应商获取物资
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param locationId 仓库id
|
||||
* @return 物资信息
|
||||
*/
|
||||
|
||||
Page<DepartmentDeviceInfoDto> getDeviceInfo(
|
||||
@Param("page") Page<DepartmentDeviceInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<DepartmentSearchParam> queryWrapper,
|
||||
@Param("locationId") Long locationId, @Param("supplierId") Long supplierId);
|
||||
|
||||
/**
|
||||
* 查询订货单分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param originalBusNoFlg 再生成单据号flg
|
||||
* @param locationFlg 仓库flg
|
||||
* @return 订货单分页列表
|
||||
*/
|
||||
Page<DepartmentDto> getPage(@Param("page") Page<DepartmentDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<DepartmentSearchParam> queryWrapper,
|
||||
@Param("originalBusNoFlg") String originalBusNoFlg, @Param("locationFlg") String locationFlg);
|
||||
|
||||
/**
|
||||
* 查询单据详情
|
||||
*
|
||||
* @param page 分页
|
||||
* @param busNo 单据号
|
||||
* @return 单据详情
|
||||
*/
|
||||
Page<DepartmentDetailDto> getDetailPage(@Param("page") Page<DepartmentDetailDto> page,
|
||||
@Param("busNo") String busNo);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 科室材料发出单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentIssuanceOrderMapper {
|
||||
|
||||
/**
|
||||
* 获取更表所需信息
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @param dispenseStatus 发放状态
|
||||
* @return 单据详情
|
||||
*/
|
||||
List<DepartmentDetailDto> getInfo(@Param("dispenseIdList") List<Long> dispenseIdList,@Param("dispenseStatus") Integer dispenseStatus);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料损益单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentProfitLossOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料请领单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentRequisitionOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料退库单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentReturnToWarehouseOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料入库单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentStockInOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentStocktakingOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料调入单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentTransferInOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料调出单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentTransferOutOrderMapper {
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.openhis.web.doctorstation.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.dto.ReservationRecordDto;
|
||||
|
||||
/**
|
||||
* 医生站-预约记录 应用Service
|
||||
*/
|
||||
public interface IReservationRecordAppService {
|
||||
|
||||
/**
|
||||
* 保存预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveReservation(ReservationRecordDto reservationRecordDto);
|
||||
|
||||
/**
|
||||
* 编辑预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> editReservation(ReservationRecordDto reservationRecordDto);
|
||||
|
||||
/**
|
||||
* 删除预约记录
|
||||
*
|
||||
* @param id id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> delReservation(Long id);
|
||||
|
||||
/**
|
||||
* 查询 预约记录
|
||||
*
|
||||
* @param reservationRecordDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 预约记录
|
||||
*/
|
||||
IPage<ReservationRecordDto> getReservationInfo(ReservationRecordDto reservationRecordDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -1,556 +0,0 @@
|
||||
package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
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.conditions.update.LambdaUpdateWrapper;
|
||||
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.AssignSeqUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.EncounterDiagnosis;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IEncounterDiagnosisService;
|
||||
import com.openhis.clinical.domain.Condition;
|
||||
import com.openhis.clinical.domain.ConditionDefinition;
|
||||
import com.openhis.clinical.mapper.ConditionDefinitionMapper;
|
||||
import com.openhis.clinical.service.IConditionService;
|
||||
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.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationChineseMedicalAppService;
|
||||
import com.openhis.web.doctorstation.dto.*;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationChineseMedicalAppMapper;
|
||||
import com.openhis.web.doctorstation.utils.AdviceUtils;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
|
||||
/**
|
||||
* 医生站-中医 应用实现类
|
||||
*/
|
||||
@Service
|
||||
public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStationChineseMedicalAppService {
|
||||
|
||||
@Resource
|
||||
DoctorStationChineseMedicalAppMapper doctorStationChineseMedicalAppMapper;
|
||||
|
||||
@Resource
|
||||
ConditionDefinitionMapper conditionDefinitionMapper;
|
||||
|
||||
@Resource
|
||||
IConditionService iConditionService;
|
||||
|
||||
@Resource
|
||||
IEncounterDiagnosisService iEncounterDiagnosisService;
|
||||
|
||||
@Resource
|
||||
IDoctorStationAdviceAppService iDoctorStationAdviceAppService;
|
||||
|
||||
@Resource
|
||||
IMedicationRequestService iMedicationRequestService;
|
||||
|
||||
@Resource
|
||||
IMedicationDispenseService iMedicationDispenseService;
|
||||
|
||||
@Resource
|
||||
IActivityDefinitionService iActivityDefinitionService;
|
||||
|
||||
@Resource
|
||||
IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
AdviceUtils adviceUtils;
|
||||
|
||||
/**
|
||||
* 查询中医诊断数据
|
||||
*
|
||||
* @param searchKey 关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 中医诊断数据
|
||||
*/
|
||||
@Override
|
||||
public Page<ConditionDefinitionMetadata> getConditionInfo(String searchKey, Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
ConditionDefinition conditionDefinition = new ConditionDefinition();
|
||||
// 查询状态是有效的
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
// 中医诊断
|
||||
conditionDefinition.setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue());
|
||||
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(conditionDefinition, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("update_time");
|
||||
// 诊断信息
|
||||
Page<ConditionDefinitionMetadata> conditionDefinitionMetadataPage = HisPageUtils
|
||||
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
|
||||
conditionDefinitionMetadataPage.getRecords().forEach(e -> {
|
||||
// 所属分类
|
||||
e.setSourceEnum_enumText(EnumUtils.getInfoByValue(ConditionDefinitionSource.class, e.getSourceEnum()));
|
||||
// 中医诊断
|
||||
e.setTypeName(CommonConstants.BusinessName.TCM_DIAGNOSIS);
|
||||
// 医保标记
|
||||
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
|
||||
// 医保对码标记
|
||||
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
|
||||
});
|
||||
return conditionDefinitionMetadataPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医证候数据
|
||||
*
|
||||
* @param searchKey 关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 中医证候数据
|
||||
*/
|
||||
@Override
|
||||
public Page<ConditionDefinitionMetadata> getSyndromeInfo(String searchKey, Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
ConditionDefinition conditionDefinition = new ConditionDefinition();
|
||||
// 查询状态是有效的
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
// 中医证候
|
||||
conditionDefinition
|
||||
.setSourceEnum(ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue());
|
||||
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(conditionDefinition, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("update_time");
|
||||
// 诊断信息
|
||||
Page<ConditionDefinitionMetadata> conditionDefinitionMetadataPage = HisPageUtils
|
||||
.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, ConditionDefinitionMetadata.class);
|
||||
conditionDefinitionMetadataPage.getRecords().forEach(e -> {
|
||||
// 所属分类
|
||||
e.setSourceEnum_enumText(EnumUtils.getInfoByValue(ConditionDefinitionSource.class, e.getSourceEnum()));
|
||||
// 中医证候
|
||||
e.setTypeName(CommonConstants.BusinessName.TCM_SYNDROME_CATALOG);
|
||||
// 医保标记
|
||||
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
|
||||
// 医保对码标记
|
||||
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
|
||||
});
|
||||
return conditionDefinitionMetadataPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存中医诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveTcmDiagnosis(SaveDiagnosisParam saveDiagnosisParam) {
|
||||
// 患者id
|
||||
Long patientId = saveDiagnosisParam.getPatientId();
|
||||
// 就诊ID
|
||||
Long encounterId = saveDiagnosisParam.getEncounterId();
|
||||
// 诊断定义集合
|
||||
List<SaveDiagnosisChildParam> diagnosisChildList = saveDiagnosisParam.getDiagnosisChildList();
|
||||
// 保存诊断管理
|
||||
Condition condition;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
condition = new Condition();
|
||||
condition.setId(saveDiagnosisChildParam.getConditionId());
|
||||
condition.setVerificationStatusEnum(saveDiagnosisChildParam.getVerificationStatusEnum());
|
||||
condition.setPatientId(patientId);
|
||||
condition.setDefinitionId(saveDiagnosisChildParam.getDefinitionId());
|
||||
condition.setYbNo(saveDiagnosisChildParam.getYbNo());
|
||||
condition.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
condition.setRecordedDatetime(new Date());
|
||||
condition.setRecorderId(SecurityUtils.getLoginUser().getPractitionerId());// 记录人
|
||||
iConditionService.saveOrUpdate(condition);
|
||||
saveDiagnosisChildParam.setConditionId(condition.getId());
|
||||
}
|
||||
// 保存就诊诊断
|
||||
EncounterDiagnosis encounterDiagnosis;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
encounterDiagnosis.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
encounterDiagnosis.setSyndromeGroupNo(saveDiagnosisChildParam.getSyndromeGroupNo());// 中医证候组号
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"中医诊断"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医就诊诊断信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 中医就诊诊断信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getTcmEncounterDiagnosis(Long encounterId) {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
// 中医就诊诊断信息
|
||||
List<DiagnosisQueryDto> tcmEncounterDiagnosis =
|
||||
doctorStationChineseMedicalAppMapper.getTcmEncounterDiagnosis(encounterId);
|
||||
// 病
|
||||
List<DiagnosisQueryDto> illness = tcmEncounterDiagnosis.stream().filter(
|
||||
e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue().equals(e.getSourceEnum()))
|
||||
.collect(Collectors.toList());
|
||||
// 症
|
||||
List<DiagnosisQueryDto> symptom = tcmEncounterDiagnosis.stream()
|
||||
.filter(e -> ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue()
|
||||
.equals(e.getSourceEnum()))
|
||||
.collect(Collectors.toList());
|
||||
resultMap.put("illness", illness);
|
||||
resultMap.put("symptom", symptom);
|
||||
return R.ok(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医医嘱信息
|
||||
*
|
||||
* @param adviceBaseDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param locationId 药房id
|
||||
* @param adviceDefinitionIdParamList 医嘱定义id参数集合
|
||||
* @param organizationId 患者挂号对应的科室id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param pricingFlag 划价标记
|
||||
* @return 中医医嘱信息
|
||||
*/
|
||||
@Override
|
||||
public IPage<AdviceBaseDto> getTcmAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
|
||||
Integer pricingFlag) {
|
||||
adviceBaseDto.setAdviceType(1); // 医嘱类型为药品
|
||||
adviceBaseDto.setCategoryCode(medCategoryCode.CHINESE_HERBAL_MEDICINE.getValue());// 中草药
|
||||
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
|
||||
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, pricingFlag, List.of(1, 2, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊保存(签发)中医医嘱
|
||||
*
|
||||
* @param adviceSaveParam 医嘱表单信息
|
||||
* @param adviceOpType 保存或签发
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveOrSignTcmAdvice(AdviceSaveParam adviceSaveParam, String adviceOpType) {
|
||||
// 医嘱分类信息 (中草药)
|
||||
List<AdviceSaveDto> medicineList = adviceSaveParam.getAdviceSaveList();
|
||||
// 保存操作
|
||||
boolean is_save = AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType);
|
||||
// 签发操作
|
||||
boolean is_sign = AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType);
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 患者挂号对应的科室id
|
||||
Long organizationId = adviceSaveParam.getOrganizationId();
|
||||
// 保存时,校验库存
|
||||
if (is_save) {
|
||||
List<AdviceSaveDto> needCheckList = medicineList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
|
||||
// 校验库存
|
||||
String tipRes = adviceUtils.checkInventory(needCheckList);
|
||||
if (tipRes != null) {
|
||||
return R.fail(null, tipRes);
|
||||
}
|
||||
}
|
||||
// 药品请求
|
||||
MedicationRequest medicationRequest;
|
||||
// 费用项
|
||||
ChargeItem chargeItem;
|
||||
// 新增 + 修改
|
||||
List<AdviceSaveDto> insertOrUpdateList =
|
||||
medicineList.stream().filter(e -> (DbOpType.INSERT.getCode().equals(e.getDbOpType())
|
||||
|| DbOpType.UPDATE.getCode().equals(e.getDbOpType()))).collect(Collectors.toList());
|
||||
// 删除
|
||||
List<AdviceSaveDto> deleteList = medicineList.stream()
|
||||
.filter(e -> DbOpType.DELETE.getCode().equals(e.getDbOpType())).collect(Collectors.toList());
|
||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||
iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
|
||||
// 删除已经产生的药品发放信息
|
||||
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
|
||||
// 删除费用项
|
||||
iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
||||
adviceSaveDto.getRequestId());
|
||||
}
|
||||
// 是否代煎
|
||||
Integer sufferingFlag = adviceSaveParam.getSufferingFlag();
|
||||
|
||||
if (is_sign) {
|
||||
// 按groupId分组
|
||||
Map<Long, List<AdviceSaveDto>> groupMap =
|
||||
insertOrUpdateList.stream().collect(Collectors.groupingBy(AdviceSaveDto::getGroupId));
|
||||
// 为每个分组生成唯一的处方号
|
||||
groupMap.forEach((groupId, groupList) -> {
|
||||
String prescriptionNo =
|
||||
assignSeqUtil.getSeq(AssignSeqEnum.PRESCRIPTION_CHINESE_HERBAL_MEDICINE.getPrefix(), 8);
|
||||
groupList.forEach(dto -> dto.setPrescriptionNo(prescriptionNo));
|
||||
});
|
||||
}
|
||||
|
||||
// 医嘱签发编码
|
||||
String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), 10);
|
||||
for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) {
|
||||
// 中药付数
|
||||
Integer chineseHerbsDoseQuantity = adviceSaveDto.getChineseHerbsDoseQuantity();
|
||||
medicationRequest = new MedicationRequest();
|
||||
medicationRequest.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
medicationRequest.setId(adviceSaveDto.getRequestId()); // 主键id
|
||||
medicationRequest.setStatusEnum(is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue()); // 请求状态
|
||||
if (is_sign) {
|
||||
medicationRequest.setGroupId(adviceSaveDto.getGroupId()); // 组号
|
||||
medicationRequest.setPrescriptionNo(adviceSaveDto.getPrescriptionNo()); // 处方号
|
||||
medicationRequest.setSignCode(signCode);
|
||||
}
|
||||
// 只有保存时才处理的字段属性
|
||||
if (is_save) {
|
||||
medicationRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
|
||||
medicationRequest.setChineseHerbsDoseQuantity(chineseHerbsDoseQuantity); // 中药付数
|
||||
medicationRequest.setSufferingFlag(sufferingFlag); // 代煎标识
|
||||
medicationRequest.setQuantity(adviceSaveDto.getQuantity() * chineseHerbsDoseQuantity); // 请求数量
|
||||
medicationRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
|
||||
medicationRequest.setLotNumber(adviceSaveDto.getLotNumber()); // 产品批号
|
||||
medicationRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型
|
||||
medicationRequest.setMedicationId(adviceSaveDto.getAdviceDefinitionId());// 医嘱定义id
|
||||
medicationRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者
|
||||
medicationRequest.setPractitionerId(adviceSaveDto.getPractitionerId()); // 开方医生
|
||||
medicationRequest.setOrgId(adviceSaveDto.getFounderOrgId()); // 开方人科室
|
||||
medicationRequest.setReqAuthoredTime(curDate); // 请求开始时间
|
||||
// 发放药房
|
||||
medicationRequest.setPerformLocation(adviceSaveDto.getLocationId());
|
||||
medicationRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
|
||||
medicationRequest.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
medicationRequest.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
medicationRequest.setTherapyEnum(adviceSaveDto.getTherapyEnum()); // 治疗类型,默认-临时
|
||||
medicationRequest.setMethodCode(adviceSaveDto.getMethodCode()); // 用法
|
||||
medicationRequest.setRateCode(adviceSaveDto.getRateCode()); // 用药频次
|
||||
medicationRequest.setDose(adviceSaveDto.getDose()); // 单次剂量
|
||||
medicationRequest.setDoseUnitCode(adviceSaveDto.getDoseUnitCode()); // 剂量单位
|
||||
// medicationRequest.setDispensePerDuration(adviceSaveDto.getDispensePerDuration()); // 每次发药供应天数
|
||||
medicationRequest.setContentJson(adviceSaveDto.getContentJson()); // 请求内容json
|
||||
medicationRequest.setYbClassEnum(adviceSaveDto.getYbClassEnum());// 类别医保编码
|
||||
}
|
||||
iMedicationRequestService.saveOrUpdate(medicationRequest);
|
||||
if (is_save) {
|
||||
// 处理药品发放
|
||||
iMedicationDispenseService.handleMedicationDispense(medicationRequest, adviceSaveDto.getDbOpType());
|
||||
// 保存药品费用项
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setId(adviceSaveDto.getChargeItemId()); // 费用项id
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 默认-草稿
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(medicationRequest.getBusNo()));
|
||||
chargeItem.setPrescriptionNo(adviceSaveDto.getPrescriptionNo()); // 处方号
|
||||
chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型
|
||||
chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
|
||||
chargeItem.setDefinitionId(adviceSaveDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setDefDetailId(adviceSaveDto.getDefinitionDetailId()); // 定价子表主键
|
||||
chargeItem.setEntererId(adviceSaveDto.getPractitionerId());// 开立人ID
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.MED_MEDICATION_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(medicationRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable(adviceSaveDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(adviceSaveDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID
|
||||
chargeItem.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
|
||||
chargeItem.setQuantityValue(medicationRequest.getQuantity()); // 数量
|
||||
chargeItem.setQuantityUnit(medicationRequest.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(chargeItem.getQuantityValue());
|
||||
chargeItem.setTotalPrice(qty.multiply(chargeItem.getUnitPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价
|
||||
|
||||
chargeItem.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
iChargeItemService.saveOrUpdate(chargeItem);
|
||||
}
|
||||
}
|
||||
// 就诊id
|
||||
Long encounterId = medicineList.get(0).getEncounterId();
|
||||
// 患者id
|
||||
Long patientId = medicineList.get(0).getPatientId();
|
||||
// 账户id
|
||||
Long accountId = medicineList.get(0).getAccountId();
|
||||
// 诊断ID
|
||||
Long conditionId = medicineList.get(0).getConditionId();
|
||||
// 就诊诊断id
|
||||
Long encounterDiagnosisId = medicineList.get(0).getEncounterDiagnosisId();
|
||||
// 中药代煎定义id
|
||||
Long sufferingDefinitionId =
|
||||
iActivityDefinitionService.getAppointActivityDefinitionId(CommonConstants.BusinessName.SUFFERING_TCM);
|
||||
// 签发时,生成中药代煎的账单,只生成一次
|
||||
if (Whether.YES.getValue().equals(sufferingFlag) && is_sign) {
|
||||
Integer quantity = 1; // 请求数量
|
||||
|
||||
AdviceBaseDto adviceBaseDto = new AdviceBaseDto();
|
||||
adviceBaseDto.setAdviceDefinitionId(sufferingDefinitionId); // 医嘱定义id
|
||||
// 当前是否已经生成了贵代煎账单
|
||||
ChargeItem one = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getEncounterId, encounterId).eq(ChargeItem::getProductId, sufferingDefinitionId));
|
||||
if (one == null) {
|
||||
// 对应的诊疗医嘱信息
|
||||
AdviceBaseDto activityAdviceBaseDto =
|
||||
iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1,
|
||||
1, Whether.NO.getValue(), List.of(1, 2, 3)).getRecords().get(0);
|
||||
if (activityAdviceBaseDto != null) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
if (advicePriceDto != null) {
|
||||
// 生成账单
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue()); // 账单生成来源
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 草稿
|
||||
chargeItem.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix(), 4));
|
||||
chargeItem.setPatientId(patientId); // 患者
|
||||
chargeItem.setContextEnum(ChargeItemContext.ACTIVITY.getValue()); // 类型
|
||||
chargeItem.setEncounterId(encounterId); // 就诊id
|
||||
chargeItem.setDefinitionId(advicePriceDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());// 开立人ID
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setProductTable(activityAdviceBaseDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(activityAdviceBaseDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(accountId);// 关联账户ID
|
||||
chargeItem.setConditionId(conditionId); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(encounterDiagnosisId); // 就诊诊断id
|
||||
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
chargeItem
|
||||
.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
chargeItem.setTcmFlag(Whether.YES.getValue());// 中医标识
|
||||
iChargeItemService.save(chargeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Whether.NO.getValue().equals(sufferingFlag)) {
|
||||
// 删除中药代煎的账单
|
||||
iChargeItemService.remove(new LambdaQueryWrapper<ChargeItem>().eq(ChargeItem::getEncounterId, encounterId)
|
||||
.eq(ChargeItem::getProductId, sufferingDefinitionId));
|
||||
}
|
||||
|
||||
// 签发时,把草稿状态的账单更新为待收费[中医]
|
||||
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !medicineList.isEmpty()) {
|
||||
// 签发的医嘱id集合
|
||||
List<Long> requestIds = medicineList.stream()
|
||||
.filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null)
|
||||
.collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList());
|
||||
iChargeItemService.update(new LambdaUpdateWrapper<ChargeItem>()
|
||||
.set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue())
|
||||
.eq(ChargeItem::getEncounterId, encounterId)
|
||||
.eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue())
|
||||
.in(ChargeItem::getServiceId, requestIds));
|
||||
}
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"门诊中医医嘱"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医医嘱请求数据
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 医嘱请求数据
|
||||
*/
|
||||
public R<?> getTcmRequestBaseInfo(Long encounterId) {
|
||||
// 当前账号的参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
// 医嘱请求数据
|
||||
List<RequestBaseDto> requestBaseInfo = doctorStationChineseMedicalAppMapper.getTcmRequestBaseInfo(encounterId,
|
||||
null, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode());
|
||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||
// 请求状态
|
||||
requestBaseDto
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
|
||||
// 收费状态
|
||||
requestBaseDto.setChargeStatus_enumText(
|
||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
|
||||
}
|
||||
return R.ok(requestBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医历史医嘱请求数据
|
||||
*
|
||||
* @param patientId 病人id
|
||||
* @param encounterId 就诊id
|
||||
* @return 中医历史医嘱请求数据
|
||||
*/
|
||||
@Override
|
||||
public R<?> getTcmRequestHistoryInfo(Long patientId, Long encounterId) {
|
||||
// 当前账号的参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
// 医嘱请求数据
|
||||
List<RequestBaseDto> requestBaseInfo =
|
||||
doctorStationChineseMedicalAppMapper.getTcmRequestHistoryInfo(encounterId, patientId,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode());
|
||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||
// 请求状态
|
||||
requestBaseDto
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, requestBaseDto.getStatusEnum()));
|
||||
// 收费状态
|
||||
requestBaseDto.setChargeStatus_enumText(
|
||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
|
||||
}
|
||||
return R.ok(requestBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中医诊断
|
||||
*
|
||||
* @param syndromeGroupNo 中医证候组号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> delTcmDiagnosis(String syndromeGroupNo) {
|
||||
// 诊断id集合
|
||||
List<Long> conditionIds = doctorStationChineseMedicalAppMapper.getConditionIds(syndromeGroupNo);
|
||||
if (conditionIds.isEmpty()) {
|
||||
return R.fail("数据已被删除,请刷新页面");
|
||||
}
|
||||
if (doctorStationChineseMedicalAppMapper.getAdviceNumByConditionIds(conditionIds) > 0) {
|
||||
return R.fail("所选诊断已经存在医嘱记录,不允许删除");
|
||||
}
|
||||
for (Long conditionId : conditionIds) {
|
||||
iConditionService.removeById(conditionId);
|
||||
iEncounterDiagnosisService.remove(
|
||||
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getConditionId, conditionId));
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"就诊诊断信息"}));
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.clinical.domain.ReservationRecord;
|
||||
import com.openhis.clinical.service.IReservationRecordService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.doctorstation.appservice.IReservationRecordAppService;
|
||||
import com.openhis.web.doctorstation.dto.ReservationRecordDto;
|
||||
import com.openhis.web.doctorstation.mapper.ReservationRecordAppMapper;
|
||||
|
||||
/**
|
||||
* 医生站-预约记录 应用实现类
|
||||
*/
|
||||
@Service
|
||||
public class ReservationRecordAppServiceImpl implements IReservationRecordAppService {
|
||||
|
||||
@Resource
|
||||
ReservationRecordAppMapper reservationRecordAppMapper;
|
||||
|
||||
@Resource
|
||||
IReservationRecordService iReservationRecordService;
|
||||
|
||||
/**
|
||||
* 保存预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveReservation(ReservationRecordDto reservationRecordDto) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
ReservationRecord reservationRecord = new ReservationRecord();
|
||||
|
||||
reservationRecord.setPatientName(reservationRecordDto.getPatientName()); // 患者名称
|
||||
reservationRecord.setPatientTel(reservationRecordDto.getPatientTel()); // 患者联系方式
|
||||
reservationRecord.setChiefComplaint(reservationRecordDto.getChiefComplaint()); // 主诉
|
||||
reservationRecord.setReservationTime(reservationRecordDto.getReservationTime());// 就诊预约时间
|
||||
reservationRecord.setRemark(reservationRecordDto.getRemark()); // 备注
|
||||
reservationRecord.setOrgId(orgId); // 预约科室id
|
||||
reservationRecord.setPractitionerId(practitionerId); // 预约医生id
|
||||
iReservationRecordService.save(reservationRecord);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"预约记录"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> editReservation(ReservationRecordDto reservationRecordDto) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
ReservationRecord reservationRecord = new ReservationRecord();
|
||||
|
||||
reservationRecord.setId(reservationRecordDto.getId()); // id
|
||||
reservationRecord.setPatientName(reservationRecordDto.getPatientName()); // 患者名称
|
||||
reservationRecord.setPatientTel(reservationRecordDto.getPatientTel()); // 患者联系方式
|
||||
reservationRecord.setChiefComplaint(reservationRecordDto.getChiefComplaint()); // 主诉
|
||||
reservationRecord.setReservationTime(reservationRecordDto.getReservationTime());// 就诊预约时间
|
||||
reservationRecord.setRemark(reservationRecordDto.getRemark()); // 备注
|
||||
reservationRecord.setOrgId(orgId); // 预约科室id
|
||||
reservationRecord.setPractitionerId(practitionerId); // 预约医生id
|
||||
iReservationRecordService.updateById(reservationRecord);
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"预约记录"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预约记录
|
||||
*
|
||||
* @param id id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> delReservation(Long id) {
|
||||
iReservationRecordService.removeById(id);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"预约记录"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 预约记录
|
||||
*
|
||||
* @param reservationRecordDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 预约记录
|
||||
*/
|
||||
@Override
|
||||
public IPage<ReservationRecordDto> getReservationInfo(ReservationRecordDto reservationRecordDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<ReservationRecordDto> queryWrapper = HisQueryUtils.buildQueryWrapper(reservationRecordDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "chief_complaint", "patient_tel")), request);
|
||||
|
||||
return reservationRecordAppMapper.getReservationInfo(new Page<>(pageNo, pageSize), orgId, practitionerId,
|
||||
queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.doctorstation.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.appservice.IReservationRecordAppService;
|
||||
import com.openhis.web.doctorstation.dto.ReservationRecordDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 医生站-预约记录 controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doctor-station/reservation-record")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ReservationRecordController {
|
||||
|
||||
private final IReservationRecordAppService iReservationRecordAppService;
|
||||
|
||||
/**
|
||||
* 保存预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/save-reservation")
|
||||
public R<?> saveReservation(@RequestBody ReservationRecordDto reservationRecordDto) {
|
||||
return iReservationRecordAppService.saveReservation(reservationRecordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑预约记录
|
||||
*
|
||||
* @param reservationRecordDto 预约记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "/edit-reservation")
|
||||
public R<?> editReservation(@RequestBody ReservationRecordDto reservationRecordDto) {
|
||||
return iReservationRecordAppService.editReservation(reservationRecordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预约记录
|
||||
*
|
||||
* @param id id
|
||||
* @return 结果
|
||||
*/
|
||||
@DeleteMapping("/del-reservation")
|
||||
public R<?> delReservation(@RequestParam Long id) {
|
||||
return iReservationRecordAppService.delReservation(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 预约记录
|
||||
*
|
||||
* @param reservationRecordDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 预约记录
|
||||
*/
|
||||
@GetMapping(value = "/reservation-info")
|
||||
public R<?> getReservationInfo(ReservationRecordDto reservationRecordDto,
|
||||
@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(iReservationRecordAppService.getReservationInfo(reservationRecordDto, searchKey, pageNo, pageSize,
|
||||
request));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.openhis.web.doctorstation.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 ActivityChildrenJsonParams {
|
||||
|
||||
/** 治疗类型 */
|
||||
private Integer therapyEnum;
|
||||
|
||||
/** 患者 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 就诊id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 账户id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 费用项id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long chargeItemId;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 诊断信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ElepPrescriptionInitConditionDto {
|
||||
/**
|
||||
* 诊断id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long conditionId;
|
||||
/**
|
||||
* 诊断名
|
||||
*/
|
||||
private String conditionName;
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 处方信息 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionInfoBaseDto {
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 诊断定义名称
|
||||
*/
|
||||
private String conditionDefinitionName;
|
||||
|
||||
/** 请求时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date requestTime;
|
||||
|
||||
/**
|
||||
* 开方医生
|
||||
*/
|
||||
private String practitionerName;
|
||||
|
||||
/** 科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
private Long organizationId;
|
||||
private String organizationId_dictText;
|
||||
|
||||
/** 出生日期 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date birthDate;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private String age;
|
||||
|
||||
/**
|
||||
* 性别编码
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 就诊号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 费用性质
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
private List<PrescriptionInfoDetailDto> prescriptionInfoDetailList;
|
||||
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
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
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionInfoDetailDto {
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 请求id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/**
|
||||
* 请求人id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_practitioner", dictCode = "id", dictText = "name")
|
||||
private Long requesterId;
|
||||
private String requesterId_dictText;
|
||||
|
||||
/** 请求时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date requestTime;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
|
||||
/** 医嘱名称 */
|
||||
private String adviceName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String volume;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 请求数量 */
|
||||
private Integer quantity;
|
||||
|
||||
/** 请求单位编码 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 请求状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 用法
|
||||
*/
|
||||
@Dict(dictCode = "method_code")
|
||||
private String methodCode;
|
||||
private String methodCode_dictText;
|
||||
|
||||
/**
|
||||
* 使用频次
|
||||
*/
|
||||
@Dict(dictCode = "rate_code")
|
||||
private String rateCode;
|
||||
private String rateCode_dictText;
|
||||
|
||||
/**
|
||||
* 单次剂量
|
||||
*/
|
||||
private BigDecimal dose;
|
||||
|
||||
/** 剂量单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String doseUnitCode;
|
||||
private String doseUnitCode_dictText;
|
||||
|
||||
/**
|
||||
* 费用项id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long chargeItemId;
|
||||
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 收费状态 */
|
||||
private Integer chargeStatus;
|
||||
private String chargeStatus_enumText;
|
||||
|
||||
/**
|
||||
* 物理位置id | 可能是 发药药房id,耗材房id,执行科室id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long positionId;
|
||||
|
||||
/**
|
||||
* 物理位置| 可能是 发药药房,耗材房,执行科室
|
||||
*/
|
||||
private String positionName;
|
||||
|
||||
/** 用药天数 */
|
||||
private Integer dispensePerDuration;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/**
|
||||
* 诊断定义名称
|
||||
*/
|
||||
private String conditionDefinitionName;
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 预约记录 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReservationRecordDto {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 患者名称
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 患者联系方式
|
||||
*/
|
||||
private String patientTel;
|
||||
|
||||
/**
|
||||
* 主诉
|
||||
*/
|
||||
private String chiefComplaint;
|
||||
|
||||
/**
|
||||
* 就诊预约时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date reservationTime;
|
||||
|
||||
/**
|
||||
* 预约科室id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 预约医生id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.openhis.web.doctorstation.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.openhis.web.doctorstation.dto.DiagnosisQueryDto;
|
||||
import com.openhis.web.doctorstation.dto.RequestBaseDto;
|
||||
|
||||
/**
|
||||
* 医生站-中医 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface DoctorStationChineseMedicalAppMapper {
|
||||
|
||||
/**
|
||||
* 查询中医就诊诊断信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 中医就诊诊断信息
|
||||
*/
|
||||
List<DiagnosisQueryDto> getTcmEncounterDiagnosis(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 查询中医医嘱请求数据
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param patientId 患者id
|
||||
* @param MED_MEDICATION_REQUEST 药品请求表名
|
||||
* @param WOR_DEVICE_REQUEST 耗材请求表名
|
||||
* @param WOR_SERVICE_REQUEST 诊疗请求表名
|
||||
* @param practitionerId 当前账号的参与者id
|
||||
* @param historyFlag 历史医嘱标记
|
||||
* @return 中医医嘱请求数据
|
||||
*/
|
||||
List<RequestBaseDto> getTcmRequestBaseInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("patientId") Long patientId, @Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
|
||||
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
|
||||
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
|
||||
@Param("historyFlag") String historyFlag);
|
||||
|
||||
/**
|
||||
* 查询中医医嘱历史请求数据
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param patientId 患者id
|
||||
* @param MED_MEDICATION_REQUEST 药品请求表名
|
||||
* @param WOR_DEVICE_REQUEST 耗材请求表名
|
||||
* @param WOR_SERVICE_REQUEST 诊疗请求表名
|
||||
* @param practitionerId 当前账号的参与者id
|
||||
* @param historyFlag 历史医嘱标记
|
||||
* @return 中医医嘱历史请求数据
|
||||
*/
|
||||
List<RequestBaseDto> getTcmRequestHistoryInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("patientId") Long patientId, @Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
|
||||
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
|
||||
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
|
||||
@Param("historyFlag") String historyFlag);
|
||||
|
||||
/**
|
||||
* 查询中医诊断id集合
|
||||
*
|
||||
* @param syndromeGroupNo 中医证候组号
|
||||
* @return 中医诊断id集合
|
||||
*/
|
||||
List<Long> getConditionIds(@Param("syndromeGroupNo") String syndromeGroupNo);
|
||||
|
||||
/**
|
||||
* 根据诊断id集合查询对应开立的医嘱个数
|
||||
*
|
||||
* @param conditionIds 诊断id集合
|
||||
* @return 开立的医嘱个数
|
||||
*/
|
||||
Integer getAdviceNumByConditionIds(@Param("conditionIds") List<Long> conditionIds);
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.openhis.web.doctorstation.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.openhis.web.doctorstation.dto.*;
|
||||
import com.openhis.web.reportmanage.dto.ChargeReportPageDto;
|
||||
import com.openhis.web.reportmanage.dto.ChargeReportSearchParam;
|
||||
import com.openhis.ybcatalog.domain.CatalogDrugInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 医生站-电子处方 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface DoctorStationElepPrescriptionMapper {
|
||||
|
||||
/**
|
||||
* 获取药品信息
|
||||
*
|
||||
* @param medicationNo 药品号
|
||||
* @param version 药品版本号
|
||||
* @return 药品信息
|
||||
*/
|
||||
CatalogDrugInfo selectCatalogDrugInfoByNo(@Param("medicationNo") String medicationNo,@Param("version") String version);
|
||||
|
||||
/**
|
||||
* 获取药品信息
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 药品信息
|
||||
*/
|
||||
Page<CatalogDrugInfo> selectCatalogDrugInfo(@Param("page") Page<ChargeReportPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<String> queryWrapper);
|
||||
|
||||
/**
|
||||
* 获取处方信息
|
||||
*
|
||||
* @param page 分页
|
||||
* @param patientId 患者id
|
||||
* @return 药品信息
|
||||
*/
|
||||
Page<ElepPrescriptionInfoDto> selectElepPrescriptionInfo(@Param("page") Page<ElepPrescriptionInfoDto> page, @Param("patientId") Long patientId);
|
||||
|
||||
/**
|
||||
* 获取处方信息
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 药品信息
|
||||
*/
|
||||
Page<ElepMedicationInfoDto> selectMedicationInfo(@Param("page") Page<ElepPrescriptionInfoDto> page, @Param("prescriptionNo") String prescriptionNo);
|
||||
|
||||
/**
|
||||
* 搜索更表需要信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 药品信息
|
||||
*/
|
||||
ElepPrescriptionInfoParam selectSaveInfo(@Param("encounterId") Long encounterId);
|
||||
|
||||
// /**
|
||||
// * 搜索诊断信息
|
||||
// *
|
||||
// * @param encounterId 就诊id
|
||||
// * @return 诊断信息
|
||||
// */
|
||||
// List<ElepPrescriptionInitConditionDto> selectConditionInfo(@Param("encounterId") Long encounterId);
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.openhis.web.doctorstation.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.doctorstation.dto.PatientInfoDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
|
||||
/**
|
||||
* 医生站-主页面 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface DoctorStationMainAppMapper {
|
||||
|
||||
/**
|
||||
* 查询就诊患者信息
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param participantType 参与者类型 - 挂号医生
|
||||
* @param participantType2 参与者类型 - 接诊医生
|
||||
* @param ClinicalStatus 过敏史状态
|
||||
* @param userId 当前登录账号ID
|
||||
* @param currentUserOrganizationId 当前登录账号所属的科室ID
|
||||
* @param pricingFlag 划价标记
|
||||
* @param encounterStatus 就诊状态
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 就诊患者信息
|
||||
*/
|
||||
IPage<PatientInfoDto> getPatientInfo(@Param("page") Page<PatientInfoDto> page,
|
||||
@Param("participantType") String participantType, @Param("participantType2") String participantType2,
|
||||
@Param("ClinicalStatus") Integer ClinicalStatus, @Param("userId") Long userId,
|
||||
@Param("currentUserOrganizationId") Long currentUserOrganizationId, @Param("pricingFlag") Integer pricingFlag,
|
||||
@Param("encounterStatus") Integer encounterStatus,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PatientInfoDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询处方号列表信息
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 处方号列表信息
|
||||
*/
|
||||
IPage<PrescriptionInfoBaseDto> getPrescriptionPageInfo(@Param("page") Page<PrescriptionInfoBaseDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PrescriptionInfoBaseDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询处方详情
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param encounterId 就诊id
|
||||
* @return 处方详情
|
||||
*/
|
||||
List<PrescriptionInfoDetailDto> getPrescriptionDetailInfo(@Param("prescriptionNo") String prescriptionNo,
|
||||
@Param("encounterId") Long encounterId);
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.openhis.web.doctorstation.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.doctorstation.dto.ReservationRecordDto;
|
||||
|
||||
/**
|
||||
* 医生站-预约记录 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface ReservationRecordAppMapper {
|
||||
|
||||
/**
|
||||
* 查询 预约记录
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param orgId 科室id
|
||||
* @param practitionerId 参与者id
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 预约记录
|
||||
*/
|
||||
IPage<ReservationRecordDto> getReservationInfo(@Param("page") Page<ReservationRecordDto> page,
|
||||
@Param("orgId") Long orgId, @Param("practitionerId") Long practitionerId,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<ReservationRecordDto> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -1,495 +0,0 @@
|
||||
package com.openhis.web.doctorstation.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||
import com.openhis.web.datadictionary.dto.ActivityChildJsonDto;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||
import com.openhis.web.doctorstation.dto.*;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper;
|
||||
import com.openhis.web.personalization.dto.ActivityDeviceDto;
|
||||
import com.openhis.workflow.domain.DeviceRequest;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
|
||||
/**
|
||||
* 医嘱工具类
|
||||
*/
|
||||
@Component
|
||||
public class AdviceUtils {
|
||||
|
||||
@Resource
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
DoctorStationAdviceAppMapper doctorStationAdviceAppMapper;
|
||||
|
||||
@Resource
|
||||
OutpatientRegistrationAppMapper outpatientRegistrationAppMapper;
|
||||
|
||||
@Resource
|
||||
IActivityDefinitionService iActivityDefinitionService;
|
||||
|
||||
@Resource
|
||||
IDeviceRequestService iDeviceRequestService;
|
||||
|
||||
@Resource
|
||||
IServiceRequestService iServiceRequestService;
|
||||
|
||||
@Resource
|
||||
IDeviceDispenseService iDeviceDispenseService;
|
||||
|
||||
@Resource
|
||||
IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
IDoctorStationAdviceAppService iDoctorStationAdviceAppService;
|
||||
|
||||
/**
|
||||
* 校验库存
|
||||
*
|
||||
* @param adviceSaveList 医嘱信息
|
||||
* @return 提示信息
|
||||
*/
|
||||
public String checkInventory(List<AdviceSaveDto> adviceSaveList) {
|
||||
// 医嘱定义ID集合
|
||||
List<Long> adviceDefinitionIdList =
|
||||
adviceSaveList.stream().map(AdviceSaveDto::getAdviceDefinitionId).collect(Collectors.toList());
|
||||
// 医嘱库存集合
|
||||
List<AdviceInventoryDto> adviceInventoryList =
|
||||
doctorStationAdviceAppMapper.getAdviceInventory(null, adviceDefinitionIdList,
|
||||
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
|
||||
// 待发放个数信息
|
||||
List<AdviceInventoryDto> adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
|
||||
// 预减库存
|
||||
List<AdviceInventoryDto> adviceInventory =
|
||||
this.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
|
||||
// 检查库存
|
||||
for (AdviceSaveDto saveDto : adviceSaveList) {
|
||||
boolean matched = false;
|
||||
for (AdviceInventoryDto inventoryDto : adviceInventory) {
|
||||
// 匹配条件:adviceDefinitionId, adviceTableName, locationId, lotNumber 同时相等
|
||||
if (saveDto.getAdviceDefinitionId().equals(inventoryDto.getItemId())
|
||||
&& saveDto.getAdviceTableName().equals(inventoryDto.getItemTable())
|
||||
&& saveDto.getLocationId().equals(inventoryDto.getLocationId())
|
||||
&& saveDto.getLotNumber().equals(inventoryDto.getLotNumber())) {
|
||||
matched = true;
|
||||
// 检查库存是否充足
|
||||
BigDecimal minUnitQuantity = saveDto.getMinUnitQuantity();
|
||||
Integer chineseHerbsDoseQuantity = saveDto.getChineseHerbsDoseQuantity(); // 中药付数
|
||||
// 中草药医嘱的情况
|
||||
if (chineseHerbsDoseQuantity != null && chineseHerbsDoseQuantity > 0) {
|
||||
minUnitQuantity =
|
||||
minUnitQuantity.multiply(BigDecimal.valueOf(chineseHerbsDoseQuantity.longValue()));
|
||||
}
|
||||
if (minUnitQuantity.compareTo(inventoryDto.getQuantity()) > 0) {
|
||||
return saveDto.getAdviceName() + "在" + inventoryDto.getLocationName() + "库存不足";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果没有匹配到库存
|
||||
if (!matched) {
|
||||
return saveDto.getAdviceName() + "未匹配到库存信息";
|
||||
}
|
||||
}
|
||||
return null; // 校验通过
|
||||
}
|
||||
|
||||
/**
|
||||
* 预减库存
|
||||
*
|
||||
* @param adviceInventoryList 库存表数据
|
||||
* @param adviceDraftInventoryList 待发放数据
|
||||
* @return 预减库存
|
||||
*/
|
||||
public List<AdviceInventoryDto> subtractInventory(List<AdviceInventoryDto> adviceInventoryList,
|
||||
List<AdviceInventoryDto> adviceDraftInventoryList) {
|
||||
// 1. 将 draft 列表转换为 Map,合并重复键的 quantity
|
||||
Map<String,
|
||||
AdviceInventoryDto> draftMap = adviceDraftInventoryList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
draft -> String.format(CommonConstants.Common.SS_DD_FORMAT, draft.getItemTable(),
|
||||
draft.getLotNumber(), draft.getItemId(), draft.getLocationId()),
|
||||
draft -> draft, (existing, replacement) -> {
|
||||
// 合并重复键的 quantity
|
||||
BigDecimal existingQty =
|
||||
existing.getQuantity() != null ? existing.getQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal replacementQty =
|
||||
replacement.getQuantity() != null ? replacement.getQuantity() : BigDecimal.ZERO;
|
||||
existing.setQuantity(existingQty.add(replacementQty));
|
||||
return existing;
|
||||
}));
|
||||
// 2. 遍历原始库存列表,匹配并扣减
|
||||
return adviceInventoryList.stream().map(inventory -> {
|
||||
String key = String.format(CommonConstants.Common.SS_DD_FORMAT, inventory.getItemTable(),
|
||||
inventory.getLotNumber(), inventory.getItemId(), inventory.getLocationId());
|
||||
AdviceInventoryDto draft = draftMap.get(key);
|
||||
if (draft != null) {
|
||||
BigDecimal draftQty = draft.getQuantity() != null ? draft.getQuantity() : BigDecimal.ZERO;
|
||||
BigDecimal newQty = inventory.getQuantity().subtract(draftQty);
|
||||
inventory.setQuantity(newQty.compareTo(BigDecimal.ZERO) >= 0 ? newQty : BigDecimal.ZERO);
|
||||
}
|
||||
return inventory;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 药品请求为皮试或输液,开立对应的请求及账单
|
||||
*/
|
||||
public void generateActRequestByMedicationFlag(MedicationRequest medicationRequest, Long organizationId,
|
||||
AdviceSaveDto adviceSaveDto) {
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
// 皮试
|
||||
boolean isSkinTest = Whether.YES.getValue().equals(medicationRequest.getSkinTestFlag());
|
||||
// 输液
|
||||
boolean isInfusion = Whether.YES.getValue().equals(medicationRequest.getInfusionFlag());
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
AdviceBaseDto adviceBaseDto;
|
||||
ServiceRequest serviceRequest;
|
||||
AdviceBaseDto activityAdviceBaseDto;
|
||||
Integer quantity;
|
||||
ChargeItem chargeItem;
|
||||
DeviceRequest deviceRequest;
|
||||
// 生成皮试检查对应的请求和账单;生成皮试检查这个诊疗自身的请求,以及皮试检查诊疗绑定的耗材(包括发放)
|
||||
if (isSkinTest) {
|
||||
quantity = 1; // 请求数量
|
||||
// 皮试检查的诊疗定义id
|
||||
Long skinTestInspectionDefinitionId = iActivityDefinitionService
|
||||
.getAppointActivityDefinitionId(CommonConstants.BusinessName.SKIN_TEST_INSPECTION);
|
||||
if (skinTestInspectionDefinitionId != null) {
|
||||
adviceBaseDto = new AdviceBaseDto();
|
||||
adviceBaseDto.setAdviceDefinitionId(skinTestInspectionDefinitionId); // 医嘱定义id
|
||||
// 对应的诊疗医嘱信息
|
||||
activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null,
|
||||
null, organizationId, 1, 1, Whether.NO.getValue(), List.of(1, 2, 3)).getRecords().get(0);
|
||||
if (activityAdviceBaseDto != null) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
if (advicePriceDto != null) {
|
||||
// 生成诊疗请求,用于收费
|
||||
serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
||||
serviceRequest.setQuantity(quantity); // 请求数量
|
||||
serviceRequest.setUnitCode(activityAdviceBaseDto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setCategoryEnum(Integer.valueOf(activityAdviceBaseDto.getCategoryCode())); // 请求类型
|
||||
serviceRequest.setActivityId(activityAdviceBaseDto.getAdviceDefinitionId());// 诊疗定义id
|
||||
serviceRequest.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
serviceRequest.setRequesterId(SecurityUtils.getLoginUser().getPractitionerId()); // 开方医生
|
||||
serviceRequest.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
||||
serviceRequest.setOrgId(organizationId); // 执行科室
|
||||
serviceRequest.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
serviceRequest.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
iServiceRequestService.save(serviceRequest);
|
||||
// 生成账单
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue()); // 账单生成来源
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
|
||||
chargeItem.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(ChargeItemContext.ACTIVITY.getValue()); // 类型
|
||||
chargeItem.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
chargeItem.setDefinitionId(advicePriceDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());// 开立人ID
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.WOR_SERVICE_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable(activityAdviceBaseDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(activityAdviceBaseDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID
|
||||
chargeItem.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
chargeItem
|
||||
.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
iChargeItemService.save(chargeItem);
|
||||
}
|
||||
}
|
||||
// 查询皮试检查绑定的耗材id及请求数量
|
||||
List<ActivityDeviceDto> tmpActivityList = outpatientRegistrationAppMapper.getTmpActivityList(
|
||||
String.valueOf(skinTestInspectionDefinitionId), CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
for (ActivityDeviceDto activityDeviceDto : tmpActivityList) {
|
||||
quantity = activityDeviceDto.getQuantity(); // 请求数量
|
||||
adviceBaseDto = new AdviceBaseDto();
|
||||
adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId());
|
||||
// 对应的耗材医嘱信息
|
||||
activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null,
|
||||
null, organizationId, 1, 1, Whether.NO.getValue(), List.of(1, 2, 3)).getRecords().get(0);
|
||||
// 库存信息
|
||||
AdviceInventoryDto adviceInventoryDto = activityAdviceBaseDto.getInventoryList().get(0);
|
||||
// 价格信息
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
if (adviceInventoryDto != null && advicePriceDto != null) {
|
||||
// 耗材请求
|
||||
deviceRequest = new DeviceRequest();
|
||||
deviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue()); // 请求状态
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
||||
deviceRequest.setQuantity(quantity); // 请求数量
|
||||
deviceRequest.setUnitCode(activityAdviceBaseDto.getUnitCode()); // 请求单位编码
|
||||
deviceRequest.setLotNumber(adviceInventoryDto.getLotNumber());// 产品批号
|
||||
deviceRequest.setCategoryEnum(Integer.valueOf(activityAdviceBaseDto.getCategoryCode())); // 请求类型
|
||||
deviceRequest.setDeviceDefId(activityAdviceBaseDto.getAdviceDefinitionId());// 耗材定义id
|
||||
deviceRequest.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
deviceRequest.setRequesterId(SecurityUtils.getLoginUser().getPractitionerId()); // 开方医生
|
||||
deviceRequest.setOrgId(organizationId);// 开方人科室
|
||||
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
|
||||
// 发放耗材房
|
||||
deviceRequest.setPerformLocation(activityAdviceBaseDto.getLocationId());
|
||||
deviceRequest.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
deviceRequest.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
deviceRequest.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
iDeviceRequestService.save(deviceRequest);
|
||||
// 耗材发放
|
||||
iDeviceDispenseService.handleDeviceDispense(deviceRequest, DbOpType.INSERT.getCode());
|
||||
// 耗材账单
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue()); // 账单生成来源
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo()));
|
||||
chargeItem.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(ChargeItemContext.DEVICE.getValue()); // 类型
|
||||
chargeItem.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
chargeItem.setDefinitionId(advicePriceDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setDefDetailId(advicePriceDto.getDefinitionDetailId()); // 定价子表主键
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());// 开立人ID
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.WOR_DEVICE_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(deviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable(activityAdviceBaseDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(activityAdviceBaseDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID
|
||||
chargeItem.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
chargeItem
|
||||
.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
iChargeItemService.save(chargeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 生成用法(输液)绑定的诊疗对应的请求和账单
|
||||
if (isInfusion) {
|
||||
// 分组id
|
||||
Long groupId = medicationRequest.getGroupId();
|
||||
// 执行次数
|
||||
Integer executeNum = medicationRequest.getExecuteNum();
|
||||
// 用法
|
||||
String methodCode = medicationRequest.getMethodCode();
|
||||
// 查询用法绑定的诊疗信息
|
||||
List<ActivityDeviceDto> tmpActivityList = outpatientRegistrationAppMapper.getTmpActivityList(methodCode,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION);
|
||||
for (ActivityDeviceDto activityDeviceDto : tmpActivityList) {
|
||||
quantity = activityDeviceDto.getQuantity() * executeNum; // 请求数量
|
||||
adviceBaseDto = new AdviceBaseDto();
|
||||
adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId());
|
||||
// 对应的诊疗医嘱信息
|
||||
activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null,
|
||||
null, organizationId, 1, 1, Whether.NO.getValue(), List.of(1, 2, 3)).getRecords().get(0);
|
||||
if (activityAdviceBaseDto != null) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
if (advicePriceDto != null) {
|
||||
// 本次就诊,绑定的诊疗不重复带
|
||||
ServiceRequest one = iServiceRequestService.getOne(new LambdaQueryWrapper<ServiceRequest>()
|
||||
.eq(ServiceRequest::getEncounterId, medicationRequest.getEncounterId())
|
||||
.eq(ServiceRequest::getActivityId, activityAdviceBaseDto.getAdviceDefinitionId()));
|
||||
if (one == null) {
|
||||
// 生成诊疗请求
|
||||
serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
|
||||
serviceRequest
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
||||
serviceRequest.setQuantity(quantity); // 请求数量
|
||||
serviceRequest.setUnitCode(activityAdviceBaseDto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setCategoryEnum(Integer.valueOf(activityAdviceBaseDto.getCategoryCode())); // 请求类型
|
||||
serviceRequest.setActivityId(activityAdviceBaseDto.getAdviceDefinitionId());// 诊疗定义id
|
||||
serviceRequest.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
serviceRequest.setRequesterId(SecurityUtils.getLoginUser().getPractitionerId()); // 开方医生
|
||||
serviceRequest.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
||||
serviceRequest.setOrgId(organizationId); // 执行科室
|
||||
serviceRequest.setGroupId(groupId); // 分组id
|
||||
serviceRequest.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
serviceRequest.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
iServiceRequestService.save(serviceRequest);
|
||||
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue()); // 账单生成来源
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem
|
||||
.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
|
||||
chargeItem.setPatientId(medicationRequest.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(ChargeItemContext.ACTIVITY.getValue()); // 类型
|
||||
chargeItem.setEncounterId(medicationRequest.getEncounterId()); // 就诊id
|
||||
chargeItem.setDefinitionId(advicePriceDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());// 开立人ID
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.WOR_SERVICE_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable(activityAdviceBaseDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(activityAdviceBaseDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID
|
||||
chargeItem.setConditionId(adviceSaveDto.getConditionId()); // 诊断id
|
||||
chargeItem.setEncounterDiagnosisId(adviceSaveDto.getEncounterDiagnosisId()); // 就诊诊断id
|
||||
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
chargeItem.setTotalPrice(
|
||||
qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
iChargeItemService.saveOrUpdate(chargeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理诊疗子项信息
|
||||
*
|
||||
* @param childrenJson 诊疗子项JSON
|
||||
* @param organizationId 患者挂号/住院入库对应的科室id
|
||||
* @param activityChildrenJsonParams 诊疗子项参数类
|
||||
*/
|
||||
public void handleActivityChild(String childrenJson, Long organizationId,
|
||||
ActivityChildrenJsonParams activityChildrenJsonParams) {
|
||||
// 治疗类型 (长期/临时)
|
||||
Integer therapyEnum = activityChildrenJsonParams.getTherapyEnum();
|
||||
// 当前登录账号的科室id
|
||||
Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
// 将JSON字符串转换为List<ActivityChildJsonDto>
|
||||
List<ActivityChildJsonDto> activityChildJsonDtoList =
|
||||
objectMapper.readValue(childrenJson, new TypeReference<>() {});
|
||||
// 创建子项的诊疗请求
|
||||
Long adviceDefinitionId; // 诊疗医嘱定义ID
|
||||
Integer quantity; // 子项请求数量
|
||||
List<ChargeItem> chargeItemList = new ArrayList<>(); // 子项账单集合
|
||||
ServiceRequest serviceRequest;
|
||||
ChargeItem chargeItem;
|
||||
AdviceBaseDto adviceBaseDto;
|
||||
// 当前时间
|
||||
Date curDate = new Date();
|
||||
for (ActivityChildJsonDto activityChildJsonDto : activityChildJsonDtoList) {
|
||||
adviceDefinitionId = activityChildJsonDto.getAdviceDefinitionId();
|
||||
quantity = activityChildJsonDto.getChildrenRequestNum();
|
||||
adviceBaseDto = new AdviceBaseDto();
|
||||
adviceBaseDto.setAdviceDefinitionId(adviceDefinitionId);
|
||||
// 对应的子项诊疗医嘱信息
|
||||
AdviceBaseDto activityAdviceBaseDto =
|
||||
iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1,
|
||||
1, Whether.NO.getValue(), List.of(1, 2, 3)).getRecords().get(0);
|
||||
if (activityAdviceBaseDto != null) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
if (advicePriceDto != null) {
|
||||
// 生成诊疗请求
|
||||
serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
||||
serviceRequest.setQuantity(quantity); // 请求数量
|
||||
serviceRequest.setUnitCode(activityAdviceBaseDto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setCategoryEnum(Integer.valueOf(activityAdviceBaseDto.getCategoryCode())); // 请求类型
|
||||
serviceRequest.setActivityId(activityAdviceBaseDto.getAdviceDefinitionId());// 诊疗定义id
|
||||
serviceRequest.setPatientId(activityChildrenJsonParams.getPatientId()); // 患者
|
||||
serviceRequest.setRequesterId(SecurityUtils.getLoginUser().getPractitionerId()); // 开方医生
|
||||
serviceRequest.setEncounterId(activityChildrenJsonParams.getEncounterId()); // 就诊id
|
||||
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
||||
serviceRequest.setOrgId(organizationId); // 执行科室
|
||||
|
||||
iServiceRequestService.save(serviceRequest);
|
||||
|
||||
// 临时医嘱
|
||||
if (TherapyTimeType.TEMPORARY.getValue().equals(therapyEnum)) {
|
||||
// 生成账单
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue());
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.DRAFT.getValue()); // 收费状态
|
||||
chargeItem
|
||||
.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
|
||||
chargeItem.setPatientId(activityChildrenJsonParams.getPatientId()); // 患者
|
||||
chargeItem.setContextEnum(ChargeItemContext.ACTIVITY.getValue()); // 类型
|
||||
chargeItem.setEncounterId(activityChildrenJsonParams.getEncounterId()); // 就诊id
|
||||
chargeItem.setDefinitionId(advicePriceDto.getDefinitionId()); // 费用定价ID
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());// 开立人ID
|
||||
chargeItem.setRequestingOrgId(orgId); // 开立科室
|
||||
chargeItem.setEnteredDate(curDate); // 开立时间
|
||||
chargeItem.setServiceTable(CommonConstants.TableName.WOR_SERVICE_REQUEST);// 医疗服务类型
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setProductTable(activityAdviceBaseDto.getAdviceTableName());// 产品所在表
|
||||
chargeItem.setProductId(activityAdviceBaseDto.getAdviceDefinitionId());// 收费项id
|
||||
chargeItem.setAccountId(activityChildrenJsonParams.getAccountId());// 关联账户ID
|
||||
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
chargeItem.setTotalPrice(
|
||||
qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
chargeItemList.add(chargeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新主项账单的 children_json 字段
|
||||
if (chargeItemList.size() > 0) {
|
||||
String chargeItemChildrenJson = objectMapper.writeValueAsString(chargeItemList);
|
||||
ChargeItem mainChargeItem = new ChargeItem();
|
||||
mainChargeItem.setId(activityChildrenJsonParams.getChargeItemId()); // 主键
|
||||
mainChargeItem.setChildrenJson(chargeItemChildrenJson); // 子项json
|
||||
iChargeItemService.updateById(mainChargeItem);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
package com.openhis.web.doctorstation.utils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.enums.ActivityType;
|
||||
import com.openhis.common.enums.ybenums.YbGender;
|
||||
import com.openhis.crosssystem.dto.LisApplyDto;
|
||||
import com.openhis.crosssystem.dto.LisApplyGroupDto;
|
||||
import com.openhis.crosssystem.dto.PacsApplyDto;
|
||||
import com.openhis.crosssystem.enums.*;
|
||||
import com.openhis.crosssystem.utils.CrossSystemSendApplyUtil;
|
||||
import com.openhis.web.doctorstation.dto.AdviceSaveDto;
|
||||
import com.openhis.workflow.domain.ActivityDefinition;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IActivityDefinitionService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 跨系统发送申请工具类
|
||||
*
|
||||
* @author GuoRui
|
||||
* @date 2025-06-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DoctorStationSendApplyUtil {
|
||||
|
||||
@Autowired
|
||||
private CrossSystemSendApplyUtil crossSystemSendApplyUtil;
|
||||
@Autowired
|
||||
private IActivityDefinitionService activityDefinitionService;
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
@Autowired
|
||||
private IServiceRequestService serviceRequestService;
|
||||
@Autowired
|
||||
private IPatientService patientService;
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
/**
|
||||
* 发送跨系统申请
|
||||
*
|
||||
* @param adviceSaveDto 申请参数
|
||||
* @param organizationId 科室ID
|
||||
* @param curDate 当前时间
|
||||
*/
|
||||
public void sendCrossSystemApply(AdviceSaveDto adviceSaveDto, Long organizationId, Date curDate) {
|
||||
// 查询诊疗定义
|
||||
ActivityDefinition activityDefinition =
|
||||
activityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
|
||||
if (activityDefinition == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:诊疗信息不存在");
|
||||
}
|
||||
// 查询挂号科室
|
||||
Organization organization = organizationService.getById(organizationId);
|
||||
if (organization == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:挂号科室信息不存在");
|
||||
}
|
||||
// 查询服务请求
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(adviceSaveDto.getRequestId());
|
||||
if (serviceRequest == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:服务请求信息不存在");
|
||||
}
|
||||
// 查询患者
|
||||
Patient patient = patientService.getById(adviceSaveDto.getPatientId());
|
||||
if (patient == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:患者信息不存在");
|
||||
}
|
||||
// 查询开方医生
|
||||
Practitioner practitioner = practitionerService.getById(adviceSaveDto.getPractitionerId());
|
||||
if (practitioner == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:开方医生信息不存在");
|
||||
}
|
||||
// 查询执行科室
|
||||
Organization organizationExec = organizationService.getById(adviceSaveDto.getPositionId());
|
||||
if (organizationExec == null) {
|
||||
throw new ServiceException("发起LIS或PACS请求失败:执行科室信息不存在");
|
||||
}
|
||||
|
||||
// 检验,发送LIS申请
|
||||
if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())) {
|
||||
// LIS性别转换
|
||||
LisPatientSex lisPatientSex;
|
||||
if (patient.getGenderEnum() == null) {
|
||||
lisPatientSex = LisPatientSex.UNKNOWN;
|
||||
} else {
|
||||
if (YbGender.MALE.getValue().equals(patient.getGenderEnum().toString())) {
|
||||
lisPatientSex = LisPatientSex.MALE;
|
||||
} else if (YbGender.FEMALE.getValue().equals(patient.getGenderEnum().toString())) {
|
||||
lisPatientSex = LisPatientSex.FEMALE;
|
||||
} else {
|
||||
lisPatientSex = LisPatientSex.UNKNOWN;
|
||||
}
|
||||
}
|
||||
// 作成LIS申请参数
|
||||
LisApplyDto lisApplyDto = new LisApplyDto().setApplyNo(serviceRequest.getBusNo())
|
||||
.setPatientNo(patient.getBusNo()).setPatientType(LisPatientType.OUTPATIENT)
|
||||
.setPatientName(patient.getName()).setPatientSex(lisPatientSex).setPatientMobile(patient.getPhone())
|
||||
.setApplyDate(curDate).setApplyDoctor(practitioner.getName()).setApplyDept(organization.getName())
|
||||
.setAge(AgeCalculatorUtil.calculateAge(patient.getBirthDate()))
|
||||
.setExecDeptCode(organizationExec.getBusNo()).setExecDeptName(organizationExec.getName())
|
||||
.setIdCard(patient.getIdCard()).setWardId("").setRoomNo("").setBedNo("").setEmergency("")
|
||||
.setDiagnose("").setOutsideFlg(LisOutsideFlg.NO).setApplyDeptCode(organization.getBusNo())
|
||||
.setApplyDeptName(organization.getName()).setGroupList(List.of(new LisApplyGroupDto()
|
||||
.setGroupCode(activityDefinition.getBusNo()).setGroupName(activityDefinition.getName())));
|
||||
// 发送LIS申请
|
||||
crossSystemSendApplyUtil.sendApplyToLis(lisApplyDto);
|
||||
|
||||
// 检查,发送PACS申请
|
||||
} else if (ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
|
||||
// PACS性别转换
|
||||
PacsPatientSex pacsPatientSex;
|
||||
if (patient.getGenderEnum() == null) {
|
||||
pacsPatientSex = PacsPatientSex.UNKNOWN;
|
||||
} else {
|
||||
if (YbGender.MALE.getValue().equals(patient.getGenderEnum().toString())) {
|
||||
pacsPatientSex = PacsPatientSex.MALE;
|
||||
} else if (YbGender.FEMALE.getValue().equals(patient.getGenderEnum().toString())) {
|
||||
pacsPatientSex = PacsPatientSex.FEMALE;
|
||||
} else {
|
||||
pacsPatientSex = PacsPatientSex.UNKNOWN;
|
||||
}
|
||||
}
|
||||
// 作成PACS申请参数
|
||||
PacsApplyDto pacsApplyDto =
|
||||
new PacsApplyDto().setApplyNo(serviceRequest.getBusNo()).setPatientNo(patient.getBusNo())
|
||||
.setPatientType(PacsPatientType.OUTPATIENT).setPatientName(patient.getName())
|
||||
.setPatientSex(pacsPatientSex).setPatientMobile(patient.getPhone()).setApplyDate(curDate)
|
||||
.setApplyDoctorName(practitioner.getName()).setApplyDoctorCode(practitioner.getBusNo())
|
||||
.setApplyDeptName(organization.getName()).setApplyDeptCode(organization.getBusNo())
|
||||
.setAge(AgeCalculatorUtil.calculateAge(patient.getBirthDate()))
|
||||
.setExecDeptCode(organizationExec.getBusNo()).setExecDeptName(organizationExec.getName())
|
||||
.setExamPart("").setIdCard(patient.getIdCard()).setWardId("").setRoomNo("").setBedNo("")
|
||||
.setEmergency("").setDiagnose("").setGroupCode(activityDefinition.getBusNo())
|
||||
.setGroupName(activityDefinition.getName());
|
||||
// 发送PACS申请
|
||||
crossSystemSendApplyUtil.sendApplyToPacs(pacsApplyDto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocDefinitonParam;
|
||||
|
||||
/**
|
||||
* 文书定义 应用Service
|
||||
*/
|
||||
public interface IDocDefinitionAppService {
|
||||
|
||||
/**
|
||||
* 新增文书定义
|
||||
*
|
||||
* @param definitionDto
|
||||
* @return
|
||||
*/
|
||||
R<?> addDefinition(DocDefinitionDto definitionDto);
|
||||
|
||||
|
||||
/**
|
||||
* 修改文书定义
|
||||
*
|
||||
* @param definitionDto
|
||||
* @return
|
||||
*/
|
||||
R<?> updateDefinition(DocDefinitionDto definitionDto);
|
||||
|
||||
/**
|
||||
* 获取文书定义列表 树形结构
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return
|
||||
*/
|
||||
R<?> getTreeList(DocDefinitonParam param);
|
||||
|
||||
R<?> getDefinitionDetailById(Long id);
|
||||
|
||||
DocDefinitionDto getDefinitionById(Long id);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文书定义 应用Service
|
||||
*/
|
||||
public interface IDocDefinitionOrganizationAppService {
|
||||
|
||||
/**
|
||||
* 新增文书分配科室列表
|
||||
*
|
||||
* @param organizationDto
|
||||
* @return
|
||||
*/
|
||||
R<?> add(DocDefinitionOrganizationDto organizationDto);
|
||||
|
||||
/**
|
||||
* 删除文书分配科室列表
|
||||
*
|
||||
* @param definitionId
|
||||
* @param busNo
|
||||
* @return
|
||||
*/
|
||||
R<?> delete(Long definitionId, String busNo);
|
||||
|
||||
/**
|
||||
* 查询文书定义科室列表
|
||||
*
|
||||
* @param definitionId
|
||||
* @param busNo
|
||||
* @return
|
||||
*/
|
||||
|
||||
R<?> getOrganizationIdlist(Long definitionId, String busNo);
|
||||
|
||||
R<?> updateOrganization(DocDefinitionOrganizationDto organizationDto);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocRecordDto;
|
||||
import com.openhis.web.document.dto.DocRecordPatientQueryParam;
|
||||
import com.openhis.web.document.dto.DocRecordQueryParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文书记录 应用Service
|
||||
*/
|
||||
public interface IDocRecordAppService {
|
||||
|
||||
// /**
|
||||
// * 新增记录
|
||||
// *
|
||||
// * @param docRecordDto 文书记录信息
|
||||
// * @return
|
||||
// */
|
||||
// R<?> createOrEditRecord(DocRecordDto docRecordDto);
|
||||
R<?> addRecord(DocRecordDto docRecordDto);
|
||||
|
||||
R<?> updateRecord(DocRecordDto docRecordDto);
|
||||
|
||||
/**
|
||||
* 根据患者ID或就诊ID获取文书记录列表,只针对不需返回患者具体信息的列表,体温单除外,单独处理
|
||||
*/
|
||||
R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer IsPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam, List<Integer> primaryMenuEnumList, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据文书记录ID获取文书记录信息
|
||||
*
|
||||
* @param recordId 文书记录ID
|
||||
* @return
|
||||
*/
|
||||
|
||||
R<?> getRecordById(Long recordId);
|
||||
|
||||
R<?> setIsEdit(Long recordId);
|
||||
|
||||
/**
|
||||
* 删除文书分配信息
|
||||
*
|
||||
* @param ids 删除文书分配信息ID列表
|
||||
* @return
|
||||
*/
|
||||
R<?> deleteRecord(List<Long> ids);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.document.domain.DocStatistics;
|
||||
import com.openhis.web.document.dto.DocStatisticsDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档模板 业务接口
|
||||
*/
|
||||
public interface IDocStatisticsAppService {
|
||||
|
||||
|
||||
public R<?> createOrUpdte(List<DocStatisticsDto> docStatisticsList);
|
||||
|
||||
public R<?> delete(List<Long> ids);
|
||||
|
||||
public R<?> queryByRecordId(Long recordId);
|
||||
|
||||
public R<?> queryByEncounterId(Long encounterId);
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档模板 业务接口
|
||||
*/
|
||||
public interface IDocStatisticsDefinitionAppService {
|
||||
|
||||
|
||||
/**
|
||||
* 创建或更新文档模板
|
||||
*
|
||||
* @param docStatisticsDefinitionDto
|
||||
*/
|
||||
public R<?> createOrEdit(DocStatisticsDefinitionDto docStatisticsDefinitionDto);
|
||||
|
||||
public R<?> add(DocStatisticsDefinitionDto docStatisticsDefinitionDto);
|
||||
|
||||
public R<?> update(DocStatisticsDefinitionDto docStatisticsDefinitionDto);
|
||||
|
||||
/**
|
||||
* 分页查询列表-不包含options 分页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public R<?> getPageList(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取文档统计定义列表(不分页)
|
||||
*
|
||||
* @param isStatistics 是否统计
|
||||
* @return 文档统计定义列表
|
||||
*/
|
||||
public List<DocStatisticsDefinitionDto> getList(Integer isStatistics);
|
||||
|
||||
/**
|
||||
* 获取文档统计定义选项列表并按指定格式返回
|
||||
*
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
public R<?> getOptionList();
|
||||
|
||||
/**
|
||||
* 删除文档模板
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
|
||||
public R<?> deleteDocStatisticsDefinition(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取文档统计定义
|
||||
*
|
||||
* @param id
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
public R<?> getDocStatisticsDefinitionById(Long id);
|
||||
|
||||
/**
|
||||
* 根据code获取文档统计定义
|
||||
*
|
||||
* @param code
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
public R<?> getDocStatisticsDefinitionByCode(String code);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionOptionDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionOptionList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档模板 业务接口
|
||||
*/
|
||||
public interface IDocStatisticsDefinitionOptionAppService {
|
||||
|
||||
|
||||
/**
|
||||
* 新增、修改文档模板 统计项选项
|
||||
*
|
||||
* @param docStatisticsDefinitionOptionList
|
||||
*/
|
||||
public R<?> add(DocStatisticsDefinitionOptionList docStatisticsDefinitionOptionList);
|
||||
|
||||
public R<?> createOrEdit(DocStatisticsDefinitionOptionList docStatisticsDefinitionOptionList);
|
||||
|
||||
public R<?> deleteDocStatisticsDefinitionOptionById(Long id);
|
||||
|
||||
public DocStatisticsDefinitionOptionList getDocStatisticsDefinitionOptionByDefinitionId(Long docStatisticsDefinitionId);
|
||||
|
||||
/**
|
||||
* 获取文档模板 统计项选项列表
|
||||
*/
|
||||
public AjaxResult getDocStatisticsDefinitionOptionList();
|
||||
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocTemplateDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 文书模板-一 业务接口
|
||||
*/
|
||||
public interface IDocTemplateAppService {
|
||||
|
||||
public R<?> add(DocTemplateDto docTemplateDto);
|
||||
|
||||
public R<?> delete(Long id);
|
||||
|
||||
public R<?> update(DocTemplateDto docTemplateDto);
|
||||
|
||||
public R<?> getById(Long id);
|
||||
|
||||
public R<?> getListByDefinitionId(Long definitionId);
|
||||
|
||||
public R<?> getPageList(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.DocUseRangeEnum;
|
||||
import com.openhis.document.domain.DocDefinition;
|
||||
import com.openhis.document.domain.DocDefinitionOrganization;
|
||||
import com.openhis.document.service.IDocDefinitionOrganizationService;
|
||||
import com.openhis.document.service.IDocDefinitionService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionOrganizationAppService;
|
||||
import com.openhis.web.document.dto.DirectoryNode;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import com.openhis.web.document.dto.DocDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocDefinitonParam;
|
||||
import com.openhis.web.document.mapper.DocDefinitionAppMapper;
|
||||
import com.openhis.web.document.util.DocumentDirectoryProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
@Resource
|
||||
private IDocDefinitionService docDefinitionService;
|
||||
@Resource
|
||||
private IDocDefinitionOrganizationAppService docDefinitionOrganizationAppService;
|
||||
@Resource
|
||||
private IDocDefinitionOrganizationService docDefinitionOrganizationService;
|
||||
@Resource
|
||||
private DocDefinitionAppMapper docDefinitionAppMapper;
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
/**
|
||||
* 新增文书定义(含科室分配逻辑)
|
||||
*/
|
||||
@Override
|
||||
public R<?> addDefinition(DocDefinitionDto definitionDto) {
|
||||
// 1. 基础参数校验(按必填优先级排序)
|
||||
if (definitionDto.getName() == null || definitionDto.getName().trim().isEmpty()) {
|
||||
return R.fail("新增文书定义失败:文书名称不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getVersion() == null || definitionDto.getVersion().trim().isEmpty()) {
|
||||
return R.fail("新增文书定义失败:文书版本号不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getVueRouter() == null || definitionDto.getVueRouter().trim().isEmpty()) {
|
||||
return R.fail("新增文书定义失败:文书路由不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. 校验"名称+版本号"唯一性(避免重复创建)
|
||||
long duplicateCount = docDefinitionService.lambdaQuery()
|
||||
.eq(DocDefinition::getName, definitionDto.getName().trim())
|
||||
.eq(DocDefinition::getVersion, definitionDto.getVersion().trim())
|
||||
.count();
|
||||
if (duplicateCount > 0) {
|
||||
log.warn("新增文书定义失败:名称={}、版本号={}的文书已存在",
|
||||
definitionDto.getName(), definitionDto.getVersion());
|
||||
return R.fail("新增文书定义失败:相同名称和版本号的文书已存在,请修改后重试");
|
||||
}
|
||||
|
||||
// 3. 补充默认值(避免null字段插入数据库)
|
||||
if (definitionDto.getDisplayOrder() == null) {
|
||||
definitionDto.setDisplayOrder(0);
|
||||
}
|
||||
if (definitionDto.getIsValid() == null) {
|
||||
definitionDto.setIsValid(0); // 0-默认无效,需根据业务确认是否改为1
|
||||
}
|
||||
|
||||
// 4. 封装文书定义实体(生成业务编号)
|
||||
DocDefinition docDefinition = new DocDefinition();
|
||||
// 校验AssignSeqUtil是否注入(避免空指针)
|
||||
if (assignSeqUtil == null) {
|
||||
log.error("新增文书定义失败:AssignSeqUtil工具类未注入,无法生成业务编号");
|
||||
return R.fail("新增文书定义失败:系统工具类异常,无法生成业务编号");
|
||||
}
|
||||
String busNo = assignSeqUtil.getSeq(AssignSeqEnum.PURCHASE_DOCUMENT.getPrefix(), 10);
|
||||
docDefinition.setBusNo(busNo);
|
||||
docDefinition.setName(definitionDto.getName().trim());
|
||||
docDefinition.setVersion(definitionDto.getVersion().trim());
|
||||
docDefinition.setDisplayOrder(definitionDto.getDisplayOrder());
|
||||
docDefinition.setHospitalId(SecurityUtils.getLoginUser().getHospitalId());
|
||||
docDefinition.setIsValid(definitionDto.getIsValid());
|
||||
docDefinition.setVueRouter(definitionDto.getVueRouter().trim());
|
||||
docDefinition.setPrimaryMenuEnum(definitionDto.getPrimaryMenuEnum());
|
||||
docDefinition.setSubMenu(definitionDto.getSubMenu());
|
||||
docDefinition.setUseRangeEnum(definitionDto.getUseRangeEnum());
|
||||
docDefinition.setDoctorPermissionEnum(definitionDto.getDoctorPermissionEnum());
|
||||
docDefinition.setNursingPermissionEnum(definitionDto.getNursingPermissionEnum());
|
||||
docDefinition.setMedicalPermissionEnum(definitionDto.getMedicalPermissionEnum());
|
||||
docDefinition.setPharmacistPermissionEnum(definitionDto.getPharmacistPermissionEnum());
|
||||
|
||||
// 5. 保存文书定义
|
||||
boolean saveSuccess = docDefinitionService.save(docDefinition);
|
||||
if (!saveSuccess) {
|
||||
log.error("新增文书定义失败:数据库保存异常(名称={}, 版本号={}, 业务编号={}",
|
||||
definitionDto.getName(), definitionDto.getVersion(), busNo);
|
||||
return R.fail("新增文书定义失败:数据库保存操作异常");
|
||||
}
|
||||
|
||||
// 6. 科室分配(仅当使用范围为"科室级"时执行)
|
||||
if (DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum())
|
||||
&& definitionDto.getOrganizationIds() != null
|
||||
&& !definitionDto.getOrganizationIds().isEmpty()) {
|
||||
DocDefinitionOrganizationDto orgDto = new DocDefinitionOrganizationDto();
|
||||
orgDto.setBusNo(busNo);
|
||||
orgDto.setDefinitionId(docDefinition.getId());
|
||||
orgDto.setOrganizationIds(definitionDto.getOrganizationIds());
|
||||
// 复用科室分配服务的新增逻辑,直接返回结果
|
||||
return docDefinitionOrganizationAppService.add(orgDto);
|
||||
}
|
||||
|
||||
return R.ok("新增文书定义成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改文书定义(版本号冲突时自动新增,含科室分配更新)
|
||||
*/
|
||||
@Override
|
||||
public R<?> updateDefinition(DocDefinitionDto definitionDto) {
|
||||
// 1. 基础参数校验(修改必传字段)
|
||||
if (definitionDto.getId() == null) {
|
||||
return R.fail("修改文书定义失败:文书ID不能为空");
|
||||
}
|
||||
if (definitionDto.getName() == null || definitionDto.getName().trim().isEmpty()) {
|
||||
return R.fail("修改文书定义失败:文书名称不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getVersion() == null || definitionDto.getVersion().trim().isEmpty()) {
|
||||
return R.fail("修改文书定义失败:文书版本号不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getVueRouter() == null || definitionDto.getVueRouter().trim().isEmpty()) {
|
||||
return R.fail("修改文书定义失败:文书路由不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getBusNo() == null || definitionDto.getBusNo().trim().isEmpty()) {
|
||||
return R.fail("修改文书定义失败:文书业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. 校验文书是否存在
|
||||
DocDefinition existingDoc = docDefinitionService.getById(definitionDto.getId());
|
||||
if (existingDoc == null) {
|
||||
log.warn("修改文书定义失败:未找到ID={}的文书记录", definitionDto.getId());
|
||||
return R.fail("修改文书定义失败:待修改的文书记录不存在");
|
||||
}
|
||||
|
||||
// 3. 版本号冲突处理(版本号不一致时,转为新增逻辑)
|
||||
if (!existingDoc.getVersion().trim().equals(definitionDto.getVersion().trim())) {
|
||||
log.info("修改文书定义:版本号冲突(原版本={}, 新版本={}),自动执行新增逻辑",
|
||||
existingDoc.getVersion(), definitionDto.getVersion());
|
||||
// 新增前清空ID,避免覆盖原有记录
|
||||
definitionDto.setId(null);
|
||||
return addDefinition(definitionDto);
|
||||
}
|
||||
|
||||
// 4. 补充默认值
|
||||
if (definitionDto.getDisplayOrder() == null) {
|
||||
definitionDto.setDisplayOrder(0);
|
||||
}
|
||||
if (definitionDto.getIsValid() == null) {
|
||||
definitionDto.setIsValid(0);
|
||||
}
|
||||
|
||||
// 5. 封装修改后的数据
|
||||
existingDoc.setBusNo(definitionDto.getBusNo().trim());
|
||||
existingDoc.setName(definitionDto.getName().trim());
|
||||
existingDoc.setVersion(definitionDto.getVersion().trim());
|
||||
existingDoc.setDisplayOrder(definitionDto.getDisplayOrder());
|
||||
existingDoc.setHospitalId(SecurityUtils.getLoginUser().getHospitalId());
|
||||
existingDoc.setIsValid(definitionDto.getIsValid());
|
||||
existingDoc.setVueRouter(definitionDto.getVueRouter().trim());
|
||||
existingDoc.setPrimaryMenuEnum(definitionDto.getPrimaryMenuEnum());
|
||||
existingDoc.setSubMenu(definitionDto.getSubMenu());
|
||||
existingDoc.setUseRangeEnum(definitionDto.getUseRangeEnum());
|
||||
existingDoc.setDoctorPermissionEnum(definitionDto.getDoctorPermissionEnum());
|
||||
existingDoc.setNursingPermissionEnum(definitionDto.getNursingPermissionEnum());
|
||||
existingDoc.setMedicalPermissionEnum(definitionDto.getMedicalPermissionEnum());
|
||||
existingDoc.setPharmacistPermissionEnum(definitionDto.getPharmacistPermissionEnum());
|
||||
|
||||
// 6. 执行修改
|
||||
boolean updateSuccess = docDefinitionService.updateById(existingDoc);
|
||||
if (!updateSuccess) {
|
||||
log.error("修改文书定义失败:数据库更新异常(ID={}, 业务编号={}",
|
||||
definitionDto.getId(), definitionDto.getBusNo());
|
||||
return R.fail("修改文书定义失败:数据库更新操作异常");
|
||||
}
|
||||
|
||||
// 7. 更新科室分配(仅当使用范围为"科室级"时执行)
|
||||
DocDefinitionOrganizationDto orgDto = new DocDefinitionOrganizationDto();
|
||||
orgDto.setBusNo(existingDoc.getBusNo());
|
||||
orgDto.setDefinitionId(existingDoc.getId());
|
||||
orgDto.setOrganizationIds(definitionDto.getOrganizationIds());
|
||||
// 复用科室分配服务的更新逻辑(先删后加,全量覆盖)
|
||||
return docDefinitionOrganizationAppService.updateOrganization(orgDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文书定义树形列表(按目录结构组织)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getTreeList(DocDefinitonParam param) {
|
||||
// 1. 获取当前登录用户的医院ID(避免跨医院查询)
|
||||
Long hospitalId = SecurityUtils.getLoginUser().getHospitalId();
|
||||
if (hospitalId == null) {
|
||||
log.warn("获取文书定义树形列表失败:当前登录用户未关联医院ID");
|
||||
return R.fail("获取文书定义树形列表失败:当前用户未关联医院,请重新登录");
|
||||
}
|
||||
|
||||
// 2. 数据库查询文书定义列表
|
||||
List<DocDefinitionDto> docList = docDefinitionAppMapper.getDefinationList(
|
||||
param.getUseRanges(),
|
||||
param.getOrganizationId(),
|
||||
hospitalId,
|
||||
param.getName(),
|
||||
param.getPrimaryMenuEnum()
|
||||
);
|
||||
|
||||
// 3. 构建树形结构(空列表时返回空树,避免空指针)
|
||||
List<DirectoryNode> treeNodes = new ArrayList<>();
|
||||
if (docList != null && !docList.isEmpty()) {
|
||||
treeNodes = DocumentDirectoryProcessor.buildDocumentDirectory(docList);
|
||||
log.info("获取文书定义树形列表成功:医院ID={}, 文书数量={}, 树形节点数量={}",
|
||||
hospitalId, docList.size(), treeNodes.size());
|
||||
} else {
|
||||
log.info("获取文书定义树形列表成功:医院ID={}, 暂无匹配的文书定义", hospitalId);
|
||||
}
|
||||
|
||||
return R.ok(treeNodes, "获取文书定义树形列表成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取文书定义详情(含已分配科室ID列表)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDefinitionDetailById(Long id) {
|
||||
// 1. 参数校验
|
||||
if (id == null) {
|
||||
return R.fail("获取文书定义详情失败:文书ID不能为空");
|
||||
}
|
||||
|
||||
// 2. 调用私有方法获取详情(含科室ID)
|
||||
DocDefinitionDto docDto = getDefinitionById(id);
|
||||
if (docDto == null) {
|
||||
log.warn("获取文书定义详情失败:未找到ID={}的文书记录", id);
|
||||
return R.fail("获取文书定义详情失败:未查询到对应的文书定义信息");
|
||||
}
|
||||
|
||||
log.info("获取文书定义详情成功:ID={}, 名称={}, 业务编号={}",
|
||||
id, docDto.getName(), docDto.getBusNo());
|
||||
return R.ok(docDto, "获取文书定义详情成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有方法:根据ID查询文书定义(含已分配科室ID列表)
|
||||
*/
|
||||
public DocDefinitionDto getDefinitionById(Long id) {
|
||||
// 1. 查询文书定义主信息
|
||||
DocDefinition doc = docDefinitionService.getById(id);
|
||||
if (doc == null) {
|
||||
log.debug("根据ID查询文书定义失败:ID={}的文书不存在", id);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 2. 查询该文书已分配的科室ID列表
|
||||
LambdaQueryWrapper<DocDefinitionOrganization> orgWrapper = new LambdaQueryWrapper<>();
|
||||
orgWrapper.eq(DocDefinitionOrganization::getDefinitionId, id)
|
||||
.eq(DocDefinitionOrganization::getBusNo, doc.getBusNo());
|
||||
List<DocDefinitionOrganization> orgList = docDefinitionOrganizationService.list(orgWrapper);
|
||||
|
||||
// 3. 提取科室ID并封装DTO
|
||||
List<Long> orgIdList = new ArrayList<>();
|
||||
for (DocDefinitionOrganization org : orgList) {
|
||||
orgIdList.add(org.getOrganizationId());
|
||||
}
|
||||
|
||||
DocDefinitionDto docDto = new DocDefinitionDto();
|
||||
BeanUtils.copyProperties(doc, docDto);
|
||||
docDto.setOrganizationIds(orgIdList);
|
||||
|
||||
return docDto;
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.document.domain.DocDefinitionOrganization;
|
||||
import com.openhis.document.service.IDocDefinitionOrganizationService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionOrganizationAppService;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocDefinitionOrganizationAppServiceImpl implements IDocDefinitionOrganizationAppService {
|
||||
|
||||
@Resource
|
||||
private IDocDefinitionOrganizationService docDefinitionOrganizationService;
|
||||
|
||||
/**
|
||||
* 新增文书分配科室列表
|
||||
* 注:新增前未删除原有分配,若需"覆盖新增"请使用updateOrganization方法
|
||||
*/
|
||||
@Override
|
||||
public R<?> add(DocDefinitionOrganizationDto definitionOrganizationDto) {
|
||||
// 1. 参数校验(明确错误原因,避免模糊提示)
|
||||
if (definitionOrganizationDto == null) {
|
||||
return R.fail("文书科室分配失败:请求参数不能为空");
|
||||
}
|
||||
if (definitionOrganizationDto.getOrganizationIds() == null || definitionOrganizationDto.getOrganizationIds().isEmpty()) {
|
||||
return R.fail("文书科室分配失败:科室ID列表不能为空");
|
||||
}
|
||||
if (definitionOrganizationDto.getDefinitionId() == null || definitionOrganizationDto.getDefinitionId() == 0) {
|
||||
return R.fail("文书科室分配失败:文书定义ID不能为空(或不能为0)");
|
||||
}
|
||||
if (definitionOrganizationDto.getBusNo() == null || definitionOrganizationDto.getBusNo().trim().isEmpty()) {
|
||||
return R.fail("文书科室分配失败:业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. DTO转实体(批量封装科室分配关系)
|
||||
List<DocDefinitionOrganization> organizationList = new ArrayList<>();
|
||||
for (Long orgId : definitionOrganizationDto.getOrganizationIds()) {
|
||||
DocDefinitionOrganization docOrg = new DocDefinitionOrganization();
|
||||
docOrg.setDefinitionId(definitionOrganizationDto.getDefinitionId());
|
||||
docOrg.setBusNo(definitionOrganizationDto.getBusNo().trim()); // 去除业务编号前后空白
|
||||
docOrg.setOrganizationId(orgId);
|
||||
organizationList.add(docOrg);
|
||||
}
|
||||
|
||||
// 3. 批量新增
|
||||
boolean saveSuccess = docDefinitionOrganizationService.saveBatch(organizationList);
|
||||
if (saveSuccess) {
|
||||
return R.ok("文书科室分配成功");
|
||||
} else {
|
||||
log.error("文书科室分配新增失败:文书定义ID={}, 业务编号={}",
|
||||
definitionOrganizationDto.getDefinitionId(), definitionOrganizationDto.getBusNo());
|
||||
return R.fail("文书科室分配失败:数据库新增操作异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文书定义ID和业务编号,删除对应的科室分配关系
|
||||
*/
|
||||
@Override
|
||||
public R<?> delete(Long definitionId, String busNo) {
|
||||
// 1. 参数校验
|
||||
if (definitionId == null || definitionId == 0) {
|
||||
return R.fail("文书科室分配删除失败:文书定义ID不能为空(或不能为0)");
|
||||
}
|
||||
if (busNo == null || busNo.trim().isEmpty()) {
|
||||
return R.fail("文书科室分配删除失败:业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. 构建查询条件(精准匹配文书+业务编号)
|
||||
LambdaQueryWrapper<DocDefinitionOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocDefinitionOrganization::getDefinitionId, definitionId)
|
||||
.eq(DocDefinitionOrganization::getBusNo, busNo.trim()); // 去除业务编号前后空白
|
||||
|
||||
// 3. 执行删除
|
||||
boolean deleteSuccess = docDefinitionOrganizationService.remove(queryWrapper);
|
||||
if (deleteSuccess) {
|
||||
return R.ok("文书科室分配删除成功");
|
||||
} else {
|
||||
log.warn("文书科室分配删除失败:未找到匹配的分配关系(文书定义ID={}, 业务编号={})",
|
||||
definitionId, busNo);
|
||||
return R.fail("文书科室分配删除失败:未找到对应的科室分配记录");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文书定义ID和业务编号,查询已分配的科室ID列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrganizationIdlist(Long definitionId, String busNo) {
|
||||
// 1. 参数校验
|
||||
if (definitionId == null || definitionId == 0) {
|
||||
return R.fail("文书科室分配查询失败:文书定义ID不能为空(或不能为0)");
|
||||
}
|
||||
if (busNo == null || busNo.trim().isEmpty()) {
|
||||
return R.fail("文书科室分配查询失败:业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. 构建查询条件
|
||||
LambdaQueryWrapper<DocDefinitionOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocDefinitionOrganization::getDefinitionId, definitionId)
|
||||
.eq(DocDefinitionOrganization::getBusNo, busNo.trim());
|
||||
|
||||
// 3. 查询并提取科室ID(避免返回冗余字段)
|
||||
List<DocDefinitionOrganization> orgList = docDefinitionOrganizationService.list(queryWrapper);
|
||||
List<Long> orgIdList = new ArrayList<>();
|
||||
for (DocDefinitionOrganization docOrg : orgList) {
|
||||
orgIdList.add(docOrg.getOrganizationId());
|
||||
}
|
||||
|
||||
log.info("文书科室分配查询成功:文书定义ID={}, 业务编号={}, 分配科室数量={}",
|
||||
definitionId, busNo, orgIdList.size());
|
||||
return R.ok(orgIdList, "文书科室分配查询成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文书科室分配(先删除原有分配,再新增新分配,实现"全量覆盖")
|
||||
*/
|
||||
@Override
|
||||
public R<?> updateOrganization(DocDefinitionOrganizationDto definitionOrganizationDto) {
|
||||
// 1. 参数校验(与add方法保持一致的校验逻辑)
|
||||
if (definitionOrganizationDto == null) {
|
||||
return R.fail("文书科室分配更新失败:请求参数不能为空");
|
||||
}
|
||||
if (definitionOrganizationDto.getOrganizationIds() == null || definitionOrganizationDto.getOrganizationIds().isEmpty()) {
|
||||
return R.fail("文书科室分配更新失败:科室ID列表不能为空");
|
||||
}
|
||||
if (definitionOrganizationDto.getDefinitionId() == null || definitionOrganizationDto.getDefinitionId() == 0) {
|
||||
return R.fail("文书科室分配更新失败:文书定义ID不能为空(或不能为0)");
|
||||
}
|
||||
if (definitionOrganizationDto.getBusNo() == null || definitionOrganizationDto.getBusNo().trim().isEmpty()) {
|
||||
return R.fail("文书科室分配更新失败:业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
|
||||
// 2. 先删除原有分配关系
|
||||
LambdaQueryWrapper<DocDefinitionOrganization> deleteWrapper = new LambdaQueryWrapper<>();
|
||||
deleteWrapper.eq(DocDefinitionOrganization::getDefinitionId, definitionOrganizationDto.getDefinitionId())
|
||||
.eq(DocDefinitionOrganization::getBusNo, definitionOrganizationDto.getBusNo().trim());
|
||||
|
||||
boolean deleteSuccess = docDefinitionOrganizationService.remove(deleteWrapper);
|
||||
if (!deleteSuccess) {
|
||||
log.error("文书科室分配更新失败:删除原有分配记录异常(文书定义ID={}, 业务编号={}",
|
||||
definitionOrganizationDto.getDefinitionId(), definitionOrganizationDto.getBusNo());
|
||||
return R.fail("文书科室分配更新失败:删除原有分配记录异常");
|
||||
}
|
||||
|
||||
// 3. 再新增新的分配关系
|
||||
List<DocDefinitionOrganization> newOrgList = new ArrayList<>();
|
||||
for (Long orgId : definitionOrganizationDto.getOrganizationIds()) {
|
||||
DocDefinitionOrganization docOrg = new DocDefinitionOrganization();
|
||||
docOrg.setDefinitionId(definitionOrganizationDto.getDefinitionId());
|
||||
docOrg.setBusNo(definitionOrganizationDto.getBusNo().trim());
|
||||
docOrg.setOrganizationId(orgId);
|
||||
newOrgList.add(docOrg);
|
||||
}
|
||||
|
||||
boolean saveSuccess = docDefinitionOrganizationService.saveBatch(newOrgList);
|
||||
if (saveSuccess) {
|
||||
return R.ok("文书科室分配更新成功");
|
||||
} else {
|
||||
log.error("文书科室分配更新失败:新增新分配记录异常(文书定义ID={}, 业务编号={}",
|
||||
definitionOrganizationDto.getDefinitionId(), definitionOrganizationDto.getBusNo());
|
||||
return R.fail("文书科室分配更新失败:新增新分配记录异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,456 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
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.SecurityUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.DocStatusEnum;
|
||||
import com.openhis.common.enums.DocTypeEnum;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocRecord;
|
||||
import com.openhis.document.mapper.DocRecordMapper;
|
||||
import com.openhis.document.service.IDocRecordService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocRecordAppService;
|
||||
import com.openhis.web.document.dto.DocDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocRecordDto;
|
||||
import com.openhis.web.document.dto.DocRecordPatientDto;
|
||||
import com.openhis.web.document.dto.DocRecordPatientQueryParam;
|
||||
import com.openhis.web.document.dto.DocRecordQueryParam;
|
||||
import com.openhis.web.document.mapper.DocRecordAppMapper;
|
||||
import com.openhis.web.document.util.PermissionProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
|
||||
@Resource
|
||||
private IDocRecordService docRecordService;
|
||||
@Resource
|
||||
private DocRecordMapper docRecordMapper;
|
||||
@Resource
|
||||
private IDocDefinitionAppService docDefinitionAppService;
|
||||
@Resource
|
||||
private DocRecordAppMapper docRecordAppMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate; // 使用 JdbcTemplate 执行 SQL
|
||||
|
||||
|
||||
/**
|
||||
* 插入单条文档操作日志
|
||||
*
|
||||
* @param docRecord 原始文书记录
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
private Boolean insertLog(DocRecord docRecord) {
|
||||
if (docRecord == null) {
|
||||
log.error("插入文档日志失败:原始文书记录不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
String sql = "INSERT INTO doc_record_log(" +
|
||||
"record_id, definition_id, definition_bus_no, content_json, " +
|
||||
"status_enum, organization_id, encounter_id, patient_id, record_time, " +
|
||||
"create_by, create_time, update_by, update_time, delete_flag, tenant_id" +
|
||||
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
Object[] params = {
|
||||
docRecord.getId(),
|
||||
docRecord.getDefinitionId(),
|
||||
docRecord.getDefinitionBusNo(),
|
||||
docRecord.getContentJson(),
|
||||
docRecord.getStatusEnum(),
|
||||
docRecord.getOrganizationId(),
|
||||
docRecord.getEncounterId(),
|
||||
docRecord.getPatientId(),
|
||||
new Timestamp(docRecord.getRecordTime().getTime()),
|
||||
SecurityUtils.getUsername(),
|
||||
new Timestamp(new Date().getTime()),
|
||||
null, // update_by
|
||||
null, // update_time
|
||||
0, // delete_flag(未删除)
|
||||
docRecord.getTenantId()
|
||||
};
|
||||
|
||||
int rowsAffected = jdbcTemplate.update(sql, params);
|
||||
return rowsAffected > 0;
|
||||
} catch (Exception e) {
|
||||
log.error("插入文档操作日志失败: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入文档操作日志
|
||||
*
|
||||
* @param docRecords 原始文书记录列表
|
||||
* @return 是否插入成功
|
||||
*/
|
||||
private Boolean insertBatchLog(List<DocRecord> docRecords) {
|
||||
if (docRecords == null || docRecords.isEmpty()) {
|
||||
log.error("批量插入文档日志失败:文书记录列表不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
String sql = "INSERT INTO doc_record_log(" +
|
||||
"record_id, definition_id, definition_bus_no, content_json, " +
|
||||
"status_enum, organization_id, encounter_id, patient_id, record_time, " +
|
||||
"create_by, create_time, update_by, update_time, delete_flag, tenant_id" +
|
||||
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
int[] results = jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||
DocRecord docRecord = docRecords.get(i);
|
||||
ps.setLong(1, docRecord.getId());
|
||||
ps.setLong(2, docRecord.getDefinitionId());
|
||||
ps.setString(3, docRecord.getDefinitionBusNo());
|
||||
ps.setString(4, docRecord.getContentJson());
|
||||
ps.setInt(5, docRecord.getStatusEnum());
|
||||
ps.setLong(6, docRecord.getOrganizationId());
|
||||
ps.setLong(7, docRecord.getEncounterId());
|
||||
ps.setLong(8, docRecord.getPatientId());
|
||||
ps.setTimestamp(9, new Timestamp(docRecord.getRecordTime().getTime()));
|
||||
ps.setString(10, SecurityUtils.getUsername());
|
||||
ps.setTimestamp(11, new Timestamp(new Date().getTime()));
|
||||
ps.setObject(12, null); // update_by
|
||||
ps.setObject(13, null); // update_time
|
||||
ps.setInt(14, 0); // delete_flag
|
||||
ps.setLong(15, docRecord.getTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBatchSize() {
|
||||
return docRecords.size();
|
||||
}
|
||||
});
|
||||
|
||||
// 校验所有日志是否插入成功
|
||||
for (int result : results) {
|
||||
if (result <= 0) {
|
||||
log.error("批量插入文档日志失败:部分记录插入无效");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("批量插入文档操作日志失败: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化文书记录参数校验
|
||||
*
|
||||
* @param docRecordDto 文书记录DTO
|
||||
* @return 校验失败信息(空字符串表示校验通过)
|
||||
*/
|
||||
private String initRecordCheck(DocRecordDto docRecordDto) {
|
||||
if (docRecordDto == null) {
|
||||
return "文书记录不能为空";
|
||||
}
|
||||
if (docRecordDto.getDefinitionId() == null) {
|
||||
return "文书记录:文书类型ID不能为空";
|
||||
}
|
||||
if (docRecordDto.getDefinitionBusNo() == null) {
|
||||
return "文书记录:文书编号不能为空";
|
||||
}
|
||||
if (docRecordDto.getContentJson() == null) {
|
||||
return "文书记录:记录内容不能为空";
|
||||
}
|
||||
if (docRecordDto.getEncounterId() == null) {
|
||||
return "文书记录:就诊ID不能为空";
|
||||
}
|
||||
if (docRecordDto.getPatientId() == null) {
|
||||
return "文书记录:患者ID不能为空";
|
||||
}
|
||||
// 2. 校验文书定义是否存在
|
||||
DocDefinitionDto docDefinitionDto = docDefinitionAppService.getDefinitionById(docRecordDto.getDefinitionId());
|
||||
if (docDefinitionDto == null) {
|
||||
return "患者文书记录:对应文书不存在";
|
||||
}
|
||||
// 3. 权限校验
|
||||
boolean hasPermission = PermissionProcessor.hasPermission(docDefinitionDto);
|
||||
if (!hasPermission) {
|
||||
return "患者文书记录:当前登录用户无权限新增/编辑该文书";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增记录
|
||||
*
|
||||
* @param docRecordDto 文书记录信息
|
||||
* @return 返回结果 R对象
|
||||
*/
|
||||
public R<?> addRecord(DocRecordDto docRecordDto) {
|
||||
String checkMsg = initRecordCheck(docRecordDto);
|
||||
if (!checkMsg.isEmpty()) {
|
||||
return R.fail(checkMsg);
|
||||
}
|
||||
DocRecord docRecord = new DocRecord();
|
||||
docRecord.setDefinitionId(docRecordDto.getDefinitionId());
|
||||
docRecord.setDefinitionBusNo(docRecordDto.getDefinitionBusNo());
|
||||
docRecord.setContentJson(docRecordDto.getContentJson());
|
||||
// 状态默认设为草稿(修复原逻辑:原代码先判断再覆盖,导致默认值无效)
|
||||
docRecord.setStatusEnum(docRecordDto.getStatusEnum() == null ? DocStatusEnum.DRAFT.getValue() : docRecordDto.getStatusEnum());
|
||||
docRecord.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
|
||||
docRecord.setEncounterId(docRecordDto.getEncounterId());
|
||||
docRecord.setPatientId(docRecordDto.getPatientId());
|
||||
docRecord.setRecordTime(docRecordDto.getRecordTime());
|
||||
docRecord.setIsEdit(0);
|
||||
boolean saveSuccess = docRecordService.save(docRecord);
|
||||
if (saveSuccess) {
|
||||
return R.ok("新增患者文书记录成功");
|
||||
} else {
|
||||
return R.fail("新增患者文书记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改记录(含日志留痕)
|
||||
*
|
||||
* @param docRecordDto 新文书记录DTO
|
||||
* @return 返回结果 R对象
|
||||
*/
|
||||
public R<?> updateRecord(DocRecordDto docRecordDto) {
|
||||
String checkMsg = initRecordCheck(docRecordDto);
|
||||
if (!checkMsg.isEmpty()) {
|
||||
return R.fail(checkMsg);
|
||||
}
|
||||
// 1. 查询原文书记录
|
||||
DocRecord docRecord = docRecordService.getById(docRecordDto.getId());
|
||||
if (docRecord == null) {
|
||||
return R.fail("修改患者文书记录失败:记录不存在");
|
||||
}
|
||||
// 2. 记录日志
|
||||
// 深拷贝原数据用于日志
|
||||
DocRecord logDocRecord = new DocRecord();
|
||||
BeanUtils.copyProperties(docRecord, logDocRecord);
|
||||
|
||||
// 赋值新数据
|
||||
docRecord.setDefinitionId(docRecordDto.getDefinitionId());
|
||||
docRecord.setDefinitionBusNo(docRecordDto.getDefinitionBusNo());
|
||||
docRecord.setContentJson(docRecordDto.getContentJson());
|
||||
docRecord.setStatusEnum(docRecordDto.getStatusEnum());
|
||||
docRecord.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
|
||||
docRecord.setEncounterId(docRecordDto.getEncounterId());
|
||||
docRecord.setPatientId(docRecordDto.getPatientId());
|
||||
docRecord.setRecordTime(docRecordDto.getRecordTime());
|
||||
docRecord.setIsEdit(0);
|
||||
|
||||
// 执行修改
|
||||
boolean updateSuccess = docRecordService.updateById(docRecord);
|
||||
if (updateSuccess) {
|
||||
// 插入操作日志
|
||||
boolean logSuccess = insertLog(logDocRecord);
|
||||
if (!logSuccess) {
|
||||
return R.fail("修改患者文书记录成功,但插入文档操作日志失败");
|
||||
}
|
||||
return R.ok("修改患者文书记录成功");
|
||||
} else {
|
||||
return R.fail("修改患者文书记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID/就诊ID获取文书记录列表(支持分页)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer isPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 1. 参数校验
|
||||
if (docRecordQueryParam == null) {
|
||||
return R.fail("患者文书记录:查询参数不能为空");
|
||||
}
|
||||
if (docRecordQueryParam.getPatientId() == null && docRecordQueryParam.getEncounterId() == null) {
|
||||
return R.fail("患者文书记录:患者ID和就诊ID不能同时为空");
|
||||
}
|
||||
if (docRecordQueryParam.getDefinitionId() == null) {
|
||||
return R.fail("患者文书记录:文书类型ID不能为空");
|
||||
}
|
||||
|
||||
// 2. 分页查询逻辑
|
||||
if (isPage != null && isPage == 1) {
|
||||
QueryWrapper<DocRecord> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
docRecordQueryParam, null, null, request);
|
||||
// 按记录时间倒序(最新记录在前)
|
||||
queryWrapper.lambda().orderByDesc(DocRecord::getRecordTime);
|
||||
|
||||
Page<DocRecordDto> recordPage = HisPageUtils.selectPage(
|
||||
docRecordMapper, queryWrapper, pageNo, pageSize, DocRecordDto.class);
|
||||
return R.ok(recordPage, "获取患者文书记录列表成功");
|
||||
}
|
||||
// 3. 不分页查询逻辑
|
||||
else {
|
||||
LambdaQueryWrapper<DocRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 患者ID查询条件
|
||||
if (docRecordQueryParam.getPatientId() != null) {
|
||||
queryWrapper.eq(DocRecord::getPatientId, docRecordQueryParam.getPatientId());
|
||||
}
|
||||
// 文书类型ID(必传)
|
||||
queryWrapper.eq(DocRecord::getDefinitionId, docRecordQueryParam.getDefinitionId());
|
||||
// 就诊ID查询条件(修复原逻辑:原代码字段匹配错误,用EncounterId匹配DefinitionBusNo)
|
||||
if (docRecordQueryParam.getEncounterId() != null) {
|
||||
queryWrapper.eq(DocRecord::getEncounterId, docRecordQueryParam.getEncounterId());
|
||||
}
|
||||
// 科室ID查询条件(修复原逻辑:原代码字段匹配错误,用OrganizationId匹配EncounterId)
|
||||
if (docRecordQueryParam.getOrganizationId() != null) {
|
||||
queryWrapper.eq(DocRecord::getOrganizationId, docRecordQueryParam.getOrganizationId());
|
||||
}
|
||||
|
||||
// 实体转DTO
|
||||
List<DocRecordDto> dtoList = new ArrayList<>();
|
||||
List<DocRecord> recordList = docRecordService.list(queryWrapper);
|
||||
for (DocRecord record : recordList) {
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
BeanUtils.copyProperties(record, dto);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return R.ok(dtoList, "获取患者文书记录列表成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者文书记录列表(携带患者信息,支持分页)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam, List<Integer> primaryMenuEnumList, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
if (docRecordPatientQueryParam == null) {
|
||||
return R.fail("文书记录:查询参数不能为空");
|
||||
}
|
||||
|
||||
// 构建查询条件(支持患者姓名搜索)
|
||||
QueryWrapper<DocRecordPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
docRecordPatientQueryParam, searchKey, new HashSet<>(Arrays.asList("patient_name", "bus_no")), request);
|
||||
|
||||
// 分页查询
|
||||
IPage<DocRecordPatientDto> pageResult = docRecordAppMapper.getRecordPageList(
|
||||
new Page<>(pageNo, pageSize), primaryMenuEnumList, queryWrapper);
|
||||
|
||||
// 处理返回结果:枚举值转中文描述、计算患者年龄
|
||||
if (pageResult != null && !pageResult.getRecords().isEmpty()) {
|
||||
for (DocRecordPatientDto dto : pageResult.getRecords()) {
|
||||
// 就诊类型枚举转描述(修复原逻辑:原代码用EncounterClass匹配所有枚举)
|
||||
EncounterClass encounterClass = EncounterClass.getByValue(dto.getClassEnum());
|
||||
dto.setClassEnumValue(encounterClass != null ? encounterClass.getInfo() : "");
|
||||
|
||||
// 性别枚举转描述
|
||||
AdministrativeGender gender = AdministrativeGender.getByValue(dto.getGender());
|
||||
dto.setGenderValue(gender != null ? gender.getInfo() : "");
|
||||
|
||||
// 文书类型枚举转描述
|
||||
DocTypeEnum docType = DocTypeEnum.getByValue(dto.getPrimaryMenuEnum());
|
||||
dto.setPrimaryMenuEnumValue(docType != null ? docType.getInfo() : "");
|
||||
|
||||
// 计算患者年龄
|
||||
dto.setAge(AgeCalculatorUtil.getAge(dto.getBirthDate()));
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(pageResult, "获取患者文书记录列表成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据记录ID获取文书详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordById(Long recordId) {
|
||||
if (recordId == null) {
|
||||
return R.fail("患者文书记录:文书记录ID不能为空");
|
||||
}
|
||||
|
||||
DocRecord record = docRecordService.getById(recordId);
|
||||
if (record == null) {
|
||||
return R.fail("患者文书记录:对应记录不存在");
|
||||
}
|
||||
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
BeanUtils.copyProperties(record, dto);
|
||||
return R.ok(dto, "获取患者文书记录成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> setIsEdit(Long recordId) {
|
||||
if (recordId == null) {
|
||||
return R.fail("患者文书记录:文书记录ID不能为空");
|
||||
}
|
||||
DocRecord record = docRecordService.getById(recordId);
|
||||
if (record == null) {
|
||||
return R.fail("患者文书记录:对应记录不存在");
|
||||
}
|
||||
if (record.getIsEdit() != null && record.getIsEdit() == 1) {
|
||||
return R.ok("患者文书记录:记录已处于编辑中状态,请勿重复 editing");
|
||||
}
|
||||
record.setIsEdit(1);
|
||||
boolean updateSuccess = docRecordService.updateById(record);
|
||||
if (updateSuccess) {
|
||||
return R.ok("设置患者文书记录为编辑中成功");
|
||||
} else {
|
||||
return R.fail("设置患者文书记录为编辑中失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文书记录(含日志留痕)
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteRecord(List<Long> ids) {
|
||||
// 1. 参数校验
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return R.fail("患者文书记录:删除的记录ID列表不能为空");
|
||||
}
|
||||
|
||||
// 2. 校验记录是否存在
|
||||
List<DocRecord> recordList = docRecordService.listByIds(ids);
|
||||
if (recordList == null || recordList.isEmpty()) {
|
||||
return R.fail("患者文书记录:待删除的记录不存在");
|
||||
}
|
||||
|
||||
// 3. 权限校验:仅允许删除自己创建的记录
|
||||
String currentUsername = SecurityUtils.getLoginUser().getUsername();
|
||||
List<DocRecord> logRecordList = new ArrayList<>();
|
||||
for (DocRecord record : recordList) {
|
||||
if (!currentUsername.equals(record.getCreateBy())) {
|
||||
return R.fail("患者文书记录:无权限删除他人创建的记录(记录ID:" + record.getId() + ")");
|
||||
}
|
||||
// 拷贝原记录用于日志
|
||||
DocRecord logRecord = new DocRecord();
|
||||
BeanUtils.copyProperties(record, logRecord);
|
||||
logRecordList.add(logRecord);
|
||||
}
|
||||
|
||||
// 4. 执行删除
|
||||
boolean deleteSuccess = docRecordService.removeByIds(ids);
|
||||
if (deleteSuccess) {
|
||||
// 5. 批量插入删除日志
|
||||
boolean logSuccess = insertBatchLog(logRecordList);
|
||||
if (!logSuccess) {
|
||||
return R.fail("删除患者文书记录成功,但插入文档操作日志失败");
|
||||
}
|
||||
return R.ok("删除患者文书记录成功");
|
||||
} else {
|
||||
return R.fail("删除患者文书记录失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.document.domain.DocStatistics;
|
||||
import com.openhis.document.service.IDocStatisticsService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsAppService;
|
||||
import com.openhis.web.document.appservice.IDocTemplateAppService;
|
||||
import com.openhis.web.document.dto.DocStatisticsDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档模板 业务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
|
||||
@Resource
|
||||
private IDocStatisticsService docStatisticsService;
|
||||
|
||||
@Override
|
||||
public R<?> createOrUpdte(List<DocStatisticsDto> docStatisticsList) {
|
||||
if (docStatisticsList.size() == 0) {
|
||||
return R.ok();
|
||||
}
|
||||
//根据recordId和statisticDefinitionId判断是否存在,存在则更新,不存在则新增
|
||||
LambdaQueryWrapper<DocStatistics> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatistics::getRecordId, docStatisticsList.get(0).getRecordId());
|
||||
queryWrapper.eq(DocStatistics::getStatisticDefinitionId, docStatisticsList.get(0).getStatisticDefinitionId());
|
||||
List<DocStatistics> docStatisticsOldList = docStatisticsService.list(queryWrapper);
|
||||
if (docStatisticsOldList.size() > 0) {
|
||||
//批量删除
|
||||
docStatisticsService.removeByIds(docStatisticsOldList.stream().map(DocStatistics::getId).toList());
|
||||
}
|
||||
//批量新增
|
||||
for (DocStatisticsDto docStatisticsDto : docStatisticsList) {
|
||||
DocStatistics docStatistics = new DocStatistics();
|
||||
docStatistics.setRecordId(docStatisticsDto.getRecordId());
|
||||
docStatistics.setStatisticDefinitionId(docStatisticsDto.getStatisticDefinitionId());
|
||||
docStatistics.setEncounterId(docStatisticsDto.getEncounterId());
|
||||
docStatistics.setPatientId(docStatisticsDto.getPatientId());
|
||||
docStatistics.setStatisticDefinitionCode(docStatisticsDto.getStatisticDefinitionCode());
|
||||
docStatistics.setOrgnizationId(docStatisticsDto.getOrgnizationId()); //TODO: 待确定
|
||||
docStatistics.setValue(docStatisticsDto.getValue());
|
||||
docStatistics.setRecordingDate(docStatisticsDto.getRecordingDate());
|
||||
docStatistics.setRecordingTime(docStatisticsDto.getRecordingTime());
|
||||
docStatistics.setSource(docStatisticsDto.getSource());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> delete(List<Long> ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> queryByRecordId(Long recordId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> queryByEncounterId(Long encounterId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,337 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
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.bean.BeanUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocStatisticsDefinition;
|
||||
import com.openhis.document.mapper.DocStatisticsDefinitionMapper;
|
||||
import com.openhis.document.service.IDocStatisticsDefinitionService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsDefinitionOptionAppService;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionOptionList;
|
||||
import com.openhis.web.document.dto.OptionDto;
|
||||
import com.openhis.web.document.mapper.DocStatisticsDefinitionAppMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 文档模板 业务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefinitionAppService {
|
||||
|
||||
@Resource
|
||||
private IDocStatisticsDefinitionService iDocStatisticsDefinitionService;
|
||||
@Resource
|
||||
private IDocStatisticsDefinitionOptionAppService iDocStaticsDefinitionOptionAppService;
|
||||
@Resource
|
||||
private DocStatisticsDefinitionMapper docStatisticsDefinitionMapper;
|
||||
@Resource
|
||||
private DocStatisticsDefinitionAppMapper docStatisticsDefinitionAppMapper;
|
||||
|
||||
@Override
|
||||
public R<?> createOrEdit(DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
if (docStatisticsDefinitionDto == null) {
|
||||
return R.fail("新增/编辑文档统计定义,参数不能为空");
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getName() == null || docStatisticsDefinitionDto.getName().trim().length() == 0) {
|
||||
return R.fail("新增/编辑文档统计定义,名称不能为空");
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getTypeEnum() == null) {
|
||||
return R.fail("新增/编辑文档统计定义,类型不能为空");
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getCode() == null) {
|
||||
return R.fail("新增/编辑文档统计定义,代码不能为空");
|
||||
}
|
||||
DocStatisticsDefinition docStatisticsDefinition = new DocStatisticsDefinition();
|
||||
BeanUtils.copyProperties(docStatisticsDefinitionDto, docStatisticsDefinition);
|
||||
// 新增时校验代码唯一性
|
||||
if (!docStatisticsDefinitionDto.getCode().isEmpty() && docStatisticsDefinitionDto.getId() == null) {
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatisticsDefinition::getCode, docStatisticsDefinitionDto.getCode());
|
||||
docStatisticsDefinition = iDocStatisticsDefinitionService.getOne(queryWrapper);
|
||||
if (docStatisticsDefinition != null) {
|
||||
return R.fail("文档统计定义代码已存在,请更换代码");
|
||||
}
|
||||
}
|
||||
// 区分新增/编辑逻辑
|
||||
return docStatisticsDefinitionDto.getId() == null ? add(docStatisticsDefinitionDto) : update(docStatisticsDefinitionDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public R<?> add(DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
String checkResult = initCheck(docStatisticsDefinitionDto);
|
||||
DocStatisticsDefinition docStatisticsDefinition = new DocStatisticsDefinition();
|
||||
if (checkResult != null) {
|
||||
return R.fail(checkResult);
|
||||
}
|
||||
if (!docStatisticsDefinitionDto.getCode().isEmpty()) {
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatisticsDefinition::getCode, docStatisticsDefinitionDto.getCode());
|
||||
Long count = iDocStatisticsDefinitionService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return R.fail("文档统计定义代码已存在,请更换代码");
|
||||
}
|
||||
}
|
||||
// 赋值新增字段
|
||||
docStatisticsDefinition.setName(docStatisticsDefinitionDto.getName());
|
||||
docStatisticsDefinition.setCode(docStatisticsDefinitionDto.getCode());
|
||||
docStatisticsDefinition.setTypeEnum(docStatisticsDefinitionDto.getTypeEnum());
|
||||
docStatisticsDefinition.setRequired(docStatisticsDefinitionDto.getRequired());
|
||||
docStatisticsDefinition.setRemark(docStatisticsDefinitionDto.getRemark());
|
||||
docStatisticsDefinition.setIsStatistics(docStatisticsDefinitionDto.getIsStatistics());
|
||||
docStatisticsDefinition.setDisplayOrder(docStatisticsDefinitionDto.getDisplayOrder());
|
||||
docStatisticsDefinition.setUnit(docStatisticsDefinitionDto.getUnit());
|
||||
|
||||
|
||||
boolean saveResult = iDocStatisticsDefinitionService.save(docStatisticsDefinition);
|
||||
if (saveResult) {
|
||||
// 同步保存选项列表(如有)
|
||||
if (docStatisticsDefinitionDto.getOptionList() != null && !docStatisticsDefinitionDto.getOptionList().getOptions().isEmpty()) {
|
||||
docStatisticsDefinitionDto.getOptionList().setDocStatisticsDefinitionId(docStatisticsDefinition.getId());
|
||||
return iDocStaticsDefinitionOptionAppService.add(docStatisticsDefinitionDto.getOptionList());
|
||||
}
|
||||
return R.ok("文档统计定义新增成功");
|
||||
} else {
|
||||
return R.fail("文档统计定义新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public R<?> update(DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
String checkResult = initCheck(docStatisticsDefinitionDto);
|
||||
if (checkResult != null) {
|
||||
return R.fail(checkResult);
|
||||
}
|
||||
// 校验待更新数据是否存在
|
||||
DocStatisticsDefinition existingData = iDocStatisticsDefinitionService.getById(docStatisticsDefinitionDto.getId());
|
||||
if (existingData == null) {
|
||||
return R.fail("更新文档统计定义失败,目标数据不存在");
|
||||
}
|
||||
// 赋值更新字段
|
||||
existingData.setName(docStatisticsDefinitionDto.getName());
|
||||
existingData.setCode(docStatisticsDefinitionDto.getCode());
|
||||
existingData.setTypeEnum(docStatisticsDefinitionDto.getTypeEnum());
|
||||
existingData.setRequired(docStatisticsDefinitionDto.getRequired());
|
||||
existingData.setRemark(docStatisticsDefinitionDto.getRemark());
|
||||
existingData.setIsStatistics(docStatisticsDefinitionDto.getIsStatistics());
|
||||
existingData.setDisplayOrder(docStatisticsDefinitionDto.getDisplayOrder());
|
||||
existingData.setUnit(docStatisticsDefinitionDto.getUnit());
|
||||
boolean updateResult = iDocStatisticsDefinitionService.updateById(existingData);
|
||||
if (updateResult) {
|
||||
// 同步更新选项列表
|
||||
return iDocStaticsDefinitionOptionAppService.createOrEdit(docStatisticsDefinitionDto.getOptionList());
|
||||
} else {
|
||||
return R.fail("文档统计定义更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String initCheck(DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
if (docStatisticsDefinitionDto == null) {
|
||||
return "新增/编辑文档统计定义,参数不能为空";
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getName() == null || docStatisticsDefinitionDto.getName().trim().length() == 0) {
|
||||
return "新增/编辑文档统计定义,名称不能为空";
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getTypeEnum() == null) {
|
||||
return "新增/编辑文档统计定义,类型不能为空";
|
||||
}
|
||||
if (docStatisticsDefinitionDto.getCode() == null) {
|
||||
return "新增/编辑文档统计定义,代码不能为空";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询列表-不包含options(分页)
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param searchKey 搜索关键词
|
||||
* @param request 请求对象
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPageList(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 构建查询条件(支持多字段搜索)
|
||||
QueryWrapper<DocStatisticsDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
null, searchKey, new HashSet<>(Arrays.asList("name", "code")), request);
|
||||
// 按记录时间倒序(最新记录在前)
|
||||
queryWrapper.lambda().orderByDesc(DocStatisticsDefinition::getDisplayOrder);
|
||||
|
||||
Page<DocStatisticsDefinitionDto> recordPage = HisPageUtils.selectPage(
|
||||
docStatisticsDefinitionMapper, queryWrapper, pageNo, pageSize, DocStatisticsDefinitionDto.class);
|
||||
// 转换为分页结果
|
||||
return R.ok(recordPage, "文档统计定义列表获取成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档统计定义列表(不分页)
|
||||
*
|
||||
* @param isStatistics 是否统计
|
||||
* @return 文档统计定义列表
|
||||
*/
|
||||
@Override
|
||||
public List<DocStatisticsDefinitionDto> getList(Integer isStatistics) {
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (isStatistics != null) {
|
||||
queryWrapper.eq(DocStatisticsDefinition::getIsStatistics, isStatistics);
|
||||
}
|
||||
List<DocStatisticsDefinition> dataList = iDocStatisticsDefinitionService.list(queryWrapper);
|
||||
List<DocStatisticsDefinitionDto> resultList = new ArrayList<>();
|
||||
for (DocStatisticsDefinition data : dataList) {
|
||||
DocStatisticsDefinitionDto dto = new DocStatisticsDefinitionDto();
|
||||
BeanUtils.copyProperties(data, dto);
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档统计定义选项列表并按指定格式返回
|
||||
*
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOptionList() {
|
||||
// 1. 从数据库查询所有选项数据
|
||||
List<OptionDto> optionDtoList = docStatisticsDefinitionAppMapper.getOptionList(null, null, null);
|
||||
|
||||
// 2. 处理空数据场景
|
||||
if (optionDtoList == null || optionDtoList.isEmpty()) {
|
||||
return R.ok(new ArrayList<>(), "文档统计定义选项列表获取成功,查询结果为空");
|
||||
}
|
||||
|
||||
// 3. 按code字段分组
|
||||
Map<String, List<OptionDto>> groupCodeMap = optionDtoList.stream()
|
||||
.collect(Collectors.groupingBy(OptionDto::getCode));
|
||||
|
||||
// 4. 准备最终返回的结果列表
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
// 5. 遍历每个code分组
|
||||
for (Map.Entry<String, List<OptionDto>> entry : groupCodeMap.entrySet()) {
|
||||
String code = entry.getKey();
|
||||
List<OptionDto> optionDtos = entry.getValue();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
// 设置名称和code
|
||||
if (!optionDtos.isEmpty()) {
|
||||
resultMap.put("name", optionDtos.get(0).getName());
|
||||
}
|
||||
resultMap.put("code", code);
|
||||
|
||||
// 动态生成列表键名
|
||||
String listKey = code + "List";
|
||||
|
||||
// 检查分组中是否存在任何optionId为null的元素
|
||||
boolean hasNullOptionId = optionDtos.stream()
|
||||
.anyMatch(dto -> dto.getOptionId() == null);
|
||||
|
||||
// 如果存在null的optionId,返回空集合;否则正常处理
|
||||
List<Map<String, Object>> optionList;
|
||||
if (hasNullOptionId) {
|
||||
optionList = new ArrayList<>(); // 返回空集合
|
||||
} else {
|
||||
// 正常转换有效元素
|
||||
optionList = optionDtos.stream()
|
||||
.map(dto -> {
|
||||
Map<String, Object> optionMap = new HashMap<>();
|
||||
optionMap.put("id", dto.getOptionId().toString());
|
||||
optionMap.put("option", dto.getOption());
|
||||
return optionMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 添加列表到结果中(即使是空集合)
|
||||
resultMap.put(listKey, optionList);
|
||||
resultList.add(resultMap);
|
||||
}
|
||||
|
||||
return R.ok(resultList, "文档统计定义选项列表获取成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> deleteDocStatisticsDefinition(Long id) {
|
||||
if (id == null) {
|
||||
return R.fail("删除文档统计定义,参数ID不能为空");
|
||||
}
|
||||
boolean deleteResult = iDocStatisticsDefinitionService.removeById(id);
|
||||
if (deleteResult) {
|
||||
// 同步删除选项列表
|
||||
iDocStaticsDefinitionOptionAppService.deleteDocStatisticsDefinitionOptionById(id);
|
||||
return R.ok("文档统计定义删除成功");
|
||||
} else {
|
||||
return R.fail("文档统计定义删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档统计定义详情
|
||||
*
|
||||
* @param id 文档统计定义ID
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDocStatisticsDefinitionById(Long id) {
|
||||
if (id == null) {
|
||||
return R.fail("获取文档统计定义,参数ID不能为空");
|
||||
}
|
||||
DocStatisticsDefinition data = iDocStatisticsDefinitionService.getById(id);
|
||||
if (data == null) {
|
||||
return R.fail("获取文档统计定义失败,目标数据不存在");
|
||||
}
|
||||
// 转换为DTO返回
|
||||
DocStatisticsDefinitionDto dto = new DocStatisticsDefinitionDto();
|
||||
BeanUtils.copyProperties(data, dto);
|
||||
DocStatisticsDefinitionOptionList optionList = iDocStaticsDefinitionOptionAppService.getDocStatisticsDefinitionOptionByDefinitionId(id);
|
||||
dto.setOptionList(optionList);
|
||||
return R.ok(dto, "文档统计定义获取成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据代码获取文档统计定义详情
|
||||
*
|
||||
* @param code 文档统计定义代码
|
||||
* @return 封装了处理结果的响应对象
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDocStatisticsDefinitionByCode(String code) {
|
||||
if (code == null || code.trim().isEmpty()) {
|
||||
return R.fail("获取文档统计定义,参数代码不能为空");
|
||||
}
|
||||
// 按代码查询
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatisticsDefinition::getCode, code);
|
||||
DocStatisticsDefinition data = iDocStatisticsDefinitionService.getOne(queryWrapper);
|
||||
if (data == null) {
|
||||
return R.fail("获取文档统计定义失败,目标数据不存在");
|
||||
}
|
||||
DocStatisticsDefinitionDto dto = new DocStatisticsDefinitionDto();
|
||||
if (data != null) {
|
||||
BeanUtils.copyProperties(data, dto);
|
||||
}
|
||||
DocStatisticsDefinitionOptionList optionList = iDocStaticsDefinitionOptionAppService.getDocStatisticsDefinitionOptionByDefinitionId(data.getId());
|
||||
dto.setOptionList(optionList);
|
||||
return R.ok(dto, "文档统计定义获取成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.document.domain.DocStatisticsDefinitionOption;
|
||||
import com.openhis.document.mapper.DocStatisticsDefinitionOptionMapper;
|
||||
import com.openhis.document.service.IDocStatisticsDefinitionOptionService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsDefinitionOptionAppService;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionOptionDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionOptionList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 文档统计定义选项 业务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocStatisticsDefinitionOptionAppServiceImpl implements IDocStatisticsDefinitionOptionAppService {
|
||||
|
||||
@Resource
|
||||
private DocStatisticsDefinitionOptionMapper docStatisticsDefinitonOptionMapper;
|
||||
@Resource
|
||||
private IDocStatisticsDefinitionOptionService docStatisticsDefinitionOptionService;
|
||||
|
||||
/**
|
||||
* 新增文档统计定义选项
|
||||
*
|
||||
* @param docStatisticsDefinitionOptionList 选项列表DTO
|
||||
*/
|
||||
@Override
|
||||
public R<?> add(DocStatisticsDefinitionOptionList docStatisticsDefinitionOptionList) {
|
||||
// 参数校验
|
||||
if (docStatisticsDefinitionOptionList == null) {
|
||||
return R.fail("统计项选项列表为空,请选择统计项选项");
|
||||
}
|
||||
if (docStatisticsDefinitionOptionList.getOptions() == null || docStatisticsDefinitionOptionList.getOptions().isEmpty()) {
|
||||
return R.fail("统计项选项不允许为空,请正确填写统计项选项");
|
||||
}
|
||||
if (docStatisticsDefinitionOptionList.getDocStatisticsDefinitionId() == null) {
|
||||
return R.fail("统计项定义ID为空,请选择统计项定义ID");
|
||||
}
|
||||
|
||||
// DTO转实体
|
||||
List<DocStatisticsDefinitionOption> optionList = new ArrayList<>();
|
||||
for (DocStatisticsDefinitionOptionDto dto : docStatisticsDefinitionOptionList.getOptions()) {
|
||||
DocStatisticsDefinitionOption option = new DocStatisticsDefinitionOption();
|
||||
option.setDocStatisticsDefinitionId(docStatisticsDefinitionOptionList.getDocStatisticsDefinitionId());
|
||||
option.setOption(dto.getOption());
|
||||
option.setDisplayOrder(dto.getDisplayOrder());
|
||||
optionList.add(option);
|
||||
}
|
||||
|
||||
// 批量新增
|
||||
boolean saveSuccess = docStatisticsDefinitionOptionService.saveBatch(optionList);
|
||||
if (saveSuccess) {
|
||||
return R.ok(optionList, "统计项选项保存成功");
|
||||
} else {
|
||||
return R.fail("统计项选项保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/编辑文档统计定义选项(区分增删改)
|
||||
*
|
||||
* @param docStatisticsDefinitionOptionList 选项列表DTO
|
||||
*/
|
||||
@Override
|
||||
public R<?> createOrEdit(DocStatisticsDefinitionOptionList docStatisticsDefinitionOptionList) {
|
||||
// 参数校验
|
||||
if (docStatisticsDefinitionOptionList == null) {
|
||||
return R.fail("统计项选项列表为空,请选择统计项选项");
|
||||
}
|
||||
Long definitionId = docStatisticsDefinitionOptionList.getDocStatisticsDefinitionId();
|
||||
if (definitionId == null) {
|
||||
return R.fail("统计项定义ID为空,请选择统计项定义ID");
|
||||
}
|
||||
|
||||
// 1. 查询原数据列表(按统计定义ID关联)
|
||||
List<DocStatisticsDefinitionOption> oldList = docStatisticsDefinitonOptionMapper.selectList(
|
||||
new LambdaQueryWrapper<DocStatisticsDefinitionOption>()
|
||||
.eq(DocStatisticsDefinitionOption::getDocStatisticsDefinitionId, definitionId));
|
||||
oldList = oldList == null ? Collections.emptyList() : oldList;
|
||||
|
||||
// 2. 处理新数据列表(DTO转实体,避免空指针)
|
||||
List<DocStatisticsDefinitionOption> newList = new ArrayList<>();
|
||||
if (docStatisticsDefinitionOptionList.getOptions() != null && !docStatisticsDefinitionOptionList.getOptions().isEmpty()) {
|
||||
for (DocStatisticsDefinitionOptionDto dto : docStatisticsDefinitionOptionList.getOptions()) {
|
||||
DocStatisticsDefinitionOption option = new DocStatisticsDefinitionOption();
|
||||
BeanUtils.copyProperties(dto, option); // 改用BeanUtils简化赋值
|
||||
option.setDocStatisticsDefinitionId(definitionId); // 强制关联父ID,确保数据一致性
|
||||
newList.add(option);
|
||||
}
|
||||
}
|
||||
newList = newList == null ? Collections.emptyList() : newList;
|
||||
|
||||
// 3. 构建原数据ID映射(快速查找)
|
||||
Map<Long, DocStatisticsDefinitionOption> oldIdMap = oldList.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(item -> item.getId() != null)
|
||||
.collect(Collectors.toMap(DocStatisticsDefinitionOption::getId, item -> item));
|
||||
|
||||
// 4. 提取新数据中的有效ID集合
|
||||
Set<Long> newIds = newList.stream()
|
||||
.map(DocStatisticsDefinitionOption::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 5. 确定需要删除的项(原数据存在但新数据不存在)
|
||||
List<Long> deleteIds = oldList.stream()
|
||||
.map(DocStatisticsDefinitionOption::getId)
|
||||
.filter(id -> !newIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 6. 区分新增和修改的项
|
||||
List<DocStatisticsDefinitionOption> addList = new ArrayList<>();
|
||||
List<DocStatisticsDefinitionOption> updateList = new ArrayList<>();
|
||||
for (DocStatisticsDefinitionOption newItem : newList) {
|
||||
Long newItemId = newItem.getId();
|
||||
if (newItemId != null && oldIdMap.containsKey(newItemId)) {
|
||||
// 有ID且原数据存在 → 修改
|
||||
updateList.add(newItem);
|
||||
} else {
|
||||
// 无ID或原数据不存在 → 新增
|
||||
addList.add(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 7. 执行删除操作
|
||||
if (!deleteIds.isEmpty()) {
|
||||
boolean deleteSuccess = docStatisticsDefinitionOptionService.removeByIds(deleteIds);
|
||||
if (!deleteSuccess) {
|
||||
return R.fail("统计项选项删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 8. 执行修改操作
|
||||
if (!updateList.isEmpty()) {
|
||||
boolean updateSuccess = docStatisticsDefinitionOptionService.updateBatchById(updateList);
|
||||
if (!updateSuccess) {
|
||||
return R.fail("统计项选项更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 9. 执行新增操作
|
||||
if (!addList.isEmpty()) {
|
||||
boolean addSuccess = docStatisticsDefinitionOptionService.saveBatch(addList);
|
||||
if (!addSuccess) {
|
||||
return R.fail("统计项选项新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok("统计项选项更新成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个统计项选项
|
||||
*
|
||||
* @param id 选项ID
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteDocStatisticsDefinitionOptionById(Long id) {
|
||||
if (id == null) {
|
||||
return R.fail("统计项选项ID为空,请选择要删除的统计项选项");
|
||||
}
|
||||
|
||||
// 先校验数据是否存在
|
||||
DocStatisticsDefinitionOption existingOption = docStatisticsDefinitionOptionService.getById(id);
|
||||
if (existingOption == null) {
|
||||
return R.fail("统计项选项不存在,删除失败");
|
||||
}
|
||||
// 执行删除
|
||||
boolean deleteSuccess = docStatisticsDefinitionOptionService.removeById(id);
|
||||
if (deleteSuccess) {
|
||||
return R.ok("统计项选项删除成功");
|
||||
} else {
|
||||
return R.fail("统计项选项删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据统计定义ID查询选项列表
|
||||
*
|
||||
* @param docStatisticsDefinitionId 统计定义ID
|
||||
*/
|
||||
@Override
|
||||
public DocStatisticsDefinitionOptionList getDocStatisticsDefinitionOptionByDefinitionId(Long docStatisticsDefinitionId) {
|
||||
|
||||
// 修复原查询条件错误:原逻辑用ID查ID,改为用统计定义ID查关联选项
|
||||
LambdaQueryWrapper<DocStatisticsDefinitionOption> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatisticsDefinitionOption::getDocStatisticsDefinitionId, docStatisticsDefinitionId)
|
||||
.orderByAsc(DocStatisticsDefinitionOption::getDisplayOrder); // 按显示顺序排序
|
||||
|
||||
List<DocStatisticsDefinitionOption> optionList = docStatisticsDefinitonOptionMapper.selectList(queryWrapper);
|
||||
if (optionList == null || optionList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 实体转DTO
|
||||
List<DocStatisticsDefinitionOptionDto> dtoList = new ArrayList<>();
|
||||
for (DocStatisticsDefinitionOption option : optionList) {
|
||||
DocStatisticsDefinitionOptionDto dto = new DocStatisticsDefinitionOptionDto();
|
||||
dto.setId(option.getId());
|
||||
dto.setOption(option.getOption());
|
||||
dto.setDisplayOrder(option.getDisplayOrder());
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
// 封装返回结果
|
||||
DocStatisticsDefinitionOptionList resultList = new DocStatisticsDefinitionOptionList();
|
||||
resultList.setDocStatisticsDefinitionId(docStatisticsDefinitionId);
|
||||
resultList.setOptions(dtoList);
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档模板 统计项选项列表
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDocStatisticsDefinitionOptionList() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
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.SecurityUtils;
|
||||
import com.openhis.common.enums.DocUseRangeEnum;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocTemplate;
|
||||
import com.openhis.document.mapper.DocTemplateMapper;
|
||||
import com.openhis.document.service.IDocTemplateService;
|
||||
import com.openhis.web.document.appservice.IDocTemplateAppService;
|
||||
import com.openhis.web.document.dto.DocTemplateDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档模板 业务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DocTemplateAppServiceImpl implements IDocTemplateAppService {
|
||||
|
||||
@Resource
|
||||
private IDocTemplateService docTemplateService;
|
||||
@Resource
|
||||
private DocTemplateMapper docTemplateMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> add(DocTemplateDto docTemplateDto) {
|
||||
|
||||
String msg = initCheck(docTemplateDto);
|
||||
if (msg != null) {
|
||||
return R.fail(msg);
|
||||
}
|
||||
DocTemplate docTemplate = new DocTemplate();
|
||||
docTemplate.setName(docTemplateDto.getName());
|
||||
docTemplate.setDisplayOrder(docTemplateDto.getDisplayOrder());
|
||||
docTemplate.setContextJson(docTemplateDto.getContextJson());
|
||||
docTemplate.setDefinitionId(docTemplateDto.getDefinitionId());
|
||||
if (docTemplateDto.getUseRange() == null) {
|
||||
docTemplate.setUseRange(DocUseRangeEnum.ALL_HOSPITAL_USE.getValue());
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == DocUseRangeEnum.DEPT_USE.getValue()) {
|
||||
docTemplateDto.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == DocUseRangeEnum.USE_BY_SELF.getValue()) {
|
||||
docTemplateDto.setUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
}
|
||||
docTemplate.setOrganizationId(docTemplateDto.getOrganizationId());
|
||||
docTemplate.setId(docTemplateDto.getUserId());
|
||||
docTemplate.setUseRange(docTemplateDto.getUseRange());
|
||||
docTemplate.setRemark(docTemplateDto.getRemark());
|
||||
docTemplateService.save(docTemplate);
|
||||
return R.ok(" 添加成功");
|
||||
}
|
||||
|
||||
private String initCheck(DocTemplateDto docTemplateDto) {
|
||||
if (docTemplateDto == null) {
|
||||
return "参数不能为空";
|
||||
}
|
||||
if (docTemplateDto.getName().isEmpty()) {
|
||||
return "名称不能为空";
|
||||
}
|
||||
if (docTemplateDto.getContextJson().isEmpty()) {
|
||||
return "内容不能为空";
|
||||
}
|
||||
if (docTemplateDto.getDefinitionId() == null) {
|
||||
return "模板定义不能为空";
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == null) {
|
||||
return "使用范围不能为空";
|
||||
}
|
||||
if (docTemplateDto.getId() == null) {
|
||||
//根据名称+定义查询模板是否存在
|
||||
LambdaQueryWrapper<DocTemplate> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocTemplate::getName, docTemplateDto.getName());
|
||||
queryWrapper.eq(DocTemplate::getDefinitionId, docTemplateDto.getDefinitionId());
|
||||
DocTemplate docTemplate = docTemplateService.getOne(queryWrapper);
|
||||
if (docTemplate != null) {
|
||||
return "该模板已存在,请勿重复添加";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> delete(Long id) {
|
||||
if (id == null) {
|
||||
return R.fail("模板ID不能为空");
|
||||
}
|
||||
boolean result = docTemplateService.removeById(id);
|
||||
if (result) {
|
||||
return R.ok("删除成功");
|
||||
}
|
||||
return R.fail("模板不存在");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> update(DocTemplateDto docTemplateDto) {
|
||||
String msg = initCheck(docTemplateDto);
|
||||
if (msg != null) {
|
||||
return R.fail(msg);
|
||||
}
|
||||
if (docTemplateDto.getId() == null) {
|
||||
return R.fail("模板ID不能为空");
|
||||
}
|
||||
DocTemplate docTemplate = docTemplateService.getById(docTemplateDto.getId());
|
||||
if (docTemplate == null) {
|
||||
return R.fail("模板不存在");
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == DocUseRangeEnum.ALL_HOSPITAL_USE.getValue() || docTemplateDto.getUseRange() == DocUseRangeEnum.NO_IN_USE.getValue()) {
|
||||
docTemplateDto.setOrganizationId(null);
|
||||
docTemplateDto.setUserId(null);
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == DocUseRangeEnum.DEPT_USE.getValue()) {
|
||||
docTemplateDto.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
|
||||
docTemplateDto.setUserId(null);
|
||||
}
|
||||
if (docTemplateDto.getUseRange() == DocUseRangeEnum.USE_BY_SELF.getValue()) {
|
||||
docTemplate.setUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
docTemplateDto.setOrganizationId(null);
|
||||
}
|
||||
docTemplate.setName(docTemplateDto.getName());
|
||||
docTemplate.setDisplayOrder(docTemplateDto.getDisplayOrder());
|
||||
docTemplate.setContextJson(docTemplateDto.getContextJson());
|
||||
docTemplate.setDefinitionId(docTemplateDto.getDefinitionId());
|
||||
docTemplate.setUseRange(docTemplateDto.getUseRange());
|
||||
docTemplate.setOrganizationId(docTemplateDto.getOrganizationId());
|
||||
docTemplate.setUserId(docTemplateDto.getUserId());
|
||||
docTemplate.setRemark(docTemplateDto.getRemark());
|
||||
docTemplateService.save(docTemplate);
|
||||
return R.ok("更新成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getById(Long id) {
|
||||
if (id == null) {
|
||||
return R.fail("模板ID不能为空");
|
||||
}
|
||||
DocTemplateDto templateDto = new DocTemplateDto();
|
||||
DocTemplate result = docTemplateService.getById(id);
|
||||
BeanUtils.copyProperties(result, templateDto);
|
||||
return R.ok(templateDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getListByDefinitionId(Long definitionId) {
|
||||
if (definitionId == null) {
|
||||
return R.fail("模板定义ID不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<DocTemplate> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocTemplate::getDefinitionId, definitionId);
|
||||
queryWrapper.orderByAsc(DocTemplate::getDisplayOrder);
|
||||
List<DocTemplate> docTemplates = docTemplateService.list(queryWrapper);
|
||||
List<DocTemplateDto> templateDtos = new ArrayList<>();
|
||||
for (DocTemplate docTemplate : docTemplates) {
|
||||
DocTemplateDto templateDto = new DocTemplateDto();
|
||||
BeanUtils.copyProperties(docTemplate, templateDto);
|
||||
templateDtos.add(templateDto);
|
||||
}
|
||||
return R.ok(templateDtos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getPageList(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 构建查询条件(支持多字段搜索)
|
||||
QueryWrapper<DocTemplate> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
null, searchKey, new HashSet<>(Arrays.asList("name")), request);
|
||||
// 按记录时间倒序(最新记录在前)
|
||||
queryWrapper.lambda().orderByDesc(DocTemplate::getDisplayOrder);
|
||||
|
||||
Page<DocTemplateDto> page = HisPageUtils.selectPage(
|
||||
docTemplateMapper, queryWrapper, pageNo, pageSize, DocTemplateDto.class);
|
||||
// 转换为分页结果
|
||||
return R.ok(page, "获取成功");
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.DocPermissionEnum;
|
||||
import com.openhis.common.enums.DocTypeEnum;
|
||||
import com.openhis.common.enums.DocUseRangeEnum;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.dto.DocDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocDefinitonParam;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文书定义 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/definition")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocDefinitionController {
|
||||
private final IDocDefinitionAppService iDocDefinitionAppService;
|
||||
|
||||
/**
|
||||
* 初始化文书定义
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> init() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取文档类型枚举列表
|
||||
map.put("docTypes", EnumUtil.toMapList(DocTypeEnum.class));
|
||||
|
||||
// 获取权限枚举列表
|
||||
map.put("permissions", EnumUtil.toMapList(DocPermissionEnum.class));
|
||||
//使用范围枚举
|
||||
|
||||
map.put("useRanges", EnumUtil.toMapList(DocUseRangeEnum.class));
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文书定义
|
||||
*
|
||||
* @param definitionDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
|
||||
public R<?> addDefinition(@RequestBody DocDefinitionDto definitionDto) {
|
||||
return iDocDefinitionAppService.addDefinition(definitionDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文书定义
|
||||
*
|
||||
* @param definitionDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public R<?> updateDefinition(@RequestBody DocDefinitionDto definitionDto) {
|
||||
return iDocDefinitionAppService.updateDefinition(definitionDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文书定义详情
|
||||
*
|
||||
* @param id 文书定义ID
|
||||
* @return 文书定义详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getDefinitionDetailById(@PathVariable Long id) {
|
||||
log.info("获取文书定义详情 ID={}", id);
|
||||
return iDocDefinitionAppService.getDefinitionDetailById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询获取文书定义列表 树形结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/treeList")
|
||||
public R<?> getTreeList(DocDefinitonParam docDefinitonParam) {
|
||||
return iDocDefinitionAppService.getTreeList(docDefinitonParam);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionOrganizationAppService;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 文书定义 - 科室分配 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/definition/Organization")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocDefinitionOrganizationController {
|
||||
|
||||
private final IDocDefinitionOrganizationAppService docDefinitionOrganizationAppService;
|
||||
|
||||
/**
|
||||
* 新增文书分配科室列表
|
||||
*
|
||||
* @param organizationDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<?> add(@RequestBody DocDefinitionOrganizationDto organizationDto) {
|
||||
return docDefinitionOrganizationAppService.add(organizationDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文书分配科室列表
|
||||
*
|
||||
* @param definitionId
|
||||
* @param busNo
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public R<?> delete(@RequestParam("definitionId") Long definitionId, @RequestParam("busNo") String busNo) {
|
||||
return docDefinitionOrganizationAppService.delete(definitionId, busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文书定义科室列表
|
||||
*
|
||||
* @param definitionId
|
||||
* @param busNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getOrganizationIdlist")
|
||||
public R<?> getOrganizationIdlist(@RequestParam("definitionId") Long definitionId, @RequestParam("busNo") String busNo) {
|
||||
return docDefinitionOrganizationAppService.getOrganizationIdlist(definitionId, busNo);
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.DocStatusEnum;
|
||||
import com.openhis.common.enums.DocTypeEnum;
|
||||
import com.openhis.web.document.appservice.IDocRecordAppService;
|
||||
import com.openhis.web.document.dto.DocRecordDto;
|
||||
import com.openhis.web.document.dto.DocRecordPatientQueryParam;
|
||||
import com.openhis.web.document.dto.DocRecordQueryParam;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文书记录 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/record")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocRecordController {
|
||||
|
||||
private final IDocRecordAppService docRecordAppService;
|
||||
|
||||
/**
|
||||
* 初始化文书定义
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> init() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取文档状态枚举
|
||||
map.put("doc_status_enums", EnumUtil.toMapList(DocStatusEnum.class));
|
||||
map.put("doc_type_enums", EnumUtil.toMapList(DocTypeEnum.class));
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增记录
|
||||
*
|
||||
* @param docRecordDto 文书记录信息
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/addRecord")
|
||||
public R<?> addRecord(@RequestBody DocRecordDto docRecordDto) {
|
||||
return docRecordAppService.addRecord(docRecordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑记录 修改前先设置文书为编辑状态
|
||||
*
|
||||
* @param docRecordDto 文书记录信息
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/updateRecord")
|
||||
public R<?> updateRecord(@RequestBody DocRecordDto docRecordDto) {
|
||||
return docRecordAppService.updateRecord(docRecordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文书为编辑状态
|
||||
*
|
||||
* @param recordId 文书记录ID
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/setIsEdit")
|
||||
public R<?> setIsEdit(Long recordId) {
|
||||
return docRecordAppService.setIsEdit(recordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID或就诊ID获取文书记录列表,只针对不需返回患者具体信息的列表,体温单除外,单独处理
|
||||
* 需返回患者具体信息的列表,请使用getPatientRecordList
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 页大小
|
||||
* @param searchKey 搜索关键字
|
||||
* @param request 请求
|
||||
* 1.IsPage 是否分页 0:不分页 1:分页
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/getRecordByEncounterIdList")
|
||||
R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam,
|
||||
@RequestParam(value = "IsPage", defaultValue = "1") Integer IsPage,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return docRecordAppService.getRecordByEncounterIdList(docRecordQueryParam, IsPage, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文书记录列表
|
||||
*
|
||||
* @param docRecordPatientQueryParam 文书记录查询参数
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 页大小
|
||||
* @param searchKey 搜索关键字
|
||||
* @param request 请求
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/getRecordPageList")
|
||||
R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam,
|
||||
@RequestParam(value = "primaryMenuEnumList", required = false) List<Integer> primaryMenuEnumList,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey,
|
||||
HttpServletRequest request) {
|
||||
return docRecordAppService.getRecordPageList(docRecordPatientQueryParam, primaryMenuEnumList, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文书记录ID获取文书记录信息
|
||||
*
|
||||
* @param recordId 文书记录ID
|
||||
*/
|
||||
@GetMapping("/getRecordById")
|
||||
R<?> getRecordById(@RequestParam(value = "recordId") Long recordId) {
|
||||
return docRecordAppService.getRecordById(recordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文书分配信息
|
||||
*
|
||||
* @param ids 删除文书分配信息ID列表
|
||||
*/
|
||||
@DeleteMapping("/deleteRecord")
|
||||
R<?> deleteRecord(@RequestBody List<Long> ids) {
|
||||
return docRecordAppService.deleteRecord(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.openhis.web.document.appservice.IDocRecordAppService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 文档模板-病历另存为模板使用 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/template")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocStatisticsController {
|
||||
|
||||
private final IDocRecordAppService docRecordAppService;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.DocStatisticsDefinitionTypeEnum;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsDefinitionAppService;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionDto;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 统计定义 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/statistics/definition")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocStatisticsDefinitionController {
|
||||
|
||||
private final IDocStatisticsDefinitionAppService docStatisticsDefinitionAppService;
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> init() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取文档状态枚举
|
||||
map.put("doc_statistics_definition_type_enums", EnumUtil.toMapList(DocStatisticsDefinitionTypeEnum.class));
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
// @PostMapping("/createOrEdit")
|
||||
// public R<?> createOrEdit(@RequestBody DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
// return docStatisticsDefinitionAppService.createOrEdit(docStatisticsDefinitionDto);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 新增统计定义
|
||||
*
|
||||
* @param docStatisticsDefinitionDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<?> add(@RequestBody DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
return docStatisticsDefinitionAppService.add(docStatisticsDefinitionDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改统计定义
|
||||
*
|
||||
* @param docStatisticsDefinitionDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public R<?> update(@RequestBody DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
return docStatisticsDefinitionAppService.update(docStatisticsDefinitionDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除统计定义
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@DeleteMapping("/deleteDocStatisticsDefinition")
|
||||
public R<?> deleteDocStatisticsDefinition(Long id) {
|
||||
return docStatisticsDefinitionAppService.deleteDocStatisticsDefinition(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取统计定义详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDocStatisticsDefinitionById")
|
||||
public R<?> getDocStatisticsDefinitionById(Long id) {
|
||||
return docStatisticsDefinitionAppService.getDocStatisticsDefinitionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取统计定义详情
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDocStatisticsDefinitionByCode")
|
||||
public R<?> getDocStatisticsDefinitionByCode(String code) {
|
||||
return docStatisticsDefinitionAppService.getDocStatisticsDefinitionByCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询列表-不包含options
|
||||
*
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param searchKey
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getPageList")
|
||||
public R<?> getPageList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return docStatisticsDefinitionAppService.getPageList(pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档统计定义选项列表并按指定格式返回
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getOptionList")
|
||||
public R<?> getOptionList() {
|
||||
return docStatisticsDefinitionAppService.getOptionList();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import com.openhis.web.document.appservice.IDocRecordAppService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsDefinitionOptionAppService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 文文统计选项 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/statisticsOption")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocStatisticsOptionController {
|
||||
|
||||
private final IDocStatisticsDefinitionOptionAppService docStatisticsDefinitionOptionAppService;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.openhis.web.document.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.openhis.web.document.dto.DocTemplateDto;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.DocTypeEnum;
|
||||
import com.openhis.common.enums.DocUseRangeEnum;
|
||||
import com.openhis.web.document.appservice.IDocTemplateAppService;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* DOC模板 controller
|
||||
*
|
||||
* @author wanghaiming
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/document/template")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DocTemplateController {
|
||||
|
||||
private final IDocTemplateAppService docTemplateAppService;
|
||||
|
||||
/**
|
||||
* 初始化文书定义
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> init() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取文档类型枚举列表
|
||||
map.put("docTypes", EnumUtil.toMapList(DocTypeEnum.class));
|
||||
// 使用范围枚举
|
||||
map.put("useRanges", EnumUtil.toMapList(DocUseRangeEnum.class));
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public R<?> add(@RequestBody DocTemplateDto docTemplateDto) {
|
||||
return docTemplateAppService.add(docTemplateDto);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public R<?> delete(Long id) {
|
||||
return docTemplateAppService.delete(id);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public R<?> update(@RequestBody DocTemplateDto docTemplateDto) {
|
||||
return docTemplateAppService.update(docTemplateDto);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
public R<?> getById(Long id) {
|
||||
return docTemplateAppService.getById(id);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getListByDefinitionId")
|
||||
public R<?> getListByDefinitionId(Long definitionId) {
|
||||
return docTemplateAppService.getListByDefinitionId(definitionId);
|
||||
}
|
||||
|
||||
@GetMapping("/getPageList")
|
||||
public R<?> getPageList(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return docTemplateAppService.getPageList(pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user