This commit is contained in:
Zhang.WH
2025-09-03 11:23:19 +08:00
parent 00208c5f79
commit 155df0c917
46 changed files with 5 additions and 6038 deletions

View File

@@ -3,23 +3,19 @@
*/
package com.openhis.web.doctorstation.controller;
import com.openhis.web.doctorstation.appservice.IDoctorStationElepPrescriptionService;
import com.openhis.web.doctorstation.dto.*;
import com.openhis.web.ybmanage.service.IYbEleHttpService;
import org.apache.ibatis.annotations.Param;
import java.util.List;
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.AdviceOpType;
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
import com.openhis.web.doctorstation.appservice.IDoctorStationElepPrescriptionService;
import com.openhis.web.doctorstation.dto.DeletePrescriptionInfoParam;
import com.openhis.web.doctorstation.dto.ElepPrescriptionInfoParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* 医生站-电子处方 controller
*/

View File

@@ -1,92 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* 本地部署方案-医保配置类
*
* @author SunJQ
* @date 2025-04-11
*/
@Configuration
@ConstructorBinding
@PropertySource("classpath:properties/yb.properties")
@ConfigurationProperties(prefix = "ybapp.config")
@EnableConfigurationProperties
public class YbServiceConfig {
private String url;
private String eleUrl;
private String key;
private String timeOut;
private String clrOptins;// 清算机构必须是准确的6位编码可以从3206A交易获取
private String fixmedinsCode;// 定点医药机构编号,如H22010200XXX
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getEleUrl() {
return eleUrl;
}
public void setEleUrl(String eleUrl) {
this.eleUrl = eleUrl;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getTimeOut() {
return timeOut;
}
public void setTimeOut(String timeOut) {
this.timeOut = timeOut;
}
public YbServiceConfig(String url, String key, String timeOut) {
this.url = url;
this.key = key;
this.timeOut = timeOut;
}
public YbServiceConfig() {}
public String getClrOptins() {
return clrOptins;
}
public void setClrOptins(String clrOptins) {
this.clrOptins = clrOptins;
}
public String getFixmedinsCode() {
return fixmedinsCode;
}
public void setFixmedinsCode(String fixmedinsCode) {
this.fixmedinsCode = fixmedinsCode;
}
}

View File

@@ -1,785 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.controller;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.SecurityUtils;
import com.core.common.utils.StringUtils;
import com.openhis.administration.domain.Encounter;
import com.openhis.administration.domain.Patient;
import com.openhis.administration.service.IEncounterService;
import com.openhis.administration.service.IPatientService;
import com.openhis.clinical.domain.ConditionDefinition;
import com.openhis.clinical.service.IConditionDefinitionService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.financial.domain.Contract;
import com.openhis.financial.service.IContractService;
import com.openhis.web.ybmanage.dto.Financial3202WebParam;
import com.openhis.web.ybmanage.dto.FinancialHand3203AWebParam;
import com.openhis.web.ybmanage.service.IYbService;
import com.openhis.yb.domain.FinancialApplyRecord;
import com.openhis.yb.domain.InfoPerson;
import com.openhis.yb.dto.*;
import com.openhis.yb.service.IPerinfoService;
import com.openhis.yb.service.YbDao;
import com.openhis.yb.service.YbHttpUtils;
import com.openhis.yb.util.CommonConstant;
/**
* 医保接口
*
* @author SunJQ
* @date 2025-04-11
*/
@RestController
@RequestMapping("/yb-request")
public class YbController {
@Autowired
YbDao ybDao;
@Autowired
YbHttpUtils ybHttpUtils;
@Autowired
IPatientService patientService;
@Autowired
IPerinfoService iPerinfoService;
@Autowired
IEncounterService iEncounterService;
@Autowired
IContractService iContractService;
@Autowired
IConditionDefinitionService iConditionDefinitionService;
@Autowired
ResourceLoader resourceLoader;
@Autowired
IYbService ybService;
/**
* 【9001】
*
* @param practitionerId 参与者Id
* @param mac 加密后的mac地址
* @return 结果
*/
@PostMapping("/sign")
public R<?> sign(String practitionerId, String mac, String ip) {
Sign signParam = ybDao.getSignParam(practitionerId, mac, ip);
if (signParam == null) {
throw new ServiceException("未生成签到参数");
}
List<Contract> contractList = iContractService.getContractListByYb();
List<Sign9001Result> signResultList = new ArrayList<>();
for (Contract contract : contractList) {
Sign9001Result signResult = ybHttpUtils.sign(signParam, contract);
if (signResult != null) {
ybDao.saveSign(signParam, signResult);
signResultList.add(signResult);
}
}
if (contractList.size() == signResultList.size()) {
return R.ok("签到成功");
} else {
return R.fail("签到失败");
}
}
/**
* 【1101】
*
* @param certType 就诊id
* @param certNo 租户id
* @return 结果
*/
@PostMapping("/per-info")
public R<?> getPerInfo(String certType, String certNo, String psnCertType) {
Info1101ReadcardParam readcard = ybDao.getReadCard(certType, certNo);
Info1101Output perInfo = ybHttpUtils.getPerInfo(readcard);
if (perInfo != null) {
ybDao.saveReadcardAndPerinfo(readcard, perInfo);
PatientInfoDto patient = ybDao.getPatent(perInfo);
return R.ok(patient);
} else {
return R.fail("未查询到患者信息");
}
}
/**
* 【5301】获取人员慢病
*
* @param encounterId 就诊id
* @return 结果
*/
@GetMapping("/getConditionDefinition")
public R<?> getSpecialDia(Long encounterId) {
Encounter encounter = iEncounterService.getById(encounterId);
if (encounter == null) {
throw new ServiceException("未获取到就诊信息");
}
Patient patient = patientService.getById(encounter.getPatientId());
if (patient == null) {
throw new ServiceException("未获取到患者信息");
}
InfoPerson perinfo =
iPerinfoService.getPerInfoByIdCard(patient.getIdCard(), SecurityUtils.getLoginUser().getTenantId());
if (perinfo == null) {
throw new ServiceException("未连接医保获取患者信息");
}
Info1101Output info1101Output = JSON.parseObject(perinfo.getResult1101(), Info1101Output.class);
List<Info5301SpecialConditionResult> feedetail = info1101Output.getFeedetail();
Date currentDate = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Info5301SpecialConditionResult> currentRangeResults = new ArrayList<>();
for (Info5301SpecialConditionResult info5301SpecialConditionResult : feedetail) {
try {
Date begndate = dateFormat.parse(info5301SpecialConditionResult.getBegndate());
Date enddate = dateFormat.parse(info5301SpecialConditionResult.getEnddate());
// 检查当前日期是否在 begndate 和 enddate 之间
if (currentDate.compareTo(begndate) >= 0 && currentDate.compareTo(enddate) <= 0) {
currentRangeResults.add(info5301SpecialConditionResult);
}
} catch (ParseException e) {
e.printStackTrace(); // 处理日期解析异常
}
}
List<ConditionDefinition> conditionDefinitions = null;
if (!currentRangeResults.isEmpty()) {
conditionDefinitions = iConditionDefinitionService.list(
new LambdaUpdateWrapper<ConditionDefinition>().in(ConditionDefinition::getYbNo, currentRangeResults
.stream().map(Info5301SpecialConditionResult::getOpspDiseCode).collect(Collectors.toList())));
}
return R.ok(conditionDefinitions);
}
/**
* 【3301】目录对照
*
* @param tableName 就诊id
* @param id 付款id
* @return 结果
*/
@PostMapping("/directory-cross-check")
public R<?> directoryCheck(String tableName, Long id) {
MedicalDirectory3301Param medicalDirectory3301Param = ybDao.getMedicalDirectory3301Param(tableName, id);
ArrayList<MedicalDirectory3301Param> list = new ArrayList<>();
list.add(medicalDirectory3301Param);
MedicalDirectory3301ListParam medicalDirectory3301ListParam = new MedicalDirectory3301ListParam();
medicalDirectory3301ListParam.setData(list);
Result resultInfo = ybHttpUtils.directoryCheck(medicalDirectory3301ListParam);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveDirectoryHistory(tableName, id, 3301, medicalDirectory3301Param);
}
return R.ok();
}
/**
* 【3302】目录对照撤销
*
* @param tableName 就诊id
* @param id 付款id
* @return 结果
*/
@PostMapping("/directory-un-check")
public R<?> directoryUnCheck(String tableName, Long id) {
MedicalDirectory3302Param medicalDirectory3302Param = ybDao.getMedicalDirectory3302Param(tableName, id);
Result resultInfo = ybHttpUtils.directoryUnCheck(medicalDirectory3302Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveDirectoryHistory(tableName, id, 3302, medicalDirectory3302Param);
}
return R.ok();
}
/**
* 【3201】对总账
*
* @param settlement3201WebParam 3201入参条件
* @return 结果
*/
@PostMapping("/reconcile")
public R<?> reconcileGeneralLedger(@RequestBody Settlement3201WebParam settlement3201WebParam) {
Financial3201Param financial3201Param = ybDao.getFinancial3201Param(settlement3201WebParam);
Result result = ybHttpUtils.reconcileGeneralLedger(financial3201Param);
if (result.getCode().equals(CommonConstant.SC_OK_200)) {
// System.out.println(JSON.parseObject(JSON.toJSONString(result.getResult())));
Financial3201Output financial3201Output =
JSON.parseObject(JSON.toJSONString(result.getResult()), Financial3201Output.class);
ybDao.saveReconcileGeneralLedger(financial3201Output, financial3201Param);
if ("0".equals(financial3201Output.getStmtRslt())) {
return R.ok("OK");
}
return R.ok(financial3201Output.getStmtRsltDscr());
}
return R.fail("医保app通讯失败");
}
/**
* 【3201】对总账列表
*
* @param settlement3201WebParam 3201入参条件
* @return 结果
*/
@GetMapping("/reconcile-list")
public R<?> reconcileGeneralLedgerList(Settlement3201WebParam settlement3201WebParam) {
return R.ok(ybDao.reconcileGeneralLedgerDetail(settlement3201WebParam));
}
/**
* 【3202】对明细账
*
* @param settlement3202WebParam 3202查询数据
* @return 结果
*/
@PostMapping("/reconcile-detail-list")
public R<?> reconcileGeneralLedgerDetail(@RequestBody Settlement3202WebParam settlement3202WebParam) {
List<Financial3202FileParam> financial3202FileParams = ybDao.paymentCompareYbSettle(settlement3202WebParam);
// FinancialSettlement3202Param financial3202Param =
// ybDao.getFinancialSettlement3202Param(settlement3202WebParam);
// FinancialSettlement3202Result resultInfo = ybHttpUtils.reconcileGeneralLedgerDetail(financial3202Param);
return R.ok(financial3202FileParams);
}
/**
* 【3202】生成txt文件
*
* @param financial3202WebParam 3202查询数据
* @return 结果
*/
@PostMapping("/reconcile-detail-txt")
public void reconcileGeneralLedgerDetailTxt(@RequestBody Financial3202WebParam financial3202WebParam,
HttpServletResponse response) throws IOException {
List<Financial3202FileParam> financial3202FileParams =
ybDao.paymentCompareYbSettle(financial3202WebParam.getSettlementIdList());
// String filePath = SecurityUtils.getLoginUser().getOptionJson().getString("filePath")+new
// Date().getTime()+".txt";
// String filePath = "C:\\Users\\bjbUser\\Desktop\\"+new Date().getTime()+".txt";
// try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
// for (Financial3202FileParam item : financial3202FileParams) {
// // 假设每个实体都有toString()方法返回逗号分隔的属性
// // 或者你可以自定义获取属性的方式
// System.out.println(item.toString());
// String line = item.getTxt();
// writer.write(line);
// writer.newLine();
// }
// }
// return R.ok("生成txt文件成功文件路径"+filePath);
// 2. 设置响应头(强制下载,指定文件名)
String fileName = "financial_report_" + System.currentTimeMillis() + ".txt";
response.setContentType("application/octet-stream");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition",
"attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8").replace("+", "%20") + "\"");
// 3. 直接通过输出流写入数据(避免创建临时文件)
try (OutputStream os = response.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) {
for (Financial3202FileParam item : financial3202FileParams) {
writer.write(item.getTxt()); // 写入每行数据
writer.newLine(); // 换行
}
writer.flush();
}
System.out.println(fileName);
// return R.ok("生成txt文件成功文件名称"+fileName);
}
/**
*
* @param file 文件流
* @param filename 文件名
* @return
*/
@PostMapping(value = "/file-up")
public R<?> uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("filename") String filename) {
// 1. 基础校验
if (file.isEmpty()) {
return R.fail("文件不能为空");
}
if (!file.getOriginalFilename().endsWith(".zip")) {
return R.fail("仅支持ZIP格式文件");
}
// 2. 调用Service处理业务逻辑
try {
ResponseEntity<String> fileResult = ybHttpUtils.upload9101(file, filename);
return R.ok(fileResult);
} catch (Exception e) {
return R.fail("处理失败: " + e.getMessage());
}
}
/**
* 触发3202接口
*
* @param settlementIdList 3202查询数据
* @return
* @throws IOException
*/
@PostMapping("/reconcile-general")
public R<?> reconcileGeneral(List<String> settlementIdList, String filePath, String fileQuryNo, String setlOptins,
String clrType) {
// todo:这里需要考虑3302接口的参数是后台合计还是由前台传入因为这个参数还要和txt文件对应既需要txt中的数据还需要db表中的一些数据
// String filePath = SecurityUtils.getLoginUser().getOptionJson().getString("filePath")+new
// Date().getTime()+".txt";
List<Financial3202FileParam> financial3202FileParamList = new ArrayList<>();
Resource resource = resourceLoader.getResource(filePath); // 或使用 "file:" 读取绝对路径
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
if (!line.trim().isEmpty()) {
String[] fields = line.split("\t"); // 按 Tab 分割字段
if (fields.length == 7) {
BigDecimal medfeeSumamt = new BigDecimal(fields[3]);
BigDecimal fundPaySumamt = new BigDecimal(fields[4]);
BigDecimal acctPay = new BigDecimal(fields[5]);
Financial3202FileParam person = new Financial3202FileParam(fields[0], fields[1], fields[2],
medfeeSumamt, fundPaySumamt, acctPay, fields[6]);
financial3202FileParamList.add(person);
}
}
}
} catch (IOException e) {
e.printStackTrace();
throw new ServiceException("IO异常异常信息" + e.getMessage());
}
BigDecimal medfeeSumamt = BigDecimal.ZERO;// 医疗费总额
BigDecimal fundPaySumamt = BigDecimal.ZERO;// 基金支付
// Integer fixmedinsSetlCnt = 0;//结算笔数
if (financial3202FileParamList.isEmpty()) {
throw new ServiceException("未获取txt文件中实体");
}
for (Financial3202FileParam financial3202FileParam : financial3202FileParamList) {
medfeeSumamt = medfeeSumamt.add(financial3202FileParam.getMedfeeSumamt());
fundPaySumamt = fundPaySumamt.add(financial3202FileParam.getFundPaySumamt());
}
FinancialSettlement3202Param financialSettlement3202Param =
ybDao.getFinancialSettlement3202Param(settlementIdList, medfeeSumamt, fundPaySumamt);
if (financialSettlement3202Param == null) {
throw new ServiceException("未生成3202参数");
}
financialSettlement3202Param.setClrType(clrType).setFileQuryNo(fileQuryNo)
.setRefdSetlFlag(financial3202FileParamList.get(0).getRefdSetlFlag()).setSetlOptins(setlOptins);
FinancialSettlement3202Result financialSettlement3202Result =
ybHttpUtils.reconcileGeneralLedgerDetail(financialSettlement3202Param);
if (financialSettlement3202Result == null) {
throw new ServiceException("未收到3202参数");
}
return R.ok(financialSettlement3202Result);
}
/**
* 【3209A】第三方数据查询
*
* @param settlement3209AWebParam 3209A入参条件
* @return 结果
*/
@PostMapping("/three-part-search-err")
public R<?> threePartSearch(Settlement3209AWebParam settlement3209AWebParam) {
FinancialSettlement3209AParam financialSettlement3209AParam =
ybDao.getFinancialSettlement3209AParam(settlement3209AWebParam);
List<FinancialSettlement3209AResult> list = ybHttpUtils.threePartSearch(financialSettlement3209AParam);
return R.ok();
}
/**
* 【3203A】清算申请(吉林省)
*
* @param financial3203AWebParam 3203A入参条件
* @return 结果
*/
@PostMapping("/apply-financial-clearing")
public R<?> applyFinancialClearing(@RequestBody Financial3203AWebParam financial3203AWebParam) {
Financial3203AParam financial3203AParam = ybDao.getFinancial3203AParam(financial3203AWebParam);
String s = ybHttpUtils.applyFinancialClearing(financial3203AParam);
if (!StringUtils.isEmpty(s)) {
Result<?> result = JSON.parseObject(s, Result.class);
if (result != null) {
if (result.getCode() == 200) {
ybDao.save3203AFinancialClearingApplycation(financial3203AParam,
String.valueOf(result.getResult()));
return R.ok(result);
}
}
}
return R.fail(s);
}
/**
* 【3203A】清算申请(吉林省)
*
* @param financialClearing3203AWebParam 3203A入参条件
* @return 结果
*/
@PostMapping("/auto-apply-financial-clearing")
public R<?> autoApplyFinancialClearing(@RequestBody FinancialClearing3203AWebParam financialClearing3203AWebParam) {
Settlement3202WebParam settlement3202WebParam = new Settlement3202WebParam();
settlement3202WebParam.setStmtBegnDate(String.valueOf(financialClearing3203AWebParam.getStmtBegnDate()));
settlement3202WebParam.setStmtEndDate(String.valueOf(financialClearing3203AWebParam.getStmtEndDate()));
settlement3202WebParam.setClrType(financialClearing3203AWebParam.getClrType());
settlement3202WebParam.setSetlOptins(financialClearing3203AWebParam.getSetlOptins());
List<Financial3202FileParam> financial3202FileParams = ybDao.paymentCompareYbSettle(settlement3202WebParam);
Financial3203AParam financial3203AParam = ybDao.getFinancial3203AParam(financial3202FileParams,
String.valueOf(financialClearing3203AWebParam.getStmtBegnDate()),
String.valueOf(financialClearing3203AWebParam.getStmtEndDate()),
financialClearing3203AWebParam.getClrType(), financialClearing3203AWebParam.getSetlOptins());
String s = ybHttpUtils.applyFinancialClearing(financial3203AParam);
if (!StringUtils.isEmpty(s)) {
Result<?> result = JSON.parseObject(s, Result.class);
if (result != null) {
if (result.getCode() == 200) {
ybDao.save3203AFinancialClearingApplycation(financial3203AParam,
String.valueOf(result.getResult()));
return R.ok(result);
}
}
}
return R.fail(s);
}
/**
* 【3203A】手动清算申请(吉林省)
*
* @param financialHand3203AWebParam 3203A入参条件
* @return 结果
*/
@PostMapping("/hand-operated-apply-financial-clearing")
public R<?> handOperatedApplyFinancialClearing(@RequestBody FinancialHand3203AWebParam financialHand3203AWebParam) {
Financial3203AParam financial3203AParam = new Financial3203AParam();
financial3203AParam.setClrType(financialHand3203AWebParam.getClrType());
financial3203AParam.setMedfeeSumamt(financialHand3203AWebParam.getMedfeeSumamt());
financial3203AParam.setMedSumfee(financialHand3203AWebParam.getMedSumfee());
financial3203AParam.setAcctPay(financialHand3203AWebParam.getAcctPay());
financial3203AParam.setCashPayamt(financialHand3203AWebParam.getCashPayamt());
financial3203AParam.setFundAppySum(financialHand3203AWebParam.getFundAppySum());
financial3203AParam.setClrOptins(financialHand3203AWebParam.getClrOptins());
ybDao.getFinancial3203AParamForTime(financial3203AParam,
String.valueOf(financialHand3203AWebParam.getBegndate()),
String.valueOf(financialHand3203AWebParam.getEnddate()));
String s = ybHttpUtils.applyFinancialClearing(financial3203AParam);
if (!StringUtils.isEmpty(s)) {
Result<?> result = JSON.parseObject(s, Result.class);
if (result != null) {
if (result.getCode() == 200) {
ybDao.save3203AFinancialClearingApplycation(financial3203AParam,
String.valueOf(result.getResult()));
return R.ok(result);
}
}
}
return R.fail(s);
}
/**
* 清算申请记录(吉林省)
*
* @param
* @return 结果
*/
@GetMapping("/apply-financial-clearing-list")
public R<?> getApplyFinancialClearingList(@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(ybDao.getFinancial3203APage(searchKey, pageNo, pageSize, request));
}
/**
* 【3204A】清算申请撤销(吉林省)
*
* @param clrAppyEvtId 3203A入参条件
* @return 结果
*/
@GetMapping("/apply-un-clearing")
public R<?> cancelFinancialClearing(String clrAppyEvtId, String clrOptins) {
Financial3204Param financial3204Param = new Financial3204Param();
FinancialApplyRecord financialApplyRecord = ybDao.getFinancial3204ParamByClrAppyEvtId(clrAppyEvtId);
financial3204Param.setClrOptins(clrOptins).setClrAppyEvtId(financialApplyRecord.getOutResult());
Result resultInfo = ybHttpUtils.cancelFinancialClearing(financial3204Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.save3204AFinancialClearingApplycation(clrAppyEvtId, clrOptins);
return R.ok("撤销成功");
}
return R.fail("撤销失败");
}
/**
* 【3205A】清算申请状态查询
*
* @param clearing3205AWebParma 3205A入参条件
* @return 结果
*/
@PostMapping("/get-clearing-status")
public R<?> getFinancialClearingStatus(Clearing3205AWebParma clearing3205AWebParma) {
Clearing3205AParma clearing3205AParma = ybDao.getClearing3205AParma(clearing3205AWebParma);
Clearing3205AResult clearing3205AResult = ybHttpUtils.getFinancialClearingStatus(clearing3205AParma);
return R.ok(clearing3205AResult);
}
/**
* 【3501】商品盘存上传
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/upload-inventory-count")
public R<?> uploadInventoryCount(Long id) {
MedicalInventory3501Param medicalInventory3501Param =
ybDao.getMedicalInventory3501Param(id, SecurityUtils.getLoginUser().getTenantId());
Result resultInfo = ybHttpUtils.uploadInventoryCount(medicalInventory3501Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveInventoryCheckRecord(medicalInventory3501Param, resultInfo.getMessage());
return R.ok();
}
ybDao.saveInventoryCheckRecord(medicalInventory3501Param, resultInfo.getMessage());
return R.fail();
}
/**
* 【3502】商品信息变更
*
* @param id 供应申请id
* @param invChgType 变更类型 参考枚举
* @return 结果
*/
@PostMapping("/upload-inventory")
public R<?> updateInventoryCount(Long id, String invChgType) {
MedicalInventory3502Param medicalInventory3502Param =
ybDao.getMedicalInventory3502Param(id, invChgType, SecurityUtils.getLoginUser().getTenantId());
Result resultInfo = ybHttpUtils.updateInventoryCount(medicalInventory3502Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveInventoryChangeRecord(medicalInventory3502Param, resultInfo.getMessage());
return R.ok();
}
return R.fail();
}
/**
* 【3503】商品采购
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/procurement")
public R<?> procurement(Long id) {
Medical3503Param medical3503Param = ybDao.getMedical3503Param(id, SecurityUtils.getLoginUser().getTenantId());
Result resultInfo = ybHttpUtils.procurement(medical3503Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveInventoryPurchaseRecord(medical3503Param, resultInfo.getMessage());
return R.ok();
}
return R.fail();
}
/**
* 【3504】商品采购退货
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/procurement-cancel")
public R<?> cancelProcurement(Long id) {
MedicalPurchase3504Param medicalPurchase3504Param =
ybDao.getMedicalPurchase3504Param(id, SecurityUtils.getLoginUser().getTenantId());
Result resultInfo = ybHttpUtils.cancelProcurement(medicalPurchase3504Param);
if (resultInfo.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveInventoryPurchaseReturnRecord(medicalPurchase3504Param, resultInfo.getMessage());
return R.ok();
}
return R.fail();
}
/**
* 【3505】商品销售
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/merchandise")
public R<?> merchandise(Long id, String ListType) {
Medical3505Param medical3505Param =
ybDao.getMedical3505Param(id, ListType, SecurityUtils.getLoginUser().getTenantId());
Result result = ybHttpUtils.merchandise(medical3505Param);
Medical3505Result medical3505Result =
JSON.parseObject(JSON.toJSONString(result.getMessage()), Medical3505Result.class);
if ("1".equals(medical3505Result.getRetRslt())) {
ybDao.saveInventorySaleRecord(medical3505Param, medical3505Result.getMsgRslt());
return R.ok();
}
ybDao.saveInventorySaleRecord(medical3505Param, medical3505Result.getMsgRslt());
return R.fail();
}
/**
* 【3506】商品销售退货
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/cancel-merchandise")
public R<?> cancelMerchandise(Long id, String ListType) {
Medical3506Param medical3506Param =
ybDao.getMedical3506Param(id, ListType, SecurityUtils.getLoginUser().getTenantId());
Result result = ybHttpUtils.cancelMerchandise(medical3506Param);
Medical3505Result medical3505Result =
JSON.parseObject(JSON.toJSONString(result.getMessage()), Medical3505Result.class);
if ("1".equals(medical3505Result.getRetRslt())) {
ybDao.saveInventorySaleReturnRecord(medical3506Param, medical3505Result.getMsgRslt());
return R.ok();
}
ybDao.saveInventorySaleReturnRecord(medical3506Param, medical3505Result.getMsgRslt());
return R.fail();
}
/**
* 【3507】商品信息删除
*
* @param id 供应申请id
* @return 结果
*/
@PostMapping("/del-goods")
public R<?> deleteGoodsInfo(Long id, String ListType) {
Medical3507Param medical3507Param = ybDao.getMedical3507Param(id, ListType);
Result resultBody = ybHttpUtils.deleteGoodsInfo(medical3507Param);
if (resultBody.getCode().equals(CommonConstant.SC_OK_200)) {
ybDao.saveInventoryDelRecord(medical3507Param);
return R.ok();
}
return R.fail();
}
/**
* 【3206A】清算机构查询
*
* @return 结果
*/
@GetMapping("/select-clroptins")
public R<?> getClrOptins(String pageNum, String pageSize, String fixmedinsCode) {
Clearing3206AParam clearing3206AParam = new Clearing3206AParam();
clearing3206AParam.setPageNum(Integer.parseInt(pageNum)).setPageSize(Integer.parseInt(pageSize))
.setFixmedinsCode(fixmedinsCode);
Result resultBody = ybHttpUtils.getClrOptins(clearing3206AParam);
if (resultBody.getCode().equals(CommonConstant.SC_OK_200)) {
// ybDao.saveInventoryDelRecord(medical3507Param);
// resultBody.
return R.ok();
}
return R.fail(resultBody);
}
/**
* 【1312】-医保目录信息查询
*
* @param hilistCode 医保目录编码
* @param dateStr 更新时间
* @return 结果
*/
@PostMapping("/query-yb-catalogue")
public R<?> queryYbCatalogue(@RequestParam String hilistCode, @RequestParam String dateStr) {
Catalogue1312QueryParam catalogue1312QueryParam = new Catalogue1312QueryParam();
catalogue1312QueryParam.setHilistCode(hilistCode);
catalogue1312QueryParam.setInsuplcAdmdvs(
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.INSUPLC_ADMDVS));
// 直接解析(默认 ISO 格式)
LocalDate localDate = LocalDate.parse(dateStr);
// 转换为 Date
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
catalogue1312QueryParam.setUpdtTime(date);
catalogue1312QueryParam.setPageNum(1);
catalogue1312QueryParam.setPageSize(10);
catalogue1312QueryParam.setDecryptFlag("0"); // 不需要解密
List<Catalogue1312Output> outputList = ybHttpUtils.queryYbCatalogue(catalogue1312QueryParam);
return R.ok(outputList);
}
/**
* 【3101】明细审核事前事中分析服务
*
* @param encounterId 就诊ID
* @return 结果
*/
@GetMapping("/pre-mid-analysis")
public R<?> yb3101PreMidAnalysis(@RequestParam("encounterId") Long encounterId,
@RequestParam("trigScen") String trigScen) {
return ybService.yb3101PreMidAnalysis(encounterId, trigScen);
}
/**
* 【3103】事前事中服务反馈服务
*
* @param warnRsltId 违规标识
* @param dspoWay 处理方式
* @param dspoWayRea 处理原因
* @return 结果
*/
@GetMapping("/pre-mid-feedback")
public R<?> yb3103PreMidFeedback(@RequestParam("warnRsltId") String warnRsltId,
@RequestParam("dspoWay") String dspoWay,
@RequestParam(value = "dspoWayRea", required = false) String dspoWayRea) {
return ybService.yb3103PreMidFeedback(warnRsltId, dspoWay, dspoWayRea);
}
/**
* 【4101A】医疗保障基金结算清单信息上传
*
* @param paymentId 付款ID
* @return 结果
*/
@GetMapping("/upload-fund-settle")
public R<?> yb4101aUploadFundSettle(@RequestParam("paymentId") Long paymentId) {
return ybService.yb4101aUploadFundSettle(paymentId);
}
}

View File

@@ -1,118 +0,0 @@
package com.openhis.web.ybmanage.dto;
import java.io.Serializable;
import java.util.Date;
import com.core.common.core.domain.HisBaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 【1312】医保目录信息查询
*
* @author SunJQ
* @date 2025-04-16
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Catalogue1312Output extends HisBaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
// 医保目录编码
private String hilistCode;
// 医保目录名称
private String hilistName;
// 参保机构医保区划
private String insuAdmdvs;
// 开始日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date begndate;
// 结束日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date enddate;
// 医疗收费项目类别
private String medChrgitmType;
// 收费项目等级
private String chrgitmLv;
// 限制使用标志
private String lmtUsedFlag;
// 目录类别
private String listType;
// 医疗使用标志
private String medUseFlag;
// 生育使用标志
private String matnUsedFlag;
// 医保目录使用类别
private String hilistUseType;
// 限复方使用类型
private String lmtCpndType;
// 五笔助记码
private String wubi;
// 拼音助记码
private String pinyin;
// 备注
private String memo;
// 有效标志
private String valiFlag;
// 唯一记录号
private String rid;
// 更新时间
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updtTime;
// 创建人
private String crterId;
// 创建人姓名
private String crterName;
// 创建时间
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date crteTime;
// 创建机构
private String crteOptinsNo;
// 经办人
private String opterId;
// 经办人姓名
private String opterName;
// 经办时间
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date optTime;
// 经办机构
private String optinsNo;
// 统筹区
private String poolareaNo;
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
/**
* 【3205A】前端入参
*
* @author SunJQ
* @date 2025-04-17
*/
@Data
public class Clearing3205AWebParam {
// 清算机构
@NotNull
private String clrOptins;
// 清算状态
private String clrStas;
// 清算月份 例如202310
private String clrYm;
}

View File

@@ -1,114 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.openhis.yb.dto.Clinic2206FundPaymentResult;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 【2207】医保预结算的输出参数
*
* @author SunJQ
* @date 2025-05-08
*/
@Data
@Accessors(chain = true)
public class Clinic2207OrderOutput {
// 主键字段
private String mdtrtId; // 就诊ID
private String setlId;// 结算id 2207时有值 2206无值
private String psnNo; // 人员编号
private String psnName; // 人员姓名
private String psnCertType; // 人员证件类型
private String certno; // 证件号码
private String gend; // 性别
private String naty; // 民族
private Date brdy; // 出生日期
private BigDecimal age; // 年龄
private String insutype; // 险种类型
private String psnType; // 人员类别
private String cvlservFlag; // 公务员标志
private Date setlTime; // 结算时间
private String mdtrtCertType; // 就诊凭证类型
private String medType; // 医疗类别
private BigDecimal medfeeSumamt; // 医疗费总额
private BigDecimal fulamtOwnpayAmt; // 全自费金额
private BigDecimal overlmtSelfpay; // 超限价自费费用
private BigDecimal preselfpayAmt; // 先行自付金额
private BigDecimal inscpScpAmt; // 符合政策范围金额
private BigDecimal actPayDedc; // 实际支付起付线
private BigDecimal hifpPay; // 基本医疗保险统筹基金支出
private BigDecimal poolPropSelfpay; // 基本医疗保险统筹基金支付比例
private BigDecimal cvlservPay; // 公务员医疗补助资金支出
private BigDecimal hifesPay; // 企业补充医疗保险基金支出
private BigDecimal hifmiPay; // 居民大病保险资金支出
private BigDecimal hifobPay; // 职工大额医疗费用补助基金支出
private BigDecimal mafPay; // 医疗救助基金支出
private BigDecimal othPay; // 其他支出
private BigDecimal fundPaySumamt; // 基金支付总额
private BigDecimal psnPartAmt; // 个人负担总金额
private BigDecimal acctPay; // 个人账户支出
private BigDecimal psnCashPay; // 个人现金支出
private BigDecimal hospPartAmt; // 医院负担金额
private BigDecimal balc; // 余额
private BigDecimal acctMulaidPay; // 个人账户共济支付金额
private String medinsSetlId; // 医药机构结算ID 存放发送方报文ID
private String clrOptins; // 清算经办机构
private String clrWay; // 清算方式
private String clrType; // 清算类别
private BigDecimal hifdmPay; // 伤残人员医疗保障基金支出
private String expContent; // 字段扩展
private List<Clinic2206FundPaymentResult> setldetail;// 结算详细信息
private String chrgBchno; // 收费批次号
}

View File

@@ -1,109 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openhis.yb.dto.Clinic2206FundPaymentResult;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 【2208】门诊结算撤销
*
* @author SunJQ
* @date 2025-04-21
*/
@Data
@Accessors(chain = true)
public class Clinic2208UnSetlInfoOutput {
// 1. 就诊ID字符型30位必填
private String mdtrtId;
// 2. 结算ID字符型30位必填
private String setlId;
// 3. 清算经办机构字符型6位
private String clrOptins;
// 4. 结算时间日期时间型格式yyyy-MM-dd HH:mm:ss必填
private Date setlTime;
// 5. 医疗费总额数值型16位含2位小数必填
private BigDecimal medfeeSumamt;
// 6. 全自费金额数值型16位含2位小数必填
private BigDecimal fulamtOwnpayAmt;
// 7. 超限价自费费用数值型16位含2位小数必填
private BigDecimal overlmtSelfpay;
// 8. 先行自付金额数值型16位含2位小数必填
private BigDecimal preselfpayAmt;
// 9. 符合政策范围金额数值型16位含2位小数必填
private BigDecimal inscpScpAmt;
// 10. 实际支付起付线数值型16位含2位小数
private BigDecimal actPayDedc;
// 11. 基本医疗保险统筹基金支出数值型16位含2位小数必填
private BigDecimal hifpPay;
// 12. 统筹基金支付比例数值型5位含4位小数必填
private BigDecimal poolPropSelfpay;
// 13. 公务员医疗补助支出数值型16位含2位小数必填
private BigDecimal cvlservPay;
// 14. 企业补充医保支出数值型16位含2位小数必填
private BigDecimal hifesPay;
// 15. 居民大病保险支出数值型16位含2位小数必填
private BigDecimal hifmiPay;
// 16. 职工大额医疗补助支出数值型16位含2位小数必填
private BigDecimal hifobPay;
// 17. 医疗救助基金支出数值型16位含2位小数必填
private BigDecimal mafPay;
// 18. 其他支出数值型16位含2位小数必填
private BigDecimal othPay;
// 19. 基金支付总额数值型16位含2位小数必填
private BigDecimal fundPaySumamt;
// 20. 个人负担总金额数值型16位含2位小数必填
private BigDecimal psnPartAmt;
// 21. 个人账户支出数值型16位含2位小数必填
private BigDecimal acctPay;
// 22. 余额数值型16位含2位小数必填
private BigDecimal balc;
// 23. 个人账户共济支付数值型16位含2位小数必填
private BigDecimal acctMulaidPay;
// 24. 医院负担金额数值型16位含2位小数必填
private BigDecimal hospPartAmt;
// 25. 医药机构结算ID字符型30位必填
private String medinsSetlId;
// 26. 个人现金支出数值型16位含2位小数必填
private BigDecimal pdnCashPay;
// 27. 伤残人员医疗补助支出数值型16位含2位小数必填
private BigDecimal hifdmPay;
//结算详细信息
private List<Clinic2206FundPaymentResult> setldetail;//结算详细信息
}

View File

@@ -1,67 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Accessors(chain = true)
public class ClinicReg2201Output {
private static final long serialVersionUID = 1L;
//主键
@TableId(type = IdType.ASSIGN_ID)
@JSONField(serialize=false)
private String id;
//就诊ID
private String mdtrtId;
//参保地医保区划
@JSONField(serialize=false)
private String insuplcAdmdvs;
//人员编号
private String psnNo;
//险种类型
private String insutype;
//医疗类别
@JSONField(serialize=false)
private String medType;
//挂号时间
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date begntime;
//就诊凭证类型
private String mdtrtCertType;
//就诊凭证编号
private String mdtrtCertNo;
//证件加密串
@JSONField(serialize=false)
@TableField(exist = false)
private String mdtrtCertNoEncrypt;
//住院/门诊号
private String iptOtpNo;
//医师编码
private String atddrNo;
//医师姓名
private String drName;
//科室编码
private String deptCode;
//科室名称
private String deptName;
//科别
private String caty;
//挂号费
private Double regFee;
//检查费
private Double checkFee;
//应收金额
private Double totalFee;
//状态,0-挂号,1-看诊2-费用明细3-预结算4-结算
private String status;
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
/**
* 【13202】前台入参
*
* @author SunJQ
* @date 2025-04-29
*/
@Data
public class Financial13203WebParam {
// 对账日期格式YYYY-MM-DD
@JSONField(name = "stmt_date")
private String stmtDate;
// 明细对账结果1不平0
@JSONField(name = "stmt_rslt")
private String stmtRslt;
// 查询页面数据量最大100
@JSONField(name = "page_size")
private String pageSize;
// 页数默认1
@JSONField(name = "page_num")
private String pageNum;
// 清算机构编码
@JSONField(name = "clr_optins")
private String clrOptins;
// 清算类别
@JSONField(name = "clr_type")
private String clrType;
// 险种
@JSONField(name = "insutype")
private String insutype;
// 就医类别2本地就医3省内异地就医4跨省就医
@JSONField(name = "clr_pay_loc")
private String clrPayLoc;
}

View File

@@ -1,10 +0,0 @@
package com.openhis.web.ybmanage.dto;
import lombok.Data;
import java.util.List;
@Data
public class Financial3202WebParam {
List<String> settlementIdList;
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.hssf.record.chart.DatRecord;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
* 【3203A】前台入参
*
* @author SunJQ
* @date 2025-04-15
*/
@Data
@Accessors(chain = true)
public class Financial3203AWebParam {
/** 清算类别 */
@NotNull
private String clrType;
/** 开始时间 */
@NotNull
private Date stmtBegnDate;
/** 结束时间 */
@NotNull
private Date stmtEndDate;
/** 清算机构 */
@NotNull
private String clrOptins;
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 【3203】前台入参
*
* @author SunJQ
* @date 2025-04-29
*/
@Data
public class Financial3203WebParam {
// 清算类别字符型30位必填
@JSONField(name = "clr_type")
private String clrType;
// 清算方式字符型30位必填
@JSONField(name = "clr_way")
private String clrWay;
// 开始日期日期型必填格式yyyy-MM-dd
@JSONField(name = "begndate")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date begndate;
// 结束日期日期型必填格式yyyy-MM-dd
@JSONField(name = "enddate")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date enddate;
// 清算年月
@JSONField(name = "setlym")
private String setlym;
}

View File

@@ -1,33 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class FinancialHand3203AWebParam {
@NotEmpty
private String clrType;//险种类型
@NotNull
private BigDecimal medfeeSumamt;//医疗费总额
@NotNull
private BigDecimal medSumfee;//医保认可费用总额0.00
@NotNull
private BigDecimal fundAppySum;//基金支付金额
@NotNull
private BigDecimal cashPayamt;//现金金额
@NotNull
private BigDecimal acctPay;//账户金额
@NotNull
private String begndate;//开始时间
@NotNull
private String enddate;//结束时间
@NotEmpty
private String clrOptins; // 必须是准确的6位编码
}

View File

@@ -1,70 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.core.common.core.domain.HisBaseEntity;
import com.openhis.yb.dto.Info5301SpecialConditionResult;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*【1101】获取身份信息
*
* @author SunJQ
* @date 2025-04-16
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Info1101Output extends HisBaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
//人员编号
private String psnNo;
//人员证件类型
private String psnCertType;
//证件号码
private String certno;
//人员姓名
private String psnName;
//性别
private String gend;
//民族
private String naty;
//出生日期
private Date brdy;
//年龄
private Double age;
//参保地医保区划
private String insuplcAdmdvs;
//险种类型
private String insutype;
//余额
private String balc;
//人员类别
@TableField(exist = false)
private String psnType;
//人员参保状态
@TableField(exist = false)
private String psnInsuStas;
//个人参保日期
@TableField(exist = false)
private String psnInsuDate;
//公务员标志
@TableField(exist = false)
private String cvlservFlag;
//单位名称
@TableField(exist = false)
private String empName;
//特慢病
@TableField(exist = false)
private List<Info5301SpecialConditionResult> feedetail;
}

View File

@@ -1,85 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.yb.dto.Info5301SpecialConditionResult;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
@Data
@Accessors(chain = true)
public class PatientInfoDto {
//患者信息
/** ID */
@TableId(type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 活动标记 */
private Integer activeFlag;
/** 临时标识 */
private Integer tempFlag;
/** 患者姓名 */
private String name;
/** 患者院内编码/病历号 */
private String busNo;
/** 性别编码 */
private Integer genderEnum;
/** 生日 */
private Date birthDate;
/** 民族 */
private String nationalityCode;
/** 身份证号 */
private String idCard;
/** 拼音码 */
private String pyStr;
/** 五笔码 */
private String wbStr;
/** 机构Id */
private Long organizationId;
/** 特慢病等 */
private List<Info5301SpecialConditionResult> feedetail;
//医保信息 2025/05/23 弃用,费用性质固定,如农大只有省医保,费用性质只显示省医保和自费即可,由@GetMapping(value = "/contract-list")接口提供数据
/** 合同Id */
private Long contractId;//弃用 2025/05/23
/** 合同名称 */
private String contractName;//弃用 2025/05/23
/** 状态 */
private Integer statusEnum;//弃用 2025/05/23
/** 合同的类别 */
private Integer categoryEnum;//弃用 2025/05/23
/** 合同编码 */
private String contractBusNo;//弃用 2025/05/23
/** 机构 */
private Long contractOrgId;//弃用 2025/05/23
/** 是否医保 */
private Integer ybFlag;//弃用 2025/05/23
/** 医保区划 */
private String admVs;//弃用 2025/05/23
}

View File

@@ -1,48 +0,0 @@
package com.openhis.web.ybmanage.dto;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="接口返回对象", description="接口返回对象")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean success = true;
/**
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private Integer code = 0;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
/**
* 时间戳
*/
@ApiModelProperty(value = "时间戳")
private long timestamp ;
}

View File

@@ -1,40 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
/**
* 医保结果
*/
@Data
public class ResultBody {
/** 交易状态码 */
@JSONField(name="infcode")
private String infcode;
/** 发送方报文ID */
@JSONField(name="warnMsg")
private String warn_msg;
/** 数字签名信息 */
@JSONField(name="cainfo")
private String cainfo;
/** 错误信息 */
@JSONField(name="err_msg")
private String errMsg;
/** 接收报文时间 */
@JSONField(name="refmsg_time")
private String refmsgTime;
/** 签名类型 */
@JSONField(name="signtype")
private String signtype;
/** 响应报文时间 */
@JSONField(name="respond_time")
private String respondTime;
/** 接收方报文ID */
@JSONField(name="inf_refmsgid")
private String infRefmsgid;
/** 交易输出 */
@JSONField(name="output")
private String output;
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
* 【3201】前台入参
*
* @author SunJQ
* @date 2025-04-15
*/
@Data
public class Settlement3201WebParam {
/** 险种 */
@NotNull
private String insuType;
/** 清算类别 */
@NotNull
private String clrType;//住院或门诊
/** 合同id */
@NotNull
private Long contractId;
/** 医院id */
@NotNull
private Long orgId;
/** 开始时间 */
@NotNull
private String stmtBegnDate;
/** 结束时间 */
@NotNull
private String stmtEndDate;
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 【3202】前台入参
*
* @author SunJQ
* @date 2025-04-17
*/
@Data
public class Settlement3202WebParam {
/** 结算经办机构 */
@NotNull
private String setlOptins;//前台传入,注意:先上传文件后核对明细的
/** 清算类别 */
private String clrType;
/** 文件查询号 */
@NotNull
private String fileQuryNo;
/** 开始时间 */
@NotNull
private String stmtBegnDate;
/** 结束时间 */
@NotNull
private String stmtEndDate;
/** 医院id */
private Long orgId;
// /** 医疗费用总额 */
// @NotNull
// private BigDecimal medFeeSumAmt;
// /** 基金支付总额 */
// @NotNull
// private BigDecimal fundPaySumAmt;
// /** 现金支付金额 */
// @NotNull
// private BigDecimal cashPayAmt;
// /** 定点医药机构结算笔数 */
// @NotNull
// private Integer fixMedInsSetlCnt;
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
import java.util.Date;
/**
* [3209A]前台传参
*
* @author SunJQ
* @date 2025-04-29
*/
@Data
public class Settlement3209AWebParam {
// 清算类别
@JSONField(name = "clr_type")
private String clrType;
// 开始日期
@JSONField(name = "begndate")
private Date begndate;
// 结束日期
@JSONField(name = "enddate")
private Date enddate;
// 清算机构
@JSONField(name = "clr_optins")
private String clrOptins;
}

View File

@@ -1,98 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 医保电子处方信息
*
* @author yuxj
* @date 2025-05-06
*/
@Data
@Accessors(chain = true)
public class VeriPrescriptionDetailInfoDto {
/** 处方号 */
private String prescriptionNo;
/** 门诊号 */
private String iptOtpNo;
/** 请求数量 */
private Integer quantity;
/** 请求单位 */
private String unitCode;
/** 审核状态 */
private Integer statusEnum;
private String statusEnum_enumText;
/* --处方信息-- */
/** 药品名 */
private String medicationName;
/** 药品规格 */
private String drugSpecification;
/** 药品剂量 */
private BigDecimal medDosage;
/** 药品剂量单位 */
private String medDosageUnitCode;
/** 使用频次 */
@Dict(dictCode = "elep_rate_code")
private String medFrequency;
private String medFrequency_dictText;
/** 途径 */
@Dict(dictCode = "method_code")
private String medRoute;
private String medRoute_dictText;
/** 取药状态 */
private String medStatus;
/** 处方状态 */
private String prescriptionStatus;
/** 处方类别 */
private Integer rxTypeCode;
private String rxTypeCode_enumText;
/** 支持用药信息 */
private String supportInfo;
/** 服药时间(开始) */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveDoseStart;
/** 服药时间(结束) */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveDoseEnd;
/** 给药间隔 */
private String dispenseInterval;
/** 单次发药数 */
private Integer dispensePerQuantity;
/** 每次发药供应天数 */
private Integer dispensePerDuration;
/* --就诊信息-- */
/** 患者姓名 */
private String patnName;
/** 身份证号 */
private String certno;
/** 开方医生名 */
private String practitionerName;
/** 挂号科室 */
private String mdtrtDeptName;
/** 开单科室 */
private String prscDeptName;
/** 挂号日期 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date mdtrtTime;
/** 处方开立日期 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date prscTime;
/* --诊断信息-- */
/** 诊断名 */
private String conditionName;
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import java.util.Date;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 医保电子处方信息
*
* @author yuxj
* @date 2025-05-06
*/
@Data
@Accessors(chain = true)
public class VeriPrescriptionInfoDto {
/** 处方号 */
private String prescriptionNo;
/** 门诊号 */
private String iptOtpNo;
/** 姓名 */
private String patientName;
/** 证件号 */
private String certno;
/** 取药状态 */
private String medStatus;
/** 状态 */
private Integer statusEnum;
private String statusEnum_enumText;
/** 开单科室 */
private String prscDeptName;
/** 挂号日期 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date mdtrtTime;
/** 处方开立日期 */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date prscTime;
/** 租户ID */
private Integer tenantId;
/** 电子凭证线上身份核验流水号 */
private String authNo;
/** 电子凭证令牌 */
private String ecToken;
/** 医保处方编号 */
private String hiRxno;
}

View File

@@ -1,23 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 医保电子处方信息查询条件
*
* @author yuxj
* @date 2025-05-06
*/
@Data
@Accessors(chain = true)
public class VeriPrescriptionParam {
/** 门诊号/姓名 */
private String name;
}

View File

@@ -1,196 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
@Data
//@TableName("yb_inpatient_fee_detail") // 替换为实际表名
public class Yb2301FeeDetailParam {
/**
* 费用明细流水号
* 单次就诊内唯一
*/
@JsonProperty("feedetl_sn")
private String feedetlSn;
/**
* 原费用流水号
* 退单时传入被退单的费用明细流水号
*/
@JsonProperty("init_feedetl_sn")
private String initFeedetlSn;
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 医嘱号
*/
@JsonProperty("drord_no")
private String drordNo;
/**
* 人员编号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 医疗类别
*/
@JsonProperty("med_type")
private String medType;
/**
* 费用发生时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JsonProperty("fee_ocur_time")
private Date feeOcurTime;
/**
* 医保目录编码
*/
@JsonProperty("med_list_codg")
private String medListCodg;
/**
* 医药机构目录编码
*/
@JsonProperty("medins_list_codg")
private String medinsListCodg;
/**
* 明细项目费用总额
*/
@JsonProperty("det_item_fee_sumamt")
private BigDecimal detItemFeeSumamt;
/**
* 数量
* 退单时数量填写负数
*/
@JsonProperty("cnt")
private BigDecimal cnt;
/**
* 单价
*/
@JsonProperty("pric")
private BigDecimal pric;
/**
* 开单科室编码
*/
@JsonProperty("bilg_dept_codg")
private String bilgDeptCodg;
/**
* 开单科室名称
*/
@JsonProperty("bilg_dept_name")
private String bilgDeptName;
/**
* 开单医生编码
*/
@JsonProperty("bilg_dr_codg")
private String bilgDrCodg;
/**
* 开单医师姓名
*/
@JsonProperty("bilg_dr_name")
private String bilgDrName;
/**
* 受单科室编码
*/
@JsonProperty("acord_dept_codg")
private String acordDeptCodg;
/**
* 受单科室名称
*/
@JsonProperty("acord_dept_name")
private String acordDeptName;
/**
* 受单医生编码
*/
@JsonProperty("orders_dr_code")
private String ordersDrCode;
/**
* 受单医生姓名
*/
@JsonProperty("orders_dr_name")
private String ordersDrName;
/**
* 医院审批标志
*/
@JsonProperty("hosp_appr_flag")
private String hospApprFlag;
/**
* 中药使用方式
*/
@JsonProperty("tcmdrug_used_way")
private String tcmdrugUsedWay;
/**
* 外检标志
*/
@JsonProperty("etip_flag")
private String etipFlag;
/**
* 外检医院编码
*/
@JsonProperty("etip_hosp_code")
private String etipHospCode;
/**
* 出院带药标志
*/
@JsonProperty("dscg_tkdrug_flag")
private String dscgTkdrugFlag;
/**
* 生育费用标志
*/
@JsonProperty("matn_fee_flag")
private String matnFeeFlag;
/**
* 备注
*/
@JsonProperty("memo")
private String memo;
/**
* 组套编号
*/
@JsonProperty("comb_no")
private String combNo;
/**
* 字段扩展
* 格式JSON
*/
@JsonProperty("exp_content")
private String expContent;
}

View File

@@ -1,124 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class Yb2301InpatientOutput {
/**
* 费用明细流水号
*/
@JsonProperty("feedetl_sn")
private String feedetlSn;
/**
* 明细项目费用总额
*/
@JsonProperty("det_item_fee_sumamt")
private BigDecimal detItemFeeSumamt;
/**
* 数量
*/
@JsonProperty("cnt")
private BigDecimal cnt;
/**
* 单价
*/
@JsonProperty("pric")
private BigDecimal pric;
/**
* 定价上限金额
*/
@JsonProperty("pric_uplmt_amt")
private BigDecimal pricUplmtAmt;
/**
* 自付比例
*/
@JsonProperty("selfpay_prop")
private BigDecimal selfpayProp;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价金额
*/
@JsonProperty("overlmt_amt")
private BigDecimal overlmtAmt;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 收费项目等级
*/
@JsonProperty("chrgitm_lv")
private String chrgitmLv;
/**
* 医疗收费项目类别
*/
@JsonProperty("med_chrgitm_type")
private String medChrgitmType;
/**
* 基本药物标志
*/
@JsonProperty("bas_medn_flag")
private String basMednFlag;
/**
* 医保谈判药品标志
*/
@JsonProperty("hi_nego_drug_flag")
private String hiNegoDrugFlag;
/**
* 儿童用药标志
*/
@JsonProperty("chld_medc_flag")
private String chldMedcFlag;
/**
* 目录特项标志
*/
@JsonProperty("list_sp_item_flag")
private String listSpItemFlag;
/**
* 限制使用标志
*/
@JsonProperty("lmt_used_flag")
private String lmtUsedFlag;
/**
* 直报标志
*/
@JsonProperty("drt_reim_flag")
private String drtReimFlag;
/**
* 备注
*/
@JsonProperty("memo")
private String memo;
}

View File

@@ -1,31 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Yb2302InpatientParam {
/**
* 费用明细流水号
* 单次就诊内唯一
*/
@JsonProperty("feedetl_sn")
private String feedetlSn;
/**
* 人员编号
* 退单时传入被退单的费用明细流水号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 字段扩展
*/
@JsonProperty("exp_content")
private String expContent;
}

View File

@@ -1,258 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Date;
public class Yb2303InpatientOutput {
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 人员编号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 人员姓名
*/
@JsonProperty("psn_name")
private String psnName;
/**
* 人员证件类型
*/
@JsonProperty("psn_cert_type")
private String psnCertType;
/**
* 证件号码
*/
@JsonProperty("certno")
private String certno;
/**
* 性别
*/
@JsonProperty("gend")
private String gend;
/**
* 民族
*/
@JsonProperty("naty")
private String naty;
/**
* 出生日期
* 格式yyyy-MM-dd
*/
@JsonProperty("brdy")
private Date brdy;
/**
* 年龄
*/
@JsonProperty("age")
private BigDecimal age;
/**
* 险种类型
*/
@JsonProperty("insutype")
private String insutype;
/**
* 人员类别
*/
@JsonProperty("psn_type")
private String psnType;
/**
* 公务员标志
*/
@JsonProperty("cvlserv_flag")
private String cvlservFlag;
/**
* 结算时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JsonProperty("setl_time")
private Date setlTime;
/**
* 就诊凭证类型
*/
@JsonProperty("mdtrt_cert_type")
private String mdtrtCertType;
/**
* 医疗类别
*/
@JsonProperty("med_type")
private String medType;
/**
* 医疗费总额
*/
@JsonProperty("medfee_sumamt")
private BigDecimal medfeeSumamt;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价自费费用
*/
@JsonProperty("overlmt_selfpay")
private BigDecimal overlmtSelfpay;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 实际支付起付线
*/
@JsonProperty("act_pay_dedc")
private BigDecimal actPayDedc;
/**
* 基本医疗保险统筹基金支出
*/
@JsonProperty("hifp_pay")
private BigDecimal hifpPay;
/**
* 基本医疗保险统筹基金支付比例
*/
@JsonProperty("pool_prop_selfpay")
private BigDecimal poolPropSelfpay;
/**
* 公务员医疗补助资金支出
*/
@JsonProperty("cvlserv_pay")
private BigDecimal cvlservPay;
/**
* 企业补充医疗保险基金支出
*/
@JsonProperty("hifes_pay")
private BigDecimal hifesPay;
/**
* 居民大病保险资金支出
*/
@JsonProperty("hifmi_pay")
private BigDecimal hifmiPay;
/**
* 职工大额医疗费用补助基金支出
*/
@JsonProperty("hifob_pay")
private BigDecimal hifobPay;
/**
* 医疗救助基金支出
*/
@JsonProperty("maf_pay")
private BigDecimal mafPay;
/**
* 其他支出
*/
@JsonProperty("oth_pay")
private BigDecimal othPay;
/**
* 基金支付总额
*/
@JsonProperty("fund_pay_sumamt")
private BigDecimal fundPaySumamt;
/**
* 个人负担总金额
*/
@JsonProperty("psn_part_amt")
private BigDecimal psnPartAmt;
/**
* 个人账户支出
*/
@JsonProperty("acct_pay")
private BigDecimal acctPay;
/**
* 个人现金支出
*/
@JsonProperty("psn_cash_pay")
private BigDecimal psnCashPay;
/**
* 医院负担金额
*/
@JsonProperty("hosp_part_amt")
private BigDecimal hospPartAmt;
/**
* 余额
*/
@JsonProperty("balc")
private BigDecimal balc;
/**
* 个人账户共济支付金额
*/
@JsonProperty("acct_mulaid_pay")
private BigDecimal acctMulaidPay;
/**
* 医药机构结算ID
* 存放发送方报文ID
*/
@JsonProperty("medins_setl_id")
private String medinsSetlId;
/**
* 清算经办机构
*/
@JsonProperty("clr_optins")
private String clrOptins;
/**
* 清算方式
*/
@JsonProperty("clr_way")
private String clrWay;
/**
* 清算类别
*/
@JsonProperty("clr_type")
private String clrType;
/**
* 伤残人员医疗保障基金支出
* 1.5.4新增
*/
@JsonProperty("hifdm_pay")
private BigDecimal hifdmPay;
}

View File

@@ -1,119 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Date;
public class Yb2303InpatientPram {
/**
* 人员编号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 就诊凭证类型
*/
@JsonProperty("mdtrt_cert_type")
private String mdtrtCertType;
/**
* 就诊凭证编号
* 就诊凭证类型为“01”时填写电子凭证令牌为“02”时填写身份证号为“03”时填写社会保障卡卡号
*/
@JsonProperty("mdtrt_cert_no")
private String mdtrtCertNo;
/**
* 医疗费总额
*/
@JsonProperty("medfee_sumamt")
private BigDecimal medfeeSumamt;
/**
* 个人结算方式
*/
@JsonProperty("psn_setlway")
private String psnSetlway;
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 个人账户使用标志
*/
@JsonProperty("acct_used_flag")
private String acctUsedFlag;
/**
* 险种类型
*/
@JsonProperty("insutype")
private String insutype;
/**
* 参保地医保区划
*/
@JsonProperty("insuplc_admdvs")
private String insuplcAdmdvs;
/**
* 就医地医保区划
*/
@JsonProperty("mdtrtarea_admvs")
private String mdtrtareaAdmvs;
/**
* 发票号
*/
@JsonProperty("invono")
private String invono;
/**
* 中途结算标志
*/
@JsonProperty("mid_setl_flag")
private String midSetlFlag;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价金额
*/
@JsonProperty("overlmt_selfpay")
private BigDecimal overlmtSelfpay;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 出院时间
* 格式yyyy-MM-dd
*/
@JsonProperty("dscgTime")
private Date dscgTime;
/**
* 字段扩展
*/
@JsonProperty("exp_content")
private String expContent;
}

View File

@@ -1,31 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
public class Yb2304InpatientExpContentParam {
/**
* 实际就医区划
*/
@JsonProperty("med_admdvs")
private BigDecimal medAdmdvs;
/**
* 外报就医医院编号
*/
@JsonProperty("med_hosp_no")
private BigDecimal medHospNo;
/**
* 外报就医医院名称
*/
@JsonProperty("med_hosp_name")
private BigDecimal medHospName;
/**
* 外报类型
*/
@JsonProperty("out_submit_type")
private String outSubmitType;
}

View File

@@ -1,279 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Date;
public class Yb2304InpatientOutput {
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 结算ID
*/
@JsonProperty("setl_id")
private String setlId;
/**
* 人员编号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 人员姓名
*/
@JsonProperty("psn_name")
private String psnName;
/**
* 人员证件类型
*/
@JsonProperty("psn_cert_type")
private String psnCertType;
/**
* 证件号码
*/
@JsonProperty("certno")
private String certno;
/**
* 性别
*/
@JsonProperty("gend")
private String gend;
/**
* 民族
*/
@JsonProperty("naty")
private String naty;
/**
* 出生日期
* 格式yyyy-MM-dd
*/
@JsonProperty("brdy")
private Date brdy;
/**
* 年龄
*/
@JsonProperty("age")
private BigDecimal age;
/**
* 险种类型
*/
@JsonProperty("insutype")
private String insutype;
/**
* 人员类别
*/
@JsonProperty("psn_type")
private String psnType;
/**
* 公务员标志
*/
@JsonProperty("cvlserv_flag")
private String cvlservFlag;
/**
* 结算时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JsonProperty("setl_time")
private Date setlTime;
/**
* 就诊凭证类型
*/
@JsonProperty("mdtrt_cert_type")
private String mdtrtCertType;
/**
* 医疗类别
*/
@JsonProperty("med_type")
private String medType;
/**
* 医疗费总额
*/
@JsonProperty("medfee_sumamt")
private BigDecimal medfeeSumamt;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价自费费用
*/
@JsonProperty("overlmt_selfpay")
private BigDecimal overlmtSelfpay;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 实际支付起付线
*/
@JsonProperty("act_pay_dedc")
private BigDecimal actPayDedc;
/**
* 基本医疗保险统筹基金支出
*/
@JsonProperty("hifp_pay")
private BigDecimal hifpPay;
/**
* 基本医疗保险统筹基金支付比例
*/
@JsonProperty("pool_prop_selfpay")
private BigDecimal poolPropSelfpay;
/**
* 公务员医疗补助资金支出
*/
@JsonProperty("cvlserv_pay")
private BigDecimal cvlservPay;
/**
* 企业补充医疗保险基金支出
*/
@JsonProperty("hifes_pay")
private BigDecimal hifesPay;
/**
* 居民大病保险资金支出
*/
@JsonProperty("hifmi_pay")
private BigDecimal hifmiPay;
/**
* 职工大额医疗费用补助基金支出
*/
@JsonProperty("hifob_pay")
private BigDecimal hifobPay;
/**
* 医疗救助基金支出
*/
@JsonProperty("maf_pay")
private BigDecimal mafPay;
/**
* 医院负担金额(原始)
*/
@JsonProperty("hosp_part_amt_old")
private BigDecimal hospPartAmtOld;
/**
* 其他支出
*/
@JsonProperty("oth_pay")
private BigDecimal othPay;
/**
* 基金支付总额
*/
@JsonProperty("fund_pay_sumamt")
private BigDecimal fundPaySumamt;
/**
* 个人负担总金额
*/
@JsonProperty("psn_part_amt")
private BigDecimal psnPartAmt;
/**
* 个人账户支出
*/
@JsonProperty("acct_pay")
private BigDecimal acctPay;
/**
* 个人现金支出
*/
@JsonProperty("psn_cash_pay")
private BigDecimal psnCashPay;
/**
* 余额
*/
@JsonProperty("balc")
private BigDecimal balc;
/**
* 个人账户共济支付金额
*/
@JsonProperty("acct_mulaid_pay")
private BigDecimal acctMulaidPay;
/**
* 医药机构结算ID
* 存放发送方报文ID
*/
@JsonProperty("medins_setl_id")
private String medinsSetlId;
/**
* 清算经办机构
*/
@JsonProperty("clr_optins")
private String clrOptins;
/**
* 清算方式
*/
@JsonProperty("clr_way")
private String clrWay;
/**
* 清算类别
*/
@JsonProperty("clr_type")
private String clrType;
/**
* 字段扩展
* 1.5.4新增
*/
@JsonProperty("exp_content")
private String expContent;
/**
* 伤残人员医疗保障基金支出
* 1.5.4新增
*/
@JsonProperty("hifdm_pay")
private BigDecimal hifdmPay;
/**
* 医院负担金额
* 1.5.4新增
*/
@JsonProperty("hosp_part_amt")
private BigDecimal hospPartAmt;
}

View File

@@ -1,111 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
public class Yb2304InpatientParam {
/**
* 人员编号
*/
@JsonProperty("psn_no")
private String psnNo;
/**
* 就诊凭证类型
*/
@JsonProperty("mdtrt_cert_type")
private String mdtrtCertType;
/**
* 就诊凭证编号
* 就诊凭证类型为“01”时填写电子凭证令牌为“02”时填写身份证号为“03”时填写社会保障卡卡号
*/
@JsonProperty("mdtrt_cert_no")
private String mdtrtCertNo;
/**
* 医疗费总额
*/
@JsonProperty("medfee_sumamt")
private BigDecimal medfeeSumamt;
/**
* 个人结算方式
*/
@JsonProperty("psn_setlway")
private String psnSetlway;
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 险种类型
*/
@JsonProperty("insutype")
private String insutype;
/**
* 个人账户使用标志
*/
@JsonProperty("acct_used_flag")
private String acctUsedFlag;
/**
* 参保地医保区划
*/
@JsonProperty("insuplc_admdvs")
private String insuplcAdmdvs;
/**
* 就医地医保区划
*/
@JsonProperty("mdtrtarea_admvs")
private String mdtrtareaAdmvs;
/**
* 发票号
*/
@JsonProperty("invono")
private String invono;
/**
* 中途结算标志
*/
@JsonProperty("mid_setl_flag")
private String midSetlFlag;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价金额
*/
@JsonProperty("overlmt_selfpay")
private BigDecimal overlmtSelfpay;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 字段扩展
*/
@JsonProperty("exp_content")
private String expContent;
}

View File

@@ -1,221 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Date;
public class Yb2305InpatientOutput {
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private String mdtrtId;
/**
* 结算ID
*/
@JsonProperty("setl_id")
private String setlId;
/**
* 清算经办机构
*/
@JsonProperty("clr_optins")
private String clrOptins;
/**
* 结算时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JsonProperty("setl_time")
private Date setlTime;
/**
* 医疗费总额
*/
@JsonProperty("medfee_sumamt")
private BigDecimal medfeeSumamt;
/**
* 全自费金额
*/
@JsonProperty("fulamt_ownpay_amt")
private BigDecimal fulamtOwnpayAmt;
/**
* 超限价自费费用
*/
@JsonProperty("overlmt_selfpay")
private BigDecimal overlmtSelfpay;
/**
* 先行自付金额
*/
@JsonProperty("preselfpay_amt")
private BigDecimal preselfpayAmt;
/**
* 符合政策范围金额
*/
@JsonProperty("inscp_scp_amt")
private BigDecimal inscpScpAmt;
/**
* 实际支付起付线
*/
@JsonProperty("act_pay_dedc")
private BigDecimal actPayDedc;
/**
* 基本医疗保险统筹基金支出
*/
@JsonProperty("hifp_pay")
private BigDecimal hifpPay;
/**
* 基本医疗保险统筹基金支付比例
*/
@JsonProperty("pool_prop_selfpay")
private BigDecimal poolPropSelfpay;
/**
* 公务员医疗补助资金支出
*/
@JsonProperty("cvlserv_pay")
private BigDecimal cvlservPay;
/**
* 企业补充医疗保险基金支出
*/
@JsonProperty("hifes_pay")
private BigDecimal hifesPay;
/**
* 居民大病保险资金支出
*/
@JsonProperty("hifmi_pay")
private BigDecimal hifmiPay;
/**
* 职工大额医疗费用补助基金支出
*/
@JsonProperty("hifob_pay")
private BigDecimal hifobPay;
/**
* 医疗救助基金支出
*/
@JsonProperty("maf_pay")
private BigDecimal mafPay;
/**
* 其他支出
*/
@JsonProperty("oth_pay")
private BigDecimal othPay;
/**
* 基金支付总额
*/
@JsonProperty("fund_pay_sumamt")
private BigDecimal fundPaySumamt;
/**
* 个人负担总金额
*/
@JsonProperty("psn_part_amt")
private BigDecimal psnPartAmt;
/**
* 个人账户支出
*/
@JsonProperty("acct_pay")
private BigDecimal acctPay;
/**
* 个人现金支出
*/
@JsonProperty("psn_cash_pay")
private BigDecimal psnCashPay;
/**
* 医院负担金额
*/
@JsonProperty("hosp_part_amt")
private BigDecimal hospPartAmt;
/**
* 余额
*/
@JsonProperty("balc")
private BigDecimal balc;
/**
* 个人账户共济支付金额
*/
@JsonProperty("acct_mulaid_pay")
private BigDecimal acctMulaidPay;
/**
* 医药机构结算ID
* 存放发送方报文ID
*/
@JsonProperty("medins_setl_id")
private String medinsSetlId;
/**
* 伤残人员医疗保障基金支出
*/
@JsonProperty("hifdm_pay")
private BigDecimal hifdmPay;
/**
* 人员参保关系ID
*/
@JsonProperty("psn_insu_rlts_id")
private String psnInsuRltsId;
/**
* 参保机构行政区划
*/
@JsonProperty("insu_admdvs")
private String insuAdmdvs;
/**
* 开始日期
*/
@JsonProperty("begndate")
private Date begndate;
/**
* 结算日期
*/
@JsonProperty("enddate")
private Date enddate;
/**
* 就诊凭证编号
*/
@JsonProperty("mdtrt_cert_no")
private String mdtrtCertNo;
/**
* 结算类别
*/
@JsonProperty("setl_type")
private String setlType;
/**
* 本次起付线
*/
@JsonProperty("crt_dedc")
private BigDecimal crtDedc;
/**
* 发票号
*/
@JsonProperty("invono")
private String invono;
}

View File

@@ -1,31 +0,0 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
public class Yb2305InpatientParam {
/**
* 就诊ID
*/
@JsonProperty("mdtrt_id")
private BigDecimal mdtrtId;
/**
* 结算ID
*/
@JsonProperty("setl_Id")
private BigDecimal setlId;
/**
* 人员编号
*/
@JsonProperty("psn_no")
private BigDecimal psnNo;
/**
* 字段扩展
*/
@JsonProperty("exp_content")
private String expContent;
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.mapper;
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.ybmanage.dto.VeriPrescriptionDetailInfoDto;
import com.openhis.web.ybmanage.dto.VeriPrescriptionInfoDto;
import com.openhis.web.ybmanage.dto.VeriPrescriptionParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* mapper提供sql服务
*
* @author yuxj
* @date 2025-05-06
*/
@Repository
public interface YbElepMapper {
/**
* 医保电子处方查询
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 就诊病人列表
*/
Page<VeriPrescriptionInfoDto> getVeriPrescriptionInfo(@Param("page") Page<VeriPrescriptionInfoDto> page,
@Param(Constants.WRAPPER) QueryWrapper<VeriPrescriptionParam> queryWrapper);
/**
* 处方详细信息获取
*
* @param prescriptionNo 处方号
* @return 处方详细信息
*/
List<VeriPrescriptionDetailInfoDto> getVeriPrescriptionDetailInfo(@Param("prescriptionNo") String prescriptionNo);
}

View File

@@ -1,72 +0,0 @@
package com.openhis.web.ybmanage.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.openhis.yb.dto.*;
/**
* 医保Mapper
*
* @author GuoRui
*/
@Repository
public interface YbMapper {
/**
* 【3101】查询就诊患者信息
*
* @param encounterId 就诊ID
* @param encounterFlag 是否为就诊登记使用
* @param participantType 参与者类型
* @param deleteFlag 删除状态
* @return 就诊患者信息
*/
Yb3101AdapterEncounterPatientInfo yb3101SelectEncounterPatientInfo(@Param("encounterId") Long encounterId,
@Param("encounterFlag") Integer encounterFlag, @Param("participantType") String participantType,
@Param("deleteFlag") String deleteFlag);
/**
* 【3101】查询就诊诊断信息
*
* @param encounterId 就诊ID
* @param deleteFlag 删除状态
* @return 就诊诊断信息
*/
List<Yb3101AdapterEncounterDiagnoseInfo> yb3101SelectEncounterDiagnoseInfo(@Param("encounterId") Long encounterId,
@Param("deleteFlag") String deleteFlag);
/**
* 【3101】查询处方医嘱信息
*
* @param encounterId 就诊ID
* @param deleteFlag 删除状态
* @param ybMedChrgItmTypeWest 医疗收费项目类别-西药费
* @param ybMedChrgItmTypeChineseSlices 医疗收费项目类别-中药饮片费
* @param ybMedChrgItmTypeChinese 医疗收费项目类别-中成药费
* @return 处方(医嘱)信息
*/
List<Yb3101AdapterOrderInfo> yb3101SelectOrderInfo(@Param("encounterId") Long encounterId,
@Param("deleteFlag") String deleteFlag, @Param("ybMedChrgItmTypeWest") String ybMedChrgItmTypeWest,
@Param("ybMedChrgItmTypeChineseSlices") String ybMedChrgItmTypeChineseSlices,
@Param("ybMedChrgItmTypeChinese") String ybMedChrgItmTypeChinese);
/**
* 【4101A】查询结算清单信息
*
* @param paymentId 付款ID
* @return 结算清单信息
*/
List<Yb4101AAdapterSettleInfo> yb4101aSelectSettleInfo(@Param("paymentId") Long paymentId);
/**
* 【4101A】查询门诊慢特病诊断信息
*
* @param paymentId 付款ID
* @return 门诊慢特病诊断信息
*/
List<Yb4101AInputOpspdiseinfo> yb4101aSelectOpspdiseinfo(@Param("paymentId") Long paymentId);
}

View File

@@ -1,227 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.service;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
import com.openhis.web.ybmanage.dto.VeriPrescriptionParam;
import com.openhis.ybelep.domain.*;
import javax.servlet.http.HttpServletRequest;
/**
*
* @author yuxj
* @date 2025-04-17
*/
public interface IYbEleBaseService {
/**
* 医保电子处方查询
*
* @param veriPrescriptionParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求数据
* @return 处方信息
*/
R<?> getVeriPrescriptionInfo(VeriPrescriptionParam veriPrescriptionParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 医保电子处方查看
*
* @param prescriptionNo 处方号
* @return 处方详细信息
*/
R<?> getPrescriptionDetailInfo(String prescriptionNo);
/**
* 医保电子处方状态更新(上传)
*
* @param prescriptionNo 处方号
* @return 处方信息
*/
R<?> uploadPrescriptionStatus(String prescriptionNo);
/**
* 医保电子处方拒绝上传
*
* @param prescriptionNo 处方号
* @return 处方信息
*/
R<?> refusePrescriptionStatus(String prescriptionNo);
/**
* 医保电子处方状态更新(撤销)
*
* @param prescriptionNo 处方号
* @param quashReason 撤销原因
* @return 处方信息
*/
R<?> quashPrescriptionStatus(String prescriptionNo,String quashReason);
/**
* 做成电子处方上传预核验入参信息
*
* @param prescriptionNo 处方号
* @param tenantId 租户Id
* @return 处方信息
*/
PreCheckPrescription makePreCheckPrescription(String prescriptionNo,
Integer tenantId);
/**
* 电子处方上传预核验信息保存
*
* @param pcpResult 电子处方上传预核验信息
* @return 电子处方上传预核验信息
*/
void savePreCheckPrescription(PreCheckPrescription pcpResult);
/**
* 电子处方上传预核验响应出参信息保存
*
* @param pcpResult 电子处方上传预核验响应出参信息
* @return
*/
void saveEleVeriPrescriptionOutput(ElepVeriPrescriptionOutput pcpResult);
/**
* 做成电子处方医保电子签名入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 电子处方医保电子签名入参
*/
ElepSignatureInput makeEleSignature(String hiRxno, Long practitionerId, Date checkDate, Integer tenantId);
/**
* 保存电子处方医保电子签名入参
*
* @param eSign 电子处方医保电子签名入参信息
* @return
*/
void saveEleSignature(ElepSignatureInput eSign);
/**
* 保存电子处方医保电子签名响应出参
*
* @param esResult 电子处方医保电子签名响应出参信息
* @return
*/
void saveEleSignatureOutput(ElepSignatureOutput esResult);
/**
* 做成电子处方上传入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 电子处方上传入参
*/
ElepUploadInput makeEleUploadInput(String hiRxno, Long practitionerId, Date checkDate, Integer tenantId);
/**
* 保存电子处方上传入参
*
* @param eleUploadInput 电子处方上传入参信息
* @return
*/
void saveEleUploadInput(ElepUploadInput eleUploadInput);
/**
* 保存电子处方上传响应出参
*
* @param euResult 电子处方上传响应出参信息
* @return
*/
void saveEleUploadOutput(ElepUploadOutput euResult);
/**
* 做成电子处方撤销入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 撤销药师Id
* @param description 撤销原因
* @param checkDate 撤销时间
* @param tenantId 租户Id
* @return 电子处方撤销入参
*/
ElepRevokeInput makeEleRevokeInput(String hiRxno, Long practitionerId,String description, Date checkDate, Integer tenantId);
/**
* 保存电子处方撤销入参
*
* @param eleRevokeInput 电子处方撤销入参信息
* @return
*/
void saveEleRevokeInput(ElepRevokeInput eleRevokeInput);
/**
* 保存电子处方撤销响应出参
*
* @param ereResult 电子处方撤销响应出参信息
* @return
*/
void saveEleRevokeOutput(ElepRevokeOutput ereResult);
/**
* 做成电子处方信息查询入参
*
* @param hiRxno 医保处方编号
* @return 电子处方信息查询入参
*/
ElepQuerPrescriptionInput makeEleQueryPrescriptionInput(String hiRxno);
/**
* 保存电子处方信息查询入参
*
* @param eleQueryPreInput 电子处方信息查询入参信息
* @return
*/
void saveEleQueryPrescriptionInput(ElepQuerPrescriptionInput eleQueryPreInput);
/**
* 保存电子处方信息查询响应出参信息
*
* @param emrResult 电子处方信息查询响应出参信息
* @return
*/
void saveEleMedResultOut(QueryPrescription emrResult);
/**
* 做成电子处方取药结果查询入参
*
* @param hiRxno 医保处方编号
* @return 电子处方取药结果查询入参
*/
ElepMedresultInput makeEleMedResultInput(String hiRxno);
/**
* 保存电子处方取药结果查询入参
*
* @param eleMedInput 电子处方取药结果查询入参信息
* @return
*/
void saveEleMedResultInput(ElepMedresultInput eleMedInput);
/**
* 保存电子处方取药结果查询响应出参
*
* @param medResInquiry 电子处方取药结果查询响应出参信息
* @return
*/
void saveMedicationResultInquiry(MedicationResultInquiry medResInquiry);
Map<String,String> getMedTypeAndDoctorName(String prescriptionNo, Integer tenantId);
}

View File

@@ -1,64 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.service;
import com.core.common.core.domain.R;
import com.openhis.ybelep.domain.*;
/**
*
* @author yuxj
* @date 2025-04-17
*/
public interface IYbEleHttpService {
/**
* 采用HTTP协议中的 POST 方法,发送医保电子处方注册预核验请求,并处理响应结果
*
* @param pcp 医保电子处方注册预核验入参实体
* @return 医保电子处方注册预核验响应出参实体
*/
R<?> preCheck(PreCheckPrescription pcp, String medType , String dutyDoctorName);
/**
* 采用HTTP协议中的 POST 方法,发送电子处方医保电子签名请求,并处理响应结果
*
* @param eleSign 电子处方医保电子签名入参实体
* @return 电子处方医保电子签名响应出参实体
*/
R<?> eleSign(ElepSignatureInput eleSign);
/**
* 采用HTTP协议中的 POST 方法,发送电子处方上传请求,并处理响应结果
*
* @param eleUploadInput 电子处方上传入参实体
* @return 电子处方上传响应出参实体
*/
R<?> uploadElePre(ElepUploadInput eleUploadInput);
/**
* 采用HTTP协议中的 POST 方法,发送电子处方撤销请求,并处理响应结果
*
* @param eleRevokeInput 电子处方撤销入参实体
* @return 电子处方撤销响应出参实体
*/
R<?> revokePre(ElepRevokeInput eleRevokeInput);
/**
* 采用HTTP协议中的 POST 方法,电子处方信息查询请求,并处理响应结果
*
* @param eleQueryPreInput 电子处方信息查询入参实体
* @return 电子处方信息查询出参实体
*/
R<?> queryPre(ElepQuerPrescriptionInput eleQueryPreInput);
/**
* 采用HTTP协议中的 POST 方法,电子处方取药结果查询请求,并处理响应结果
*
* @param eleMedInput 电子处方取药结果查询入参实体
* @return 电子处方取药结果查询出参实体
*/
R<?> queryMedPre(ElepMedresultInput eleMedInput);
}

View File

@@ -1,38 +0,0 @@
package com.openhis.web.ybmanage.service;
import com.core.common.core.domain.R;
/**
* 医保Service
*
* @author GuoRui
*/
public interface IYbService {
/**
* 【3101】明细审核事前事中分析服务
*
* @param encounterId 就诊ID
* @param trigScen 触发场景
* @return 结果
*/
R<?> yb3101PreMidAnalysis(Long encounterId, String trigScen);
/**
* 【3103】事前事中服务反馈服务
*
* @param warnRsltId 违规标识
* @param dspoWay 处理方式
* @param dspoWayRea 处理原因
* @return 结果
*/
R<?> yb3103PreMidFeedback(String warnRsltId, String dspoWay, String dspoWayRea);
/**
* 【4101A】医疗保障基金结算清单信息上传
*
* @param paymentId 付款ID
* @return 结果
*/
R<?> yb4101aUploadFundSettle(Long paymentId);
}

View File

@@ -1,255 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.service.impl;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.SecurityUtils;
import com.openhis.yb.dto.BaseInfo;
import com.openhis.yb.dto.BaseParam;
import com.openhis.yb.util.YbParamBuilderUtil;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.openhis.web.ybmanage.config.YbServiceConfig;
import com.openhis.web.ybmanage.dto.Result;
import com.openhis.web.ybmanage.service.IYbEleHttpService;
import com.openhis.ybelep.domain.*;
import java.io.IOException;
/**
* http请求接口
*
* @author yuxj
* @date 2025-04-17
*/
@Service
public class YbEleHttpServiceImpl implements IYbEleHttpService {
@Autowired
YbServiceConfig ybServiceConfig;
@Autowired
YbParamBuilderUtil ybParamBuilderUtil;
/**
* 采用HTTP协议中的 POST 方法,发送医保电子处方注册预核验请求,并处理响应结果
*
* @param pcp 医保电子处方注册预核验入参实体
* @return 医保电子处方注册预核验响应出参实体
*/
@Override
public R<?> preCheck(PreCheckPrescription pcp, String medType , String dutyDoctorName) {
ElepVeriPrescriptionOutput pcpResult = new ElepVeriPrescriptionOutput();
BaseInfo baseInfo = ybParamBuilderUtil.getBaseInfo(medType, dutyDoctorName);
// 发送请求
String s = httpPost( SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/preCheckPrescription", pcp,baseInfo);
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
pcpResult = JSON.parseObject(JSON.toJSONString(result.getResult()), ElepVeriPrescriptionOutput.class);;
pcpResult.setPrescriptionNo(pcp.getHospRxno());
return R.ok(pcpResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 采用HTTP协议中的 POST 方法,发送电子处方医保电子签名请求,并处理响应结果
*
* @param eleSign 电子处方医保电子签名入参实体
* @return 电子处方医保电子签名响应出参实体
*/
public R<?> eleSign(ElepSignatureInput eleSign) {
ElepSignatureOutput esResult = new ElepSignatureOutput();
// 发送请求
String s = httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/signature", eleSign,ybParamBuilderUtil.getBaseInfo("",""));
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
esResult = JSON.parseObject(JSON.toJSONString(result.getResult()), ElepSignatureOutput.class);
return R.ok(esResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 采用HTTP协议中的 POST 方法,发送电子处方上传请求,并处理响应结果
*
* @param eleUploadInput 电子处方上传入参实体
* @return 电子处方上传响应出参实体
*/
@Override
public R<?> uploadElePre(ElepUploadInput eleUploadInput) {
ElepUploadOutput euResult = new ElepUploadOutput();
// 发送请求
String s = httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/upload", eleUploadInput,ybParamBuilderUtil.getBaseInfo("",""));
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
euResult = JSON.parseObject(JSON.toJSONString(result.getResult()), ElepUploadOutput.class);
return R.ok(euResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 采用HTTP协议中的 POST 方法,发送电子处方撤销请求,并处理响应结果
*
* @param eleRevokeInput 电子处方撤销入参实体
* @return 电子处方撤销响应出参实体
*/
@Override
public R<?> revokePre(ElepRevokeInput eleRevokeInput) {
ElepRevokeOutput ereResult = new ElepRevokeOutput();
// 发送请求
String s = httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/revoke", eleRevokeInput,ybParamBuilderUtil.getBaseInfo("",""));
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
ereResult = JSON.parseObject(JSON.toJSONString(result.getResult()), ElepRevokeOutput.class);
return R.ok(ereResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 采用HTTP协议中的 POST 方法,电子处方信息查询请求,并处理响应结果
*
* @param eleQueryPreInput 电子处方信息查询入参实体
* @return 电子处方信息查询出参实体
*/
@Override
public R<?> queryPre(ElepQuerPrescriptionInput eleQueryPreInput) {
//拼参数
// BaseParam baseParam = new BaseParam();
// baseParam.setBaseInfo(ybParamBuilderUtil.getBaseInfo()).setData(eleQueryPreInput);
// baseParam.setBaseInfo(ybParamBuilderUtil.getBaseInfo()).setData(o);
QueryPrescription emrResult = new QueryPrescription();
// 发送请求
String s =
httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/querPrescription", eleQueryPreInput,ybParamBuilderUtil.getBaseInfo("",""));
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
emrResult = JSON.parseObject(JSON.toJSONString(result.getResult()), QueryPrescription.class);
return R.ok(emrResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 采用HTTP协议中的 POST 方法,电子处方取药结果查询请求,并处理响应结果
*
* @param eleMedInput 电子处方取药结果查询入参实体
* @return 电子处方取药结果查询出参实体
*/
public R<?> queryMedPre(ElepMedresultInput eleMedInput){
MedicationResultInquiry medResult = new MedicationResultInquiry();
// 发送请求
String s =
httpPost(SecurityUtils.getLoginUser().getOptionJson().getString("eleUrl") + "/medresult", eleMedInput,ybParamBuilderUtil.getBaseInfo("",""));
// 参数处理
ObjectMapper mapper = new ObjectMapper();
Result result = null;
try {
result = mapper.readValue(s, Result.class);
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.isSuccess()) {
medResult = JSON.parseObject(JSON.toJSONString(result.getResult()), MedicationResultInquiry.class);
return R.ok(medResult);
}else{
return R.fail(result.getMessage());
}
}
/**
* 发送http请求2025/05/02经测试若以自带的工具类发送请求失败故使用原peis系统中成功调用的写法重新封装
* @param url 路径
* @param o 参数
* @return
*/
private String httpPost(String url, Object o, BaseInfo baseInfo){
String resultString = "";
// //拼参数
BaseParam baseParam = new BaseParam();
baseParam.setBaseInfo(baseInfo).setData(o);
//创建Http请求
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
.setSocketTimeout(30000).build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response = null;
//发送请求
try {
HttpPost httpPost = new HttpPost(url);
StringEntity stringEntity = new StringEntity(JSON.toJSONString(baseParam), ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
}
catch (Exception e) {
e.printStackTrace();
throw new ServiceException("Http请求异常请稍后再试。");
}
finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
}

View File

@@ -1,701 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.service.impl;
import java.util.*;
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.core.domain.model.LoginUser;
import com.core.common.utils.DateUtils;
import com.core.common.utils.MessageUtils;
import com.core.common.utils.SecurityUtils;
import com.openhis.administration.domain.Encounter;
import com.openhis.administration.domain.Patient;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IEncounterService;
import com.openhis.administration.service.IPatientService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.constant.YbCommonConstants;
import com.openhis.common.enums.PrescriptionType;
import com.openhis.common.enums.RequestStatus;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.financial.domain.Contract;
import com.openhis.financial.service.IContractService;
import com.openhis.web.ybmanage.dto.VeriPrescriptionDetailInfoDto;
import com.openhis.web.ybmanage.dto.VeriPrescriptionInfoDto;
import com.openhis.web.ybmanage.dto.VeriPrescriptionParam;
import com.openhis.web.ybmanage.mapper.YbElepMapper;
import com.openhis.workflow.domain.ElepMedicationRequest;
import com.openhis.workflow.service.IElepMedicationRequestService;
import com.openhis.yb.service.IPerinfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.openhis.web.ybmanage.service.IYbEleBaseService;
import com.openhis.web.ybmanage.util.YbEleParamBuilderUtil;
import com.openhis.yb.domain.ClinicReg;
import com.openhis.yb.service.IRegService;
import com.openhis.ybelep.domain.*;
import com.openhis.ybelep.service.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* 医保表的增删改查接口
*
* @author yuxj
* @date 2025-04-17
*/
@Service
public class YbElepBaseServiceImpl implements IYbEleBaseService {
@Autowired
IRegService iRegService;
@Autowired
IPerinfoService perinfoService;
@Autowired
IContractService contractService;
@Autowired
IPractitionerService iPractitionerService;
@Autowired
YbEleParamBuilderUtil ybEleUtil;
@Autowired
IElepVeriPrescriptionInfoService eleVeriPrescriptionInfoService;
@Autowired
IElepVeriPrescriptionDetailService eleVeriPrescriptionDetailService;
@Autowired
IElepVeriVisitInfoService eleVeriVisitInfoService;
@Autowired
IElepVeriDiagnosisInfoService eleVeriDiagnosisInfoService;
@Autowired
IElepVeriPrescriptionOutputService elePresOutputService;
@Autowired
IElepSignatureInputService eleSignInfoService;
@Autowired
IElepSignatureOutputService eleSignOutService;
@Autowired
IElepUploadInputService eleUploadInputService;
@Autowired
IElepUploadOutputService eleUploadOutputService;
@Autowired
IElepRevokeInputService eleRevokeInputService;
@Autowired
IElepRevokeOutputService eleRevokeOutputService;
@Autowired
IElepMedresultInputService eleMedResultInputService;
@Autowired
IElepQuerPrescriptionInputService eleQueryPreInputService;
@Autowired
IElepMedresultInfoService eleMedResInfoService;
@Autowired
IElepMedresultInputService eleMedResInputService;
@Autowired
IElepMedresultDetailService eleMedDetailService;
@Autowired
YbElepMapper ybElepMapper;
@Autowired
IElepMedicationRequestService elepMedicationRequestService;
@Autowired
IElepQuerPrescriptionInfoService eleQuerPrescriptionInfoService;
@Autowired
IElepQuerPrescriptionDetailService eleQuerPrescriptionDetailService;
@Autowired
IElepQuerVisitInfoService eleQuerVisitInfoService;
@Autowired
IElepQuerDiagnosisInfoService eleQuerDiagnosisInfoService;
@Resource
IPractitionerService practitionerService;
@Resource
IEncounterService encounterService;
@Resource
IPatientService patientService;
/**
* 医保电子处方查询
*
* @param veriPrescriptionParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求数据
* @return 处方信息
*/
@Override
public R<?> getVeriPrescriptionInfo(VeriPrescriptionParam veriPrescriptionParam, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<VeriPrescriptionParam> queryWrapper =
HisQueryUtils.buildQueryWrapper(veriPrescriptionParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IptOtpNo)),
request);
// 医保电子处方查询
IPage<VeriPrescriptionInfoDto> veriPrescriptionInfo =
ybElepMapper.getVeriPrescriptionInfo(new Page<>(pageNo, pageSize), queryWrapper);
// 状态转换
veriPrescriptionInfo.getRecords().forEach(prescriptionInfoDto -> {
prescriptionInfoDto.setStatusEnum_enumText(
EnumUtils.getInfoByValue(RequestStatus.class, prescriptionInfoDto.getStatusEnum()));
});
return R.ok(veriPrescriptionInfo);
}
/**
* 医保电子处方查看
*
* @param prescriptionNo 处方号
* @return 处方详细信息
*/
@Override
public R<?> getPrescriptionDetailInfo(String prescriptionNo) {
// 处方详细查询
List<VeriPrescriptionDetailInfoDto> prescriptionDetailInfo =
ybElepMapper.getVeriPrescriptionDetailInfo(prescriptionNo);
// 状态转换
for (VeriPrescriptionDetailInfoDto item : prescriptionDetailInfo) {
item.setStatusEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, item.getStatusEnum()));
item.setRxTypeCode_enumText(EnumUtils.getInfoByValue(PrescriptionType.class, item.getRxTypeCode()));
}
return R.ok(prescriptionDetailInfo);
}
/**
* 医保电子处方状态更新(上传)
*
* @param prescriptionNo 处方号
* @return 处方信息
*/
@Override
public R<?> uploadPrescriptionStatus(String prescriptionNo) {
// 获取当前登陆用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
Practitioner user = practitionerService.getPractitionerByUserId(loginUser.getUserId());
// 获取当前时间
Date now = DateUtils.getNowDate();
// 获取医保处方号
List<ElepVeriPrescriptionOutput> prescriptionOutput =
elePresOutputService.list(new LambdaQueryWrapper<ElepVeriPrescriptionOutput>()
.eq(ElepVeriPrescriptionOutput::getPrescriptionNo, prescriptionNo)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (prescriptionOutput == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
}
// 获取电子处方信息
List<ElepMedicationRequest> elepMedicationRequest =
elepMedicationRequestService.selectElepMedicationRequestByPrescriptionNo(prescriptionNo);
if (elepMedicationRequest == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
}
boolean flg;
// 更改处方信息
for (ElepMedicationRequest item : elepMedicationRequest) {
// 医保处方编号
item.setHiRxno(prescriptionOutput.get(0).getHiRxno());
// 电子处方追溯码
item.setRxTraceCode(prescriptionOutput.get(0).getRxTraceCode());
// 处方状态
item.setStatusEnum(RequestStatus.COMPLETED.getValue());
// 审核药师
item.setReviewDrId(user.getId());
// 审核时间
item.setReviewTime(now);
flg = elepMedicationRequestService.updateById(item);
if (!flg) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
}
/**
* 医保电子处方拒绝上传
*
* @param prescriptionNo 处方号
* @return 处方信息
*/
@Override
public R<?> refusePrescriptionStatus(String prescriptionNo) {
// 获取当前登陆用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
Practitioner user = practitionerService.getPractitionerByUserId(loginUser.getUserId());
// 获取当前时间
Date now = DateUtils.getNowDate();
// 获取电子处方信息
List<ElepMedicationRequest> elepMedicationRequest =
elepMedicationRequestService.selectElepMedicationRequestByPrescriptionNo(prescriptionNo);
if (elepMedicationRequest == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
}
boolean flg;
// 更改处方信息
for (ElepMedicationRequest item : elepMedicationRequest) {
// 处方状态
item.setStatusEnum(RequestStatus.ENDED.getValue());
flg = elepMedicationRequestService.updateById(item);
if (!flg) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
}
/**
* 医保电子处方状态更新(撤销)
*
* @param prescriptionNo 处方号
* @param quashReason 撤销原因
* @return 处方信息
*/
@Override
public R<?> quashPrescriptionStatus(String prescriptionNo, String quashReason) {
// 获取当前登陆用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
Practitioner user = practitionerService.getPractitionerByUserId(loginUser.getUserId());
// 获取当前时间
Date now = DateUtils.getNowDate();
// 获取电子处方信息
List<ElepMedicationRequest> elepMedicationRequest =
elepMedicationRequestService.selectElepMedicationRequestByPrescriptionNo(prescriptionNo);
if (elepMedicationRequest == null) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
}
boolean flg;
// 更改处方信息
for (ElepMedicationRequest item : elepMedicationRequest) {
// 处方状态
item.setStatusEnum(RequestStatus.STOPPED.getValue());
// 撤销药师
item.setQuashDrId(user.getId());
// 撤销时间
item.setQuashTime(now);
// 撤销原因
item.setQuashReason(quashReason);
flg = elepMedicationRequestService.updateById(item);
if (!flg) {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
}
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
}
/**
* 做成电子处方上传预核验入参信息
*
* @param prescriptionNo 处方号
* @param tenantId 租户Id
* @return 处方信息
*/
@Override
public PreCheckPrescription makePreCheckPrescription(String prescriptionNo,
Integer tenantId) {
// 获取药品请求信息(处方表)
List<ElepMedicationRequest> medicationRequestList = elepMedicationRequestService.list(
new LambdaQueryWrapper<ElepMedicationRequest>().eq(ElepMedicationRequest::getPrescriptionNo, prescriptionNo)
.eq(ElepMedicationRequest::getTenantId, tenantId));
if (medicationRequestList == null) {
return null;
}
ElepMedicationRequest medicationRequest = medicationRequestList.get(0);
// 就诊信息
Encounter encounter = encounterService.getById(medicationRequest.getEncounterId());
//患者信息
Patient patient = patientService.getById(encounter.getPatientId());
// 获取医保挂号信息 todo clinicReg可能改成一对多
ClinicReg clinicReg = iRegService.getByBusNo(encounter.getBusNo());
if (clinicReg == null) {
return null;
}
// 获取处方信息
PreCheckPrescription prescriptionInfo =
ybEleUtil.getEleVeriPrescriptionInfo(medicationRequest, patient, tenantId);
// 获取处方明细信息
List<ElepVeriPrescriptionDetail> rxdrugdetail =
ybEleUtil.getEleVeriPrescriptionDetail(prescriptionNo, tenantId);
// 获取就诊信息和诊断信息
PreCheckPrescription eleVisAndDisInfo =
ybEleUtil.getEleVeriVisitAndDiagnosisInfo(medicationRequest, clinicReg, tenantId);
// 电子处方上传预核验实体赋值
prescriptionInfo.setRxdrugdetail(rxdrugdetail)
.setMdtrtinfo(eleVisAndDisInfo.getMdtrtinfo()).setDiseinfo(eleVisAndDisInfo.getDiseinfo());
return prescriptionInfo;
}
/**
* 电子处方上传预核验信息保存
*
* @param pcpResult 电子处方上传预核验信息
* @return
*/
@Override
public void savePreCheckPrescription(PreCheckPrescription pcpResult) {
//todo dto和表的字段类型不一致
ElepVeriPrescriptionInfo prescriptionInfo = new ElepVeriPrescriptionInfo();
BeanUtils.copyProperties(pcpResult, prescriptionInfo);
// 保存处方信息
eleVeriPrescriptionInfoService.save(prescriptionInfo);
// 保存处方明细信息
eleVeriPrescriptionDetailService.saveBatch(pcpResult.getRxdrugdetail());
// 保存就诊信息
eleVeriVisitInfoService.save(pcpResult.getMdtrtinfo());
// 保存诊断信息
eleVeriDiagnosisInfoService.save(pcpResult.getDiseinfo());
}
/**
* 电子处方上传预核验响应出参信息保存
*
* @param pcpResult 电子处方上传预核验响应出参信息
* @return
*/
@Override
public void saveEleVeriPrescriptionOutput(ElepVeriPrescriptionOutput pcpResult) {
elePresOutputService.save(pcpResult);
}
/**
* 做成电子处方医保电子签名入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 处方信息
*/
@Override
public ElepSignatureInput makeEleSignature(String hiRxno, Long practitionerId, Date checkDate, Integer tenantId) {
List<ElepVeriPrescriptionOutput> pcpResult = elePresOutputService.list(
new LambdaQueryWrapper<ElepVeriPrescriptionOutput>().eq(ElepVeriPrescriptionOutput::getHiRxno, hiRxno)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (pcpResult == null) {
return null;
}
return ybEleUtil.getEleSignatureInput(pcpResult.get(0), practitionerId, checkDate, tenantId);
}
/**
* 保存电子处方医保电子签名入参
*
* @param eSign 电子处方医保电子签名入参信息
* @return
*/
@Override
public void saveEleSignature(ElepSignatureInput eSign) {
eleSignInfoService.save(eSign);
}
/**
* 保存电子处方医保电子签名响应出参
*
* @param esResult 电子处方医保电子签名响应出参信息
* @return
*/
@Override
public void saveEleSignatureOutput(ElepSignatureOutput esResult) {
eleSignOutService.save(esResult);
}
/**
* 做成电子处方上传入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 电子处方上传入参
*/
@Override
public ElepUploadInput makeEleUploadInput(String hiRxno, Long practitionerId, Date checkDate, Integer tenantId) {
List<ElepVeriPrescriptionOutput> pcpResult = elePresOutputService.list(
new LambdaQueryWrapper<ElepVeriPrescriptionOutput>().eq(ElepVeriPrescriptionOutput::getHiRxno, hiRxno)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
List<ElepSignatureOutput> esResult = eleSignOutService
.list(new LambdaQueryWrapper<ElepSignatureOutput>().eq(ElepSignatureOutput::getHiRxno, hiRxno)
.orderByDesc(ElepSignatureOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (pcpResult == null || esResult == null) {
return null;
}
return ybEleUtil.getEleUploadInput(pcpResult.get(0), esResult.get(0), practitionerId, checkDate, tenantId);
}
/**
* 保存电子处方上传入参
*
* @param eleUploadInput 电子处方上传入参信息
* @return
*/
@Override
public void saveEleUploadInput(ElepUploadInput eleUploadInput) {
eleUploadInputService.save(eleUploadInput);
}
/**
* 保存电子处方上传响应出参
*
* @param euResult 电子处方上传响应出参信息
* @return
*/
@Override
public void saveEleUploadOutput(ElepUploadOutput euResult) {
eleUploadOutputService.save(euResult);
}
/**
* 做成电子处方撤销入参
*
* @param hiRxno 医保处方编号
* @param practitionerId 撤销药师Id
* @param description 撤销原因
* @param revokeDate 撤销时间
* @param tenantId 租户Id
* @return 电子处方撤销入参
*/
@Override
public ElepRevokeInput makeEleRevokeInput(String hiRxno, Long practitionerId, String description, Date revokeDate,
Integer tenantId) {
List<ElepVeriPrescriptionOutput> pcpResult = elePresOutputService.list(
new LambdaQueryWrapper<ElepVeriPrescriptionOutput>().eq(ElepVeriPrescriptionOutput::getHiRxno, hiRxno)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (pcpResult == null) {
return null;
}
List<ElepUploadOutput> euResult = eleUploadOutputService
.list(new LambdaQueryWrapper<ElepUploadOutput>().eq(ElepUploadOutput::getHiRxno, pcpResult.get(0).getHiRxno())
.orderByDesc(ElepUploadOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (euResult == null) {
return null;
}
return ybEleUtil.getElepRevokeInput(pcpResult.get(0), euResult.get(0), practitionerId, description, revokeDate, tenantId);
}
/**
* 保存电子处方撤销入参
*
* @param eleRevokeInput 电子处方撤销入参信息
* @return
*/
@Override
public void saveEleRevokeInput(ElepRevokeInput eleRevokeInput) {
eleRevokeInputService.save(eleRevokeInput);
}
/**
* 保存电子处方撤销响应出参
*
* @param ereResult 电子处方撤销响应出参信息
* @return
*/
@Override
public void saveEleRevokeOutput(ElepRevokeOutput ereResult) {
eleRevokeOutputService.save(ereResult);
}
/**
* 做成电子处方信息查询入参
*
* @param hiRxno 医保处方编号
* @return 电子处方信息查询入参
*/
@Override
public ElepQuerPrescriptionInput makeEleQueryPrescriptionInput(String hiRxno) {
List<ElepVeriPrescriptionOutput> pcpResult = elePresOutputService.list(
new LambdaQueryWrapper<ElepVeriPrescriptionOutput>().eq(ElepVeriPrescriptionOutput::getHiRxno, hiRxno)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (pcpResult == null) {
return null;
}
return ybEleUtil.getEleQueryPrescriptionInput(pcpResult.get(0));
}
/**
* 保存电子处方信息查询入参
*
* @param eleQueryPreInput 电子处方信息查询入参信息
* @return
*/
@Override
public void saveEleQueryPrescriptionInput(ElepQuerPrescriptionInput eleQueryPreInput) {
eleQueryPreInputService.save(eleQueryPreInput);
}
/**
* 保存电子处方信息查询响应出参信息
*
* @param emrResult 电子处方信息查询响应出参信息
* @return
*/
@Override
public void saveEleMedResultOut(QueryPrescription emrResult) {
ElepQuerPrescriptionInfo prescriptionInfo = new ElepQuerPrescriptionInfo();
BeanUtils.copyProperties(emrResult, prescriptionInfo);
// 保存处方信息
eleQuerPrescriptionInfoService.save(prescriptionInfo);
// 保存处方明细信息
eleQuerPrescriptionDetailService.saveBatch(emrResult.getRxDetlList());
// 保存就诊信息
eleQuerVisitInfoService.save(emrResult.getRxOtpinfo());
// 保存诊断信息
eleQuerDiagnosisInfoService.saveBatch(emrResult.getRxDiseList());
}
/**
* 做成电子处方取药结果查询入参
*
* @param hiRxno 医保处方编号
* @return 电子处方取药结果查询入参
*/
@Override
public ElepMedresultInput makeEleMedResultInput(String hiRxno) {
List<ElepVeriPrescriptionOutput> pcpResult = elePresOutputService.list(
new LambdaQueryWrapper<ElepVeriPrescriptionOutput>().eq(ElepVeriPrescriptionOutput::getHiRxno, hiRxno)
.orderByDesc(ElepVeriPrescriptionOutput::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (pcpResult == null) {
return null;
}
return ybEleUtil.getEleMedResultInput(pcpResult.get(0));
}
/**
* 保存电子处方取药结果查询入参
*
* @param eleMedInput 电子处方取药结果查询入参信息
* @return
*/
@Override
public void saveEleMedResultInput(ElepMedresultInput eleMedInput) {
eleMedResInputService.save(eleMedInput);
}
/**
* 保存电子处方取药结果查询响应出参
*
* @param medResInquiry 电子处方取药结果查询响应出参信息
* @return
*/
@Override
public void saveMedicationResultInquiry(MedicationResultInquiry medResInquiry) {
ElepMedresultInfo medresultInfo = new ElepMedresultInfo();
BeanUtils.copyProperties(medResInquiry, medresultInfo);
// 保存处方信息
eleMedResInfoService.save(medresultInfo);
eleMedDetailService.saveBatch(medResInquiry.getSeltdelts());
}
@Override
public Map<String, String> getMedTypeAndDoctorName(String prescriptionNo, Integer tenantId) {
HashMap<String, String> map = new HashMap<>();
// 获取药品请求信息(处方表)
List<ElepMedicationRequest> medicationRequestList = elepMedicationRequestService.list(
new LambdaQueryWrapper<ElepMedicationRequest>().eq(ElepMedicationRequest::getPrescriptionNo, prescriptionNo)
.eq(ElepMedicationRequest::getTenantId, tenantId));
if (medicationRequestList == null) {
return null;
}
ElepMedicationRequest medicationRequest = medicationRequestList.get(0);
// 就诊信息
Encounter encounter = encounterService.getById(medicationRequest.getEncounterId());
//患者信息
Patient patient = patientService.getById(encounter.getPatientId());
// 获取医保挂号信息 todo clinicReg可能改成一对多
ClinicReg clinicReg = iRegService.getByBusNo(encounter.getBusNo());
if (clinicReg == null) {
return null;
}
String medicalContractName = "";
String insuplcAdmdvs = clinicReg.getInsuplcAdmdvs();
if (insuplcAdmdvs.equals("229900") ) {
medicalContractName = "";
} else if (insuplcAdmdvs.startsWith("2201")) {
medicalContractName = "";
} else {
medicalContractName = "省异地";
}
// List<Contract> contractListByYb = contractService.getContractListByYb();
// for (Contract contract : contractListByYb) {
// if(insuplcAdmdvs.equals(contract.getAdmVs())){
// medicalContractName = contract.getContractName();
// }
// }
String insutype = clinicReg.getInsutype();
String medicalCareType = "";
switch (insutype) {
case "310":
case "320":
case "330":
case "370":
medicalCareType = "职工医保";
break;
case "340":
case "360":
medicalCareType = "全公费";
break;
case "390":
case "392":
case "391":
case "380":
medicalCareType = "居民医保";
break;
case "350":
case "410":
case "399":
medicalCareType = "其他";
break;
default:
medicalCareType = "全自费";
break;
}
Practitioner practitioner = iPractitionerService.getById(SecurityUtils.getLoginUser().getPractitionerId());
map.put("doctorName", practitioner.getName());
map.put("medType", medicalContractName + medicalCareType);
return map;
}
}

View File

@@ -1,407 +0,0 @@
package com.openhis.web.ybmanage.service.impl;
import java.math.BigDecimal;
import java.time.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.core.common.core.domain.R;
import com.core.common.enums.DeleteFlag;
import com.core.common.enums.TenantOptionDict;
import com.core.common.exception.ServiceException;
import com.core.common.utils.StringUtils;
import com.core.web.util.TenantOptionUtil;
import com.openhis.common.enums.ParticipantType;
import com.openhis.common.enums.TherapyTimeType;
import com.openhis.common.enums.Whether;
import com.openhis.common.enums.ybenums.*;
import com.openhis.web.ybmanage.mapper.YbMapper;
import com.openhis.web.ybmanage.service.IYbService;
import com.openhis.yb.dto.*;
import com.openhis.yb.service.YbHttpUtils;
/**
* 医保ServiceImpl
*
* @author GuoRui
*/
@Service
public class YbServiceImpl implements IYbService {
@Autowired
private YbMapper ybMapper;
@Autowired
private YbHttpUtils ybHttpUtils;
/**
* 【3101】明细审核事前事中分析服务
*
* @param encounterId 就诊ID
* @param trigScen 触发场景
* @return 结果
*/
@Override
public R<?> yb3101PreMidAnalysis(Long encounterId, String trigScen) {
// 验证触发场景
if (YbTrigScen.getByValue(trigScen) == null) {
throw new ServiceException("请指定触发场景");
}
// 查询就诊患者信息
Yb3101AdapterEncounterPatientInfo encounterPatientInfo = ybMapper.yb3101SelectEncounterPatientInfo(encounterId,
Whether.YES.getValue(), ParticipantType.REGISTRATION_DOCTOR.getCode(), DeleteFlag.NOT_DELETED.getCode());
if (encounterPatientInfo == null) {
throw new ServiceException("患者信息不存在");
}
// 查询就诊诊断信息
List<Yb3101AdapterEncounterDiagnoseInfo> encounterDiagnoseInfoList =
ybMapper.yb3101SelectEncounterDiagnoseInfo(encounterId, DeleteFlag.NOT_DELETED.getCode());
if (encounterDiagnoseInfoList.isEmpty()) {
throw new ServiceException("诊断信息不存在");
}
// 查询处方(医嘱)信息
List<Yb3101AdapterOrderInfo> orderInfoList = ybMapper.yb3101SelectOrderInfo(encounterId,
DeleteFlag.NOT_DELETED.getCode(), YbMedChrgItmType.WEST_MEDICINE.getValue(),
YbMedChrgItmType.CHINESE_MEDICINE_SLICES_FEE.getValue(), YbMedChrgItmType.CHINESE_MEDICINE_FEE.getValue());
if (encounterDiagnoseInfoList.isEmpty()) {
throw new ServiceException("处方信息不存在");
}
// 作成诊断信息集合
List<Yb3101InputFsiDiagnoseDto> fsiDiagnoseDtos =
encounterDiagnoseInfoList.stream().map(this::createYb3101FsiDiagnoseDto).collect(Collectors.toList());
// 作成处方(医嘱)信息集合
List<Yb3101InputFsiOrderDto> fsiOrderDtos =
orderInfoList.stream().map(this::createYb3101InputFsiOrderDto).collect(Collectors.toList());
// 作成就诊信息
Yb3101InputFsiEncounterDto fsiEncounterDto =
createYb3101InputFsiEncounterDto(encounterPatientInfo, fsiDiagnoseDtos, fsiOrderDtos);
// 作成参保人信息
Yb3101InputPatientDto patientDto = createYb3101InputPatientDto(encounterPatientInfo, fsiEncounterDto);
// 作成规则分析信息
Yb3101InputData data = createYb3101InputData(patientDto, trigScen);
// 向医保服务发起HTTP请求获取返回结果
Yb3101OutputResult result = ybHttpUtils.yb3101PreMidAnalysis(data);
// TODO:后续处理需等待门诊住院开发完全后
return R.ok();
}
/**
* 【3103】事前事中服务反馈服务
*
* @param warnRsltId 违规标识
* @param dspoWay 处理方式
* @param dspoWayRea 处理原因
* @return 结果
*/
@Override
public R<?> yb3103PreMidFeedback(String warnRsltId, String dspoWay, String dspoWayRea) {
// 验证处理方式
if (YbDspoWay.getByValue(dspoWay) == null) {
throw new ServiceException("请指定处理方式");
}
// 继续执行医嘱时,处理原因必填
if (YbDspoWay.CONTINUE.getValue().equals(dspoWay) && StringUtils.isEmpty(dspoWayRea)) {
throw new ServiceException("请填写处理原因");
}
// 作成处理数据
Yb3103InputWarn warn =
new Yb3103InputWarn().setWarnRsltId(warnRsltId).setDspoWay(dspoWay).setDspoWayRea(dspoWayRea);
// 作成输入
Yb3103InputData data = new Yb3103InputData().setWarnType(YbWarnType.PRE.getValue()).setWarns(List.of(warn));
// 向医保服务发起HTTP请求
ybHttpUtils.yb3103PreMidFeedback(data);
return R.ok();
}
/**
* 【4101A】医疗保障基金结算清单信息上传
*
* @param paymentId 付款ID
* @return 结果
*/
@Override
public R<?> yb4101aUploadFundSettle(Long paymentId) {
// 查询结算清单信息
List<Yb4101AAdapterSettleInfo> settleInfoList = ybMapper.yb4101aSelectSettleInfo(paymentId);
return R.ok();
}
/**
* 【3101】创建诊断信息
*
* @param encounterDiagnoseInfo 就诊诊断信息
* @return 诊断信息
*/
private Yb3101InputFsiDiagnoseDto
createYb3101FsiDiagnoseDto(Yb3101AdapterEncounterDiagnoseInfo encounterDiagnoseInfo) {
// 根据住院患者疾病诊断类型代码,判断出入诊断类别,非入院诊断,视为出院诊断
String inoutDiseType;
if (YbIptDiseTypeCode.ADMISSION_DIAGNOSIS.getCode().equals(encounterDiagnoseInfo.getIptDiseTypeCode())) {
inoutDiseType = YbInOutDiagType.YB_IN_DIAG_TYPE.getValue();
} else {
inoutDiseType = YbInOutDiagType.YB_OUT_DIAG_TYPE.getValue();
}
// 返回诊断信息
return new Yb3101InputFsiDiagnoseDto()
// 诊断标识:诊断记录唯一标识
.setDiseId(encounterDiagnoseInfo.getDiseId())
// 出入诊断类别:参考字典表
.setInoutDiseType(inoutDiseType)
// 主诊断标志:参考字典表
.setMaindiseFlag(encounterDiagnoseInfo.getMaindiseFlag())
// 诊断排序号例如1,2,3…
.setDiasSrtNo(encounterDiagnoseInfo.getDiasSrtNo())
// 诊断(疾病)编码
.setDiseCodg(encounterDiagnoseInfo.getDiseCodg())
// 诊断(疾病)名称
.setDiseName(encounterDiagnoseInfo.getDiseName())
// 诊断日期格式yyyy-MM-dd HH:mm:ss
.setDiseDate(encounterDiagnoseInfo.getDiseDate());
}
/**
* 【3101】创建处方医嘱信息
*
* @param orderInfo 处方(医嘱)信息
* @return 处方(医嘱)信息
*/
private Yb3101InputFsiOrderDto createYb3101InputFsiOrderDto(Yb3101AdapterOrderInfo orderInfo) {
// 根据治疗类型,判断是否为长期医嘱
String longDrordFlag;
if (TherapyTimeType.LONG_TERM.getValue().equals(orderInfo.getTherapyEnum())) {
longDrordFlag = Whether.YES.getCode();
} else {
longDrordFlag = Whether.NO.getCode();
}
// 根据医保类别,判断目录类别
String hilistType = null;
if (YbMedChrgItmType.WEST_MEDICINE.getValue().equals(orderInfo.getYbType())
|| YbMedChrgItmType.CHINESE_MEDICINE_FEE.getValue().equals(orderInfo.getYbType())) {
hilistType = YbListType.WESTERN_AND_CHINESE_PATENT_MEDICINE.getValue();
} else if (YbMedChrgItmType.CHINESE_MEDICINE_SLICES_FEE.getValue().equals(orderInfo.getYbType())) {
hilistType = YbListType.IMPORTANT_HERBAL_SLICES.getValue();
}
return new Yb3101InputFsiOrderDto()
// 处方(医嘱)标识:处方(医嘱)记录唯一ID
.setRxId(orderInfo.getRxId())
// 处方号
.setRxno(orderInfo.getRxno())
// 组编号
.setGrpno(orderInfo.getGrpno())
// 是否为长期医嘱:[1=是,0=否]
.setLongDrordFlag(longDrordFlag)
// 目录类别:参考字典表
.setHilistType(hilistType)
// 收费类别:参考字典表
.setChrgType(orderInfo.getYbType())
// 医嘱行为:参考字典表
.setDrordBhvr(YbDrordBhvr.OTHER.getValue())
// 医保目录代码:国家统一标准编码
.setHilistCode(orderInfo.getHilistCode())
// 医保目录名称:国家统一标准名称
.setHilistName(orderInfo.getHilistName())
// 医保目录(药品)剂型:国家统一标准药品剂型
.setHilistDosform(orderInfo.getHilistDosform())
// 医保目录等级
.setHilistLv(orderInfo.getHilistLv())
// 医保目录价格,暂时取本系统单价
.setHilistPric(orderInfo.getPric())
// 医院目录代码
.setHosplistCode(orderInfo.getHilistCode())
// 医院目录名称
.setHosplistName(orderInfo.getHilistName())
// 医院目录(药品)剂型
.setHosplistDosform(orderInfo.getHilistDosform())
// 数量
.setCnt(BigDecimal.valueOf(orderInfo.getCnt()))
// 单价
.setPric(orderInfo.getPric())
// 总费用
.setSumamt(orderInfo.getSumamt())
// 自费金额
.setOwnpayAmt(BigDecimal.ZERO) // TODO:从哪取啊,住院有(但表还没建),门诊没有
// 自付金额
.setSelfpayAmt(BigDecimal.ZERO) // TODO:从哪取啊,住院有(但表还没建),门诊没有
// 规格例如0.25g×12片/盒
.setSpec(orderInfo.getSpec())
// 数量单位:例如:盒
.setSpecUnt(orderInfo.getSpecUnt())
// 医嘱开始日期格式yyyy-MM-dd HH:mm:ss
.setDrordBegnDate(orderInfo.getDrordBegnDate())
// 下达医嘱的科室标识
.setDrordDeptCodg(orderInfo.getDrordDeptCodg())
// 下达医嘱科室名称
.setDrordDeptName(orderInfo.getDrordDeptName())
// 开处方(医嘱)医生标识
.setDrordDrCodg(orderInfo.getDrordDrCodg())
// 开处方(医嘱)医生姓名
.setDrordDrName(orderInfo.getDrordDrName())
// 开处方(医嘱)医职称:参考字典表
.setDrordDrProfttl(orderInfo.getDrordDrProfttl())
// 是否当前处方(医嘱):本次处方(医嘱)标记[1=是,0=否]
.setCurrDrordFlag(Whether.YES.getCode());
}
/**
* 【3101】创建就诊信息
*
* @param encounterPatientInfo 就诊患者信息
* @param fsiDiagnoseDtos 诊断信息集合
* @param fsiOrderDtos 处方(医嘱)信息集合
* @return 就诊信息
*/
private Yb3101InputFsiEncounterDto createYb3101InputFsiEncounterDto(
Yb3101AdapterEncounterPatientInfo encounterPatientInfo, List<Yb3101InputFsiDiagnoseDto> fsiDiagnoseDtos,
List<Yb3101InputFsiOrderDto> fsiOrderDtos) {
// 判断出院时间,如果为空,默认当天下午四点
if (encounterPatientInfo.getDscgDate() == null) {
encounterPatientInfo.setDscgDate(getFourPmDate(encounterPatientInfo.getAdmDate()));
}
// 提取主诊断
Yb3101InputFsiDiagnoseDto mainDiagnose =
fsiDiagnoseDtos.stream().filter(e -> Whether.YES.getCode().equals(e.getMaindiseFlag())).findFirst()
.orElse(new Yb3101InputFsiDiagnoseDto());
// 计算总费用
BigDecimal medfeeSumamt =
fsiOrderDtos.stream().map(Yb3101InputFsiOrderDto::getSumamt).reduce(BigDecimal.ZERO, BigDecimal::add);
// 作成就诊信息
return new Yb3101InputFsiEncounterDto()
// 就诊标识就诊记录唯一ID
.setMdtrtId(encounterPatientInfo.getMdtrtId())
// 医疗服务机构标识定点医疗机构ID
.setMedinsId(encounterPatientInfo.getMedinsId())
// 医疗机构名称
.setMedinsName(encounterPatientInfo.getMedinsName())
// 医疗机构行政区划编码
.setMedinsAdmdvs(encounterPatientInfo.getMedinsAdmdvs())
// 医疗服务机构类型:参考字典表
.setMedinsType(YbMedinsType.FIXMEDINS_TYPE1.getValue())
// 医疗机构等级:参考字典表
.setMedinsLv(TenantOptionUtil.getOptionContent(TenantOptionDict.MEDINS_LV))
// 入院日期
.setAdmDate(encounterPatientInfo.getAdmDate())
// 出院日期
.setDscgDate(encounterPatientInfo.getDscgDate())
// 主诊断编码例如I63.9
.setDscgMainDiseCodg(mainDiagnose.getDiseCodg())
// 主诊断名称:例如:脑梗塞
.setDscgMainDiseName(mainDiagnose.getDiseName())
// 诊断信息集合
.setFsiDiagnoseDtos(fsiDiagnoseDtos)
// 医师标识医生唯一ID
.setDrCodg(encounterPatientInfo.getDrCodg())
// 入院科室标识科室唯一ID
.setAdmDeptCodg(encounterPatientInfo.getAdmDeptCodg())
// 入院科室名称
.setAdmDeptName(encounterPatientInfo.getAdmDeptName())
// 出院科室标识科室唯一ID
.setDscgDeptCodg(encounterPatientInfo.getDscgDeptCodg())
// 出院科室名称
.setDscgDeptName(encounterPatientInfo.getDscgDeptName())
// 就诊类型:参考字典表
.setMedMdtrtType(Optional.ofNullable(YbMedType.getByValue(encounterPatientInfo.getMedType()))
.orElse(YbMedType.GENERAL_OUTPATIENT).getYbMedMdtrtType().getValue())
// 医疗类别:参考字典表
.setMedType(encounterPatientInfo.getMedType())
// 处方(医嘱)信息集合
.setFsiOrderDtos(fsiOrderDtos)
// 生育状态:参考字典表
.setMatnStas(YbMatnStas.UNKNOWN.getValue())
// 总费用
.setMedfeeSumamt(medfeeSumamt)
// 自费金额
.setOwnpayAmt(encounterPatientInfo.getOwnpayAmt())
// 自付金额
.setSelfpayAmt(encounterPatientInfo.getSelfpayAmt())
// 结算总次数
.setSetlTotlnum(encounterPatientInfo.getSetlTotlnum())
// 险种:参考字典表
.setInsutype(encounterPatientInfo.getInsutype())
// 报销标志:参考字典表
.setReimFlag(YbPayLoc.PAY_LOC1.getValue())
// 异地结算标志:参考字典表
.setOutSetlFlag(Whether.NO.getCode());
}
/**
* 【3101】创建参保人信息
*
* @param encounterPatientInfo 就诊患者信息
* @param fsiEncounterDto 就诊信息
* @return 参保人信息
*/
private Yb3101InputPatientDto createYb3101InputPatientDto(Yb3101AdapterEncounterPatientInfo encounterPatientInfo,
Yb3101InputFsiEncounterDto fsiEncounterDto) {
// 作成参保人信息
return new Yb3101InputPatientDto()
// 参保人标识参保人唯一ID
.setPatnId(encounterPatientInfo.getPatnId())
// 姓名
.setPatnName(encounterPatientInfo.getPatnName())
// 性别:参考字典表
.setGend(encounterPatientInfo.getGend())
// 出生日期格式yyyy-MM-dd
.setBrdy(encounterPatientInfo.getBrdy())
// 统筹区编码:参保人所属统筹区
.setPoolarea(encounterPatientInfo.getPoolarea())
// 当前就诊标识本次就诊记录唯一ID
.setCurrMdtrtId(encounterPatientInfo.getMdtrtId())
// 就诊信息集合
.setFsiEncounterDtos(List.of(fsiEncounterDto));
}
/**
* 创建规则分析信息
*
* @param patientDto 参保人信息
* @param trigScen 触发场景
* @return 规则分析信息
*/
private Yb3101InputData createYb3101InputData(Yb3101InputPatientDto patientDto, String trigScen) {
// 作成规则分析信息
return new Yb3101InputData()
// 系统编码:调用方系统简码标识
.setSyscode("sys01")
// 参保人信息
.setPatientDtos(List.of(patientDto))
// 触发场景此值与ruleIds指定其一即可,请优先指定此值
.setTrigScen(trigScen);
}
/**
* 获取指定日期当天的下午四点16:00的日期
*
* @param inputDate 指定日期
* @return 当天的下午四点16:00的日期
*/
private Date getFourPmDate(Date inputDate) {
ZonedDateTime inputZdt = inputDate.toInstant().atZone(ZoneId.systemDefault());
LocalDate datePart = inputZdt.toLocalDate();
LocalTime fourPm = LocalTime.of(16, 0);
LocalDateTime fourPmLocalDateTime = LocalDateTime.of(datePart, fourPm);
ZonedDateTime fourPmZdt = fourPmLocalDateTime.atZone(ZoneId.systemDefault());
return Date.from(fourPmZdt.toInstant());
}
}

View File

@@ -1,657 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import com.core.common.enums.DeleteFlag;
import com.core.common.utils.SecurityUtils;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.YbCommonConstants;
import com.openhis.workflow.domain.ElepMedicationRequest;
import com.openhis.workflow.service.IElepMedicationRequestService;
import com.openhis.ybcatalog.domain.CatalogDrugInfo;
import com.openhis.ybcatalog.service.ICatalogDrugInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.utils.DateUtils;
import com.openhis.administration.domain.*;
import com.openhis.administration.service.*;
import com.openhis.clinical.domain.Condition;
import com.openhis.clinical.domain.ConditionDefinition;
import com.openhis.clinical.service.IConditionDefinitionService;
import com.openhis.clinical.service.IConditionService;
import com.openhis.common.enums.*;
import com.openhis.common.enums.ybenums.*;
import com.openhis.medication.domain.Medication;
import com.openhis.medication.domain.MedicationDefinition;
import com.openhis.medication.service.IMedicationDefinitionService;
import com.openhis.medication.service.IMedicationService;
import com.openhis.yb.domain.ClinicReg;
import com.openhis.yb.service.IRegService;
import com.openhis.ybelep.domain.*;
import com.openhis.ybelep.service.IElepVeriPrescriptionInfoService;
import com.openhis.ybelep.service.IElepVeriVisitInfoService;
/**
* 医保接口调用工具
*
* @author yuxj
* @date 2025-04-17
*/
@Component
public class YbEleParamBuilderUtil {
/********************* 业务实体服务 *******************/
// 就诊管理服务
@Autowired
IEncounterService iEncounterService;
@Autowired
IElepMedicationRequestService elepMedicationRequestService;
// 就诊管理
@Autowired
IAccountService accountService;
@Autowired
IMedicationDefinitionService medicationDefinitionService;
@Autowired
ICatalogDrugInfoService catalogDrugInfoService;
@Autowired
IEncounterDiagnosisService encounterDiagnosisService;
@Autowired
IEncounterService encounterService;
@Autowired
IPatientService patientService;
@Autowired
IOrganizationService organizationService;
@Autowired
IPractitionerService practitionerService;
@Autowired
IPractitionerRoleService practitionerRoleService;
@Autowired
IConditionService conditionService;
@Autowired
IConditionDefinitionService conditionDefinitionService;
/********************* 医保实体服务 *******************/
@Autowired
IRegService iRegService;
@Autowired
IElepVeriPrescriptionInfoService eleVerPreInfoService;
@Autowired
IElepVeriVisitInfoService eleVerVisInfoService;
/**
* 获取处方信息
*
* @param medicationRequest 处方信息
* @param patient 患者信息
* @param tenantId 租户Id
* @return 处方信息
*/
public PreCheckPrescription getEleVeriPrescriptionInfo(ElepMedicationRequest medicationRequest, Patient patient,
Integer tenantId) {
// 声明处方信息对象
PreCheckPrescription elepVeriPrescriptionInfo = new PreCheckPrescription();
elepVeriPrescriptionInfo.setMdtrtCertType("02")
.setMdtrtCertNo(patient.getIdCard())
// 01-定点医疗机构就诊
.setBizTypeCode("01").setHospRxno(medicationRequest.getPrescriptionNo())
.setRxTypeCode(medicationRequest.getRxTypeCode().toString()).setPrscTime(medicationRequest.getIssueTime())
// 处方有效天数
.setValiDays(medicationRequest.getValidityDays().toString())
// 计算截止时间
.setValiEndTime(DateUtils.addDays(medicationRequest.getIssueTime(), medicationRequest.getValidityDays()));
// 就诊凭证类型为03”时,填写社会保障卡卡号
if (elepVeriPrescriptionInfo.getMdtrtCertType() == YbMdtrtCertType.MDTRT_CERT_TYPE03.getValue()) {
Account account = accountService.getOne(
new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, medicationRequest.getEncounterId())
.eq(Account::getTypeCode, AccountType.SOCIAL_SECURITY_CARD.getValue())
.eq(Account::getTenantId, tenantId));
if (account == null) {
return null;
}
// 设置社会保障卡号
elepVeriPrescriptionInfo.setCardSn(account.getNo());
}
// todo 药品类目数(剂数):西药、中成药时为药品的类目数量
// 西药、中成药对应的处方类别list
List<Integer> westernOrChineseList = new ArrayList<>();
westernOrChineseList.add(Integer.parseInt(YbRxItemTypeCode.WESTERN_MEDICINE.getValue()));
westernOrChineseList.add(Integer.parseInt(YbRxItemTypeCode.CHINESE_PATENT_MEDICINE.getValue()));
// 调用 count 方法
Long countWesternOrChinese = elepMedicationRequestService
.selectWesternOrChineseCount(medicationRequest.getPrescriptionNo(), westernOrChineseList, tenantId);
// 西药、中成药时为药品的类目数量
elepVeriPrescriptionInfo.setRxDrugCnt(countWesternOrChinese.toString())
.setRxUsedWayCodg(medicationRequest.getMedRoute())
.setRxUsedWayName(YbDrugMedWay.getByValue(medicationRequest.getMedRoute()).getDescription());
return elepVeriPrescriptionInfo;
}
/**
* 获取处方明细信息
*
* @param prescriptionNo 处方号
* @param tenantId 租户Id
* @return 处方明细信息
*/
public List<ElepVeriPrescriptionDetail> getEleVeriPrescriptionDetail(String prescriptionNo, Integer tenantId) {
// 查询该处方所有中药饮片
List<ElepMedicationRequest> materialObjs = elepMedicationRequestService.list(new LambdaQueryWrapper<ElepMedicationRequest>()
.eq(ElepMedicationRequest::getPrescriptionNo, prescriptionNo).eq(ElepMedicationRequest::getTenantId, tenantId));
// 未查到返回空
if (materialObjs == null) {
return null;
}
List<ElepVeriPrescriptionDetail> eleDetList = new ArrayList<>();
// 遍历 materialObjs 列表
for (ElepMedicationRequest materialObj : materialObjs) {
CatalogDrugInfo mObj = catalogDrugInfoService.getOne(new LambdaQueryWrapper<CatalogDrugInfo>()
.eq(CatalogDrugInfo::getMedicalCatalogCode, materialObj.getMedicationId()).orderByDesc(CatalogDrugInfo::getCreatedAt).last("LIMIT 1"));
// 未查到返回空
if (mObj == null) {
return null;
}
ElepVeriPrescriptionDetail eleObj = new ElepVeriPrescriptionDetail();
eleObj.setMedListCodg(mObj.getMedicalCatalogCode())
.setDrugGenname(mObj.getRegisteredName()).setDrugDosform(mObj.getDrugForm())
.setDrugSpec(mObj.getDrugSpecification()).setMedcBegntime(materialObj.getEffectiveDoseStart())
.setMedcEndtime(materialObj.getEffectiveDoseEnd())
.setMedcDays(materialObj.getDispensePerDuration().toString())
.setDrugDosunt(materialObj.getUnitCode()).setDrugCnt(materialObj.getQuantity().toString())
// todo 医院审批标志,配合目录的限制使用标志使用(目前吉林省不启用),暂时先写死
.setHospApprFlag("0")
// 院内内部处方号
.setPrescriptionNo(prescriptionNo)
.setRxItemTypeCode(materialObj.getRxItemTypeCode().toString())
.setRxItemTypeName(YbRxItemTypeCode.getByValue(materialObj.getRxItemTypeCode().toString()).getDescription())
.setMedcWayCodg(materialObj.getMedRoute())
.setMedcWayDscr(YbDrugMedWay.getByValue(materialObj.getMedRoute()).getDescription())
.setSinDoscnt(materialObj.getMedDosage().stripTrailingZeros().toPlainString()).setSinDosunt(materialObj.getMedDosageUnitCode())
.setUsedFrquCodg(materialObj.getMedFrequency())
.setUsedFrquName(YbUsedFrqu.getByValue(materialObj.getMedFrequency()).getDescription());
eleDetList.add(eleObj);
}
return eleDetList;
}
/**
* 获取就诊信息和诊断信息
*
* @param medicationRequest 处方信息
* @param clinicReg 医保挂号保存的信息
* @param tenantId 租户Id
* @return 处方明细信息
*/
public PreCheckPrescription getEleVeriVisitAndDiagnosisInfo(ElepMedicationRequest medicationRequest,
ClinicReg clinicReg, Integer tenantId) {
// 电子处方上传预核验信息
PreCheckPrescription preCheckPrescription = new PreCheckPrescription();
// 获取就诊诊断信息
EncounterDiagnosis encDiagObjs =
encounterDiagnosisService.getOne(new LambdaQueryWrapper<EncounterDiagnosis>()
.eq(EncounterDiagnosis::getEncounterId, medicationRequest.getEncounterId())
.eq(EncounterDiagnosis::getTenantId, tenantId).eq(EncounterDiagnosis::getConditionId,medicationRequest.getConditionId())
.eq(EncounterDiagnosis::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
// 就诊管理
Encounter encounter = encounterService.getOne(new LambdaQueryWrapper<Encounter>()
.eq(Encounter::getId, medicationRequest.getEncounterId()));
// 患者信息
Patient patient = patientService.getOne(new LambdaQueryWrapper<Patient>()
.eq(Patient::getId, encounter.getPatientId()).eq(Patient::getTenantId, tenantId));
// 医生所属科室
Organization organization = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, medicationRequest.getOrgId()).eq(Organization::getTenantId, tenantId));
// 就诊诊断所属科室
Organization orgDis = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, encounter.getOrganizationId()).eq(Organization::getTenantId, tenantId));
// 医生信息
Practitioner practitioner = practitionerService.getOne(new LambdaQueryWrapper<Practitioner>()
.eq(Practitioner::getId, medicationRequest.getPrescribingDrId()).eq(Practitioner::getTenantId, tenantId));
// 医生详细信息
Practitioner praRole = practitionerService.getOne(new LambdaQueryWrapper<Practitioner>()
.eq(Practitioner::getId, medicationRequest.getPrescribingDrId())
.eq(Practitioner::getTenantId, tenantId));
// 医生所属科室信息
Organization orgDor = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, praRole.getOrgId()).eq(Organization::getTenantId, tenantId));
if (encDiagObjs == null || encounter == null || patient == null || organization == null || orgDis == null
|| practitioner == null || praRole == null || orgDor == null) {
return null;
}
// 门诊/住院判断
String otpIptFlag = "";
if (encounter.getClassEnum() == EncounterClass.AMB.getValue()) {
otpIptFlag = YbEncounterClass.AMB.getValue();
} else if (encounter.getClassEnum() == EncounterClass.IMP.getValue()) {
otpIptFlag = YbEncounterClass.IMP.getValue();
}
String fixmedinsCode = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsName = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_NAME);
// 1-输入-就诊信息
ElepVeriVisitInfo eleInfo = new ElepVeriVisitInfo();
// 诊断信息
Condition condition = conditionService.getOne(new LambdaQueryWrapper<Condition>()
.eq(Condition::getId, encDiagObjs.getConditionId()).eq(Condition::getTenantId, tenantId));
// 诊断定义
ConditionDefinition cdObj = conditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
.eq(ConditionDefinition::getId, condition.getDefinitionId())
.eq(ConditionDefinition::getTenantId, tenantId));
if (condition == null || cdObj == null) {
return null;
}
// 以挂号时间为截至时间,计算年龄
BigDecimal age = calculateAge(patient.getBirthDate(), clinicReg.getBegntime());
eleInfo.setFixmedinsCode(fixmedinsCode).setFixmedinsName(fixmedinsName).setMdtrtId(clinicReg.getMdtrtId())
.setIptOtpNo(clinicReg.getIptOtpNo()).setOtpIptFlag(otpIptFlag)
.setPsnNo(clinicReg.getPsnNo()).setPatnName(patient.getName()).setCertno(patient.getIdCard())
// todo 目前默认都是身份证:01
.setPsnCertType(YbIdDocumentType.RESIDENT_ID_CARD.getValue()).setPatnAge(age.toString())
.setPrscDeptName(organization.getName()).setPrscDeptCode(organization.getYbNo())
.setDrCode(practitioner.getYbNo()).setPrscDrName(praRole.getName())
.setDrProfttlCodg(practitioner.getDrProfttlCode())
.setDrProfttlName(YbDoctorTitle.getByValue(practitioner.getDrProfttlCode()).getDescription())
.setDrDeptCode(orgDor.getYbNo()).setDrDeptName(orgDor.getName()).setMdtrtTime(encounter.getReceptionTime())
// 院内内部处方号
.setPrescriptionNo(medicationRequest.getPrescriptionNo());
if (clinicReg.getMedType() == null) {
eleInfo.setMedType("11");
} else {
eleInfo.setMedType(clinicReg.getMedType());
}
// 性别
if (patient.getGenderEnum() == AdministrativeGender.FEMALE.getValue()) {
eleInfo.setGend(YbGender.FEMALE.getValue());
} else if (patient.getGenderEnum() == AdministrativeGender.MALE.getValue()) {
eleInfo.setGend(YbGender.MALE.getValue());
} else {
eleInfo.setGend(YbGender.UNKNOWN.getValue());
}
// 特殊病种标志 2025/05/24 该字段不为空是特殊病种给yes
if (encDiagObjs.getMedTypeCode() != null) {
eleInfo.setSpDiseFlag(Whether.YES.getCode());
} else {
eleInfo.setSpDiseFlag(Whether.NO.getCode());
}
// 主诊断标记
// if (encDiagObjs.getMaindiseFlag() == Whether.YES.getValue()) {
eleInfo.setMaindiagCode(cdObj.getYbNo()).setMaindiagName(cdObj.getName());
// }
// 2-输入-诊断信息
ElepVeriDiagnosisInfo eleVerDisInfo = new ElepVeriDiagnosisInfo();
eleVerDisInfo.setDiagType(cdObj.getTypeCode()).setDiagSrtNo(encDiagObjs.getDiagSrtNo().toString())
.setDiagCode(cdObj.getYbNo()).setDiagName(cdObj.getName()).setDiagDept(orgDis.getName())
.setDiagDrNo(practitioner.getYbNo()).setDiagDrName(praRole.getName())
.setDiagTime(encounter.getReceptionTime())
// 院内内部处方号
.setPrescriptionNo(medicationRequest.getPrescriptionNo());
// 主诊断标记
// if (encDiagObjs.getMaindiseFlag() == Whether.YES.getValue()) {
eleVerDisInfo.setMaindiagFlag(Whether.YES.getValue().toString());
// } else {
// eleVerDisInfo.setMaindiagFlag(Whether.NO.getValue().toString());
// }
preCheckPrescription.setMdtrtinfo(eleInfo).setDiseinfo(eleVerDisInfo);
return preCheckPrescription;
}
/**
* 做成电子处方医保电子签名入参
*
* @param pcpResult 电子处方上传预核验的相响应参数
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 处方信息
*/
public ElepSignatureInput getEleSignatureInput(ElepVeriPrescriptionOutput pcpResult, Long practitionerId,
Date checkDate, Integer tenantId) {
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String targetDateStr = targetFormat.format(checkDate);
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
String outputPath = optionJson.getString(CommonConstants.Option.OUTPUT_PATH);
String fixmedinsCode = optionJson.getString(CommonConstants.Option.FIXMEDINS_CODE);
String fixmedinsName = optionJson.getString(CommonConstants.Option.FIXMEDINS_NAME);
// 审方药师信息
Practitioner practitioner = practitionerService.getOne(new LambdaQueryWrapper<Practitioner>()
.eq(Practitioner::getUserId, practitionerId).eq(Practitioner::getTenantId, tenantId));
// 审方药师所属科室信息
Organization orgDor = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, practitioner.getOrgId()).eq(Organization::getTenantId, tenantId));
// 电子处方上传预核验-输入-输入-就诊信息
List<ElepVeriVisitInfo> eleVerVisInfo = eleVerVisInfoService.list(new LambdaQueryWrapper<ElepVeriVisitInfo>()
.eq(ElepVeriVisitInfo::getPrescriptionNo, pcpResult.getPrescriptionNo())
.orderByDesc(ElepVeriVisitInfo::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (practitioner == null || orgDor == null || eleVerVisInfo == null) {
return null;
}
// 原始待签名处方信息
JSONObject cpdata = new JSONObject();
// 1 rxTraceCode 处方追溯码 字符型 20 Y
cpdata.put("rxTraceCode", pcpResult.getRxTraceCode());
// 2 hiRxno 医保处方编号 字符型 30 Y
cpdata.put("hiRxno", pcpResult.getHiRxno());
// 3 mdtrtId 医保就诊 ID 字符型 30 Y
cpdata.put("mdtrtId", eleVerVisInfo.get(0).getMdtrtId());
// 4 patnName 患者姓名 字符型 40 Y
cpdata.put("patnName", eleVerVisInfo.get(0).getPatnName());
// 5 psnCertType 人员证件类型 字符型 6 Y Y //todo 默认身份证:01
cpdata.put("psnCertType", YbIdDocumentType.RESIDENT_ID_CARD.getValue());
// 6 certno 证件号码 字符型 50 Y
cpdata.put("certno", eleVerVisInfo.get(0).getCertno());
// 7 fixmedinsName 定点医疗机构名称 字符型 200 Y
cpdata.put("fixmedinsName", fixmedinsName);
// 8 fixmedinsCode 定点医疗机构编号 字符型 20 Y
cpdata.put("fixmedinsCode", fixmedinsCode);
// 9 drCode 开方医保医师代码 字符型 20 Y
cpdata.put("drCode", eleVerVisInfo.get(0).getDrCode());
// 10 prscDrName 开方医师姓名 字符型 50 Y
cpdata.put("prscDrName", eleVerVisInfo.get(0).getPrscDrName());
// 11 pharDeptName 审方药师科室名称 字符型 50 Y
cpdata.put("pharDeptName", orgDor.getName());
// 12 pharDeptCode 审方药师科室编号 字符型 30 Y
cpdata.put("pharDeptCode", orgDor.getYbNo());
// 13 pharProfttlCodg 审方药师职称编码 字符型 20 Y N
cpdata.put("pharProfttlCodg", practitioner.getDrProfttlCode() == null ? "" : practitioner.getDrProfttlCode());
// 14 pharProfttlName 审方药师职称名称 字符型 20
cpdata.put("pharProfttlName", practitioner.getDrProfttlCode() == null ? ""
: YbPharmacistTitle.getByValue(practitioner.getDrProfttlCode()).getDescription());
// 15 pharCode 审方医保药师代码 字符型 20 Y
cpdata.put("pharCode", practitioner.getYbNo());
// 16 pharCertType 审方药师证件类型 字符型 6 Y N
cpdata.put("pharCertType", "");
// 17 pharCertno 审方药师证件号码 字符型 50 N
cpdata.put("pharCertno", "");
// 18 pharName 审方药师姓名 字符型 50 Y
cpdata.put("pharName", practitioner.getName());
// 19 pharPracCertNo 审方药师执业资格证号 字符型 50
cpdata.put("pharPracCertNo", "");
// 20 pharChkTime 医疗机构药师审方时间 日期时间型 Y yyyy-MM-dd HH:mm:ss
cpdata.put("pharChkTime", targetDateStr);
// 使用 TreeMap 对键进行排序
TreeMap<String, Object> sortedMap = new TreeMap<>();
for (String key : cpdata.keySet()) {
sortedMap.put(key, cpdata.get(key));
}
// 重新构建排序后的 JSONObject
JSONObject sortedCpdata = new JSONObject(sortedMap);
// 将 cpdata 转换为 JSON 字符串
String jsonString = sortedCpdata.toString();
// 将 JSON 字符串编码为 Base64 字符串
String base64EncodedString = Base64.getEncoder().encodeToString(jsonString.getBytes());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 定义格式yyyyMMdd
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
// 格式化日期
String formattedDate = currentDate.format(formatter);
String folderPath = outputPath + formattedDate + "\\"; // Windows 绝对路径,注意末尾的反斜杠
String fileName = pcpResult.getPrescriptionNo() + ".pdf"; // 文件名由处方号拼接而成
// 拼接完整的文件路径
String filePath = folderPath + fileName;
// 调用方法读取文件内容并获取 Base64 字符值
String base64Content = fileToBase64(filePath);
ElepSignatureInput eleSinIn = new ElepSignatureInput();
eleSinIn.setFixmedinsCode(fixmedinsCode).setOriginalValue(base64EncodedString).setOriginalRxFile(base64Content)
// 医保处方编号
.setHiRxno(pcpResult.getHiRxno()).setPrescriptionNo(pcpResult.getPrescriptionNo());
return eleSinIn;
}
/**
* 做成电子处方上传入参
*
* @param pcpResult 电子处方上传预核验的相响应参数
* @param esResult 电子处方医保电子签名响应出参
* @param practitionerId 审方药师Id
* @param checkDate 审方时间
* @param tenantId 租户Id
* @return 电子处方上传入参
*/
public ElepUploadInput getEleUploadInput(ElepVeriPrescriptionOutput pcpResult, ElepSignatureOutput esResult,
Long practitionerId, Date checkDate, Integer tenantId) {
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String targetDateStr = targetFormat.format(checkDate);
// 审方药师信息
Practitioner practitioner = practitionerService.getOne(new LambdaQueryWrapper<Practitioner>()
.eq(Practitioner::getUserId, practitionerId).eq(Practitioner::getTenantId, tenantId));
// 审方药师所属科室信息
Organization orgDor = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, practitioner.getOrgId()).eq(Organization::getTenantId, tenantId));
// 电子处方上传预核验-输入-输入-就诊信息
List<ElepVeriVisitInfo> eleVerVisInfo = eleVerVisInfoService.list(new LambdaQueryWrapper<ElepVeriVisitInfo>()
.eq(ElepVeriVisitInfo::getPrescriptionNo, pcpResult.getPrescriptionNo())
.orderByDesc(ElepVeriVisitInfo::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (practitioner == null || orgDor == null || eleVerVisInfo == null) {
return null;
}
ElepUploadInput eleUploadInput = new ElepUploadInput();
eleUploadInput.setRxTraceCode(pcpResult.getRxTraceCode()).setHiRxno(pcpResult.getHiRxno())
.setMdtrtId(eleVerVisInfo.get(0).getMdtrtId()).setPatnName(eleVerVisInfo.get(0).getPatnName())
// todo 默认身份类型是身份证01
.setPsnCertType(YbIdDocumentType.RESIDENT_ID_CARD.getValue()).setCertno(eleVerVisInfo.get(0).getCertno()).setPatnName(eleVerVisInfo.get(0).getPatnName())
.setFixmedinsCode(eleVerVisInfo.get(0).getFixmedinsCode()).setFixmedinsName(eleVerVisInfo.get(0).getFixmedinsName())
.setDrCode(eleVerVisInfo.get(0).getDrCode()).setPrscDrName(eleVerVisInfo.get(0).getPrscDrName())
.setPharDeptCode(orgDor.getYbNo()).setPharDeptName(orgDor.getName()).setPharCode(practitioner.getYbNo())
.setPharName(practitioner.getName()).setPharChkTime(targetDateStr).setRxFile(esResult.getRxFile())
.setSignDigest(esResult.getSignDigest()).setPharProfttlCodg(practitioner.getDrProfttlCode()).setPharProfttlName(YbPharmacistTitle.getByValue(practitioner.getDrProfttlCode()).getDescription());
return eleUploadInput;
}
/**
* 做成电子处方撤销入参
*
* @param pcpResult 电子处方上传预核验的相响应参数
* @param euResult 电子处方上传响应出参
* @param practitionerId 撤销药师Id
* @param description 撤销原因
* @param revokeDate 撤销时间
* @param tenantId 租户Id
* @return 电子处方撤销入参
*/
public ElepRevokeInput getElepRevokeInput(ElepVeriPrescriptionOutput pcpResult, ElepUploadOutput euResult,
Long practitionerId, String description, Date revokeDate, Integer tenantId) {
// 撤销时药师信息
Practitioner practitioner = practitionerService.getOne(new LambdaQueryWrapper<Practitioner>()
.eq(Practitioner::getUserId, practitionerId).eq(Practitioner::getTenantId, tenantId));
// 撤销时药师所属科室信息
Organization orgDor = organizationService.getOne(new LambdaQueryWrapper<Organization>()
.eq(Organization::getId, practitioner.getOrgId()).eq(Organization::getTenantId, tenantId));
// 电子处方上传预核验-输入-输入-就诊信息
List<ElepVeriVisitInfo> eleVerVisInfo = eleVerVisInfoService.list(new LambdaQueryWrapper<ElepVeriVisitInfo>()
.eq(ElepVeriVisitInfo::getPrescriptionNo, pcpResult.getPrescriptionNo())
.orderByDesc(ElepVeriVisitInfo::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (practitioner == null || orgDor == null || eleVerVisInfo == null) {
return null;
}
ElepRevokeInput eleRevokeInput = new ElepRevokeInput();
eleRevokeInput.setHiRxno(pcpResult.getHiRxno()).setFixmedinsCode(eleVerVisInfo.get(0).getFixmedinsCode())
.setDrCode(practitioner.getYbNo()).setUndoDrName(practitioner.getName())
// todo 默认身份类型是身份证01
.setUndoDrCertno(practitioner.getPharPracCertNo())
.setUndoDrCertType(YbIdDocumentType.RESIDENT_ID_CARD.getValue()).setUndoRea(description).setUndoTime(revokeDate);
return eleRevokeInput;
}
/**
* 做成电子处方信息查询入参
*
* @param pcpResult 电子处方上传预核验的相响应参数
* @return 电子处方信息查询入参
*/
public ElepQuerPrescriptionInput getEleQueryPrescriptionInput(ElepVeriPrescriptionOutput pcpResult) {
// 电子处方上传预核验-输入-输入-就诊信息
List<ElepVeriVisitInfo> eleVerVisInfo = eleVerVisInfoService.list(new LambdaQueryWrapper<ElepVeriVisitInfo>()
.eq(ElepVeriVisitInfo::getPrescriptionNo, pcpResult.getPrescriptionNo())
.orderByDesc(ElepVeriVisitInfo::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (eleVerVisInfo == null) {
return null;
}
ElepQuerPrescriptionInput eleQueryPreObj = new ElepQuerPrescriptionInput();
eleQueryPreObj.setFixmedinsCode(eleVerVisInfo.get(0).getFixmedinsCode()).setHiRxno(pcpResult.getHiRxno())
.setMdtrtId(eleVerVisInfo.get(0).getMdtrtId()).setPsnName(eleVerVisInfo.get(0).getPatnName())
// todo 默认身份类型是身份证01
.setPsnCertType(YbIdDocumentType.RESIDENT_ID_CARD.getValue()).setCertno(eleVerVisInfo.get(0).getCertno());
return eleQueryPreObj;
}
/**
* 做成电子处方信息查询入参
*
* @param pcpResult 电子处方上传预核验的相响应参数
* @return 电子处方信息查询入参
*/
public ElepMedresultInput getEleMedResultInput(ElepVeriPrescriptionOutput pcpResult) {
// 电子处方上传预核验-输入-输入-就诊信息
List<ElepVeriVisitInfo> eleVerVisInfo = eleVerVisInfoService.list(new LambdaQueryWrapper<ElepVeriVisitInfo>()
.eq(ElepVeriVisitInfo::getPrescriptionNo, pcpResult.getPrescriptionNo())
.orderByDesc(ElepVeriVisitInfo::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (eleVerVisInfo == null) {
return null;
}
ElepMedresultInput eleQueryPreObj = new ElepMedresultInput();
eleQueryPreObj.setHiRxno(pcpResult.getHiRxno()).setFixmedinsCode(eleVerVisInfo.get(0).getFixmedinsCode())
.setMdtrtId(eleVerVisInfo.get(0).getMdtrtId()).setPsnName(eleVerVisInfo.get(0).getPatnName())
// todo 默认身份类型是身份证01
.setPsnCertType(YbIdDocumentType.RESIDENT_ID_CARD.getValue()).setCertno(eleVerVisInfo.get(0).getCertno());
return eleQueryPreObj;
}
/**
* 获取BigDecimal类型的年龄
*
* @param birthDate 出生日期
* @param beginTime 计算起始日期
* @return 年龄
*/
public static BigDecimal calculateAge(Date birthDate, Date beginTime) {
// 验证输入参数是否为空
if (Objects.isNull(birthDate)) {
System.out.println("出生年月日不能为空!");
return null;
}
// 验证输入参数是否为空
if (Objects.isNull(beginTime)) {
beginTime = DateUtils.getNowDate();
}
// 将 Date 转换为 LocalDate
LocalDate localBirthDate = birthDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localBeginTime = beginTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 计算出生日期到起始日期之间的年份差异
Period period = Period.between(localBirthDate, localBeginTime);
int years = period.getYears();
// 检查是否已经过了生日,如果没有过,则年份减一
boolean hasBirthdayPassed = !localBirthDate.plusYears(years).isAfter(localBeginTime);
if (!hasBirthdayPassed) {
years--;
}
return BigDecimal.valueOf(years);
}
/**
* 读取文件内容并获取其 Base64 字符值
*
* @param filePath 文件路径
* @return 文件内容的 Base64 字符值
*/
public static String fileToBase64(String filePath) {
File file = new File(filePath);
if (!file.exists()) {
System.out.println("文件不存在!");
return null;
}
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
byte[] fileContent = new byte[(int) file.length()];
fileInputStream.read(fileContent);
return Base64.getEncoder().encodeToString(fileContent);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.vo;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
/**
* 【3203】后台计算结果 DB映射实体
*
* @author SunJQ
* @date 2025-04-29
*/
@Data
public class Financial3203VO {
// 清算人次
private Long psntime;
// 医保认可费用总额数值型16位含2位小数必填
private BigDecimal medSumfee;
// 现金支付金额数值型16位含2位小数必填
private BigDecimal cashPayamt;
// 个人账户支出数值型16位含2位小数必填
private BigDecimal acctPay;
/** 医疗费用总额 */
private BigDecimal medFeeSumAmt;
/** 基金支付总额 */
private BigDecimal fundPaySumAmt;
/** 个人账户支付总额 */
private BigDecimal acctGjPay;
/** 现金支付总额 */
private BigDecimal selfPayCash;
/** 微信支付总额 */
private BigDecimal selfPayVx;
/** 阿里支付总额 */
private BigDecimal selfPayAli;
/** 银行卡支付总额 */
private BigDecimal selfPayUnion;
}

View File

@@ -1,23 +0,0 @@
package com.openhis.web.ybmanage.vo;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
public class Settlement3201DetailVO {
/** 医疗费用总额 */
private BigDecimal medFeeSumAmt;
/** 基金支付总额 */
private BigDecimal fundPaySumAmt;
/** 个人账户支付总额 */
private BigDecimal acctPay;
/** 个人账户支付总额 */
private BigDecimal acctGjPay;
/** 定点医药机构结算笔数 */
private Integer fixMedInsSetlCnt;
private String contractNo;
private Integer insutype;
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.vo;
import java.math.BigDecimal;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
* 【3201】后台计算结果 DB映射实体
*
* @author SunJQ
* @date 2025-04-15
*/
@Data
public class Settlement3201VO {
/** 医疗费用总额 */
private BigDecimal medFeeSumAmt;
/** 基金支付总额 */
private BigDecimal fundPaySumAmt;
/** 个人账户支付总额 */
private BigDecimal acctPay;
/** 个人账户支付总额 */
private BigDecimal acctGjPay;
/** 定点医药机构结算笔数 */
private Integer fixMedInsSetlCnt;
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.vo;
import java.math.BigDecimal;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
* 【3201】后台计算结果 DB映射实体
*
* @author SunJQ
* @date 2025-04-15
*/
@Data
public class Settlement3202VO {
/** 医疗费用总额 */
private BigDecimal medFeeSumAmt;
/** 基金支付总额 */
private BigDecimal fundPaySumAmt;
/** 个人账户支付总额 */
private BigDecimal acctPay;
/** 个人账户支付总额 */
private BigDecimal acctGjPay;
/** 现金支付总额 */
private BigDecimal selfPayCash;
/** 微信支付总额 */
private BigDecimal selfPayVx;
/** 阿里支付总额 */
private BigDecimal selfPayAli;
/** 银行卡支付总额 */
private BigDecimal selfPayUnion;
/** 定点医药机构结算笔数 */
private Integer fixMedInsSetlCnt;
}