提交merge1.3

This commit is contained in:
2025-12-27 15:30:25 +08:00
parent 8c607c8749
commit 088861f66e
1245 changed files with 220442 additions and 77616 deletions

View File

@@ -11,16 +11,14 @@ 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.Objects;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<<<<<<< HEAD
import com.core.common.annotation.Anonymous;
import com.openhis.web.ybmanage.dto.*;
import com.openhis.yb.domain.InpatientDischarge;
@@ -34,6 +32,9 @@ import com.openhis.yb.dto.Result;
import com.openhis.yb.dto.Settlement3201WebParam;
import com.openhis.yb.dto.Settlement3202WebParam;
import com.openhis.yb.dto.Settlement3209AWebParam;
=======
import org.springframework.beans.BeanUtils;
>>>>>>> v1.3
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -43,6 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.core.common.annotation.Anonymous;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.SecurityUtils;
@@ -56,10 +58,25 @@ import com.openhis.clinical.service.IConditionDefinitionService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.financial.domain.Contract;
import com.openhis.financial.service.IContractService;
<<<<<<< HEAD
=======
import com.openhis.web.ybmanage.dto.*;
>>>>>>> v1.3
import com.openhis.web.ybmanage.service.IYbService;
import com.openhis.yb.domain.FinancialApplyRecord;
import com.openhis.yb.domain.InfoPerson;
import com.openhis.yb.domain.InpatientDischarge;
import com.openhis.yb.domain.InpatientReg;
import com.openhis.yb.dto.*;
import com.openhis.yb.dto.Catalogue1312Output;
import com.openhis.yb.dto.Clinic2208UnSetlInfoOutput;
import com.openhis.yb.dto.Financial3203AWebParam;
import com.openhis.yb.dto.Info1101Output;
import com.openhis.yb.dto.PatientInfoDto;
import com.openhis.yb.dto.Result;
import com.openhis.yb.dto.Settlement3201WebParam;
import com.openhis.yb.dto.Settlement3202WebParam;
import com.openhis.yb.dto.Settlement3209AWebParam;
import com.openhis.yb.service.IPerinfoService;
import com.openhis.yb.service.YbDao;
import com.openhis.yb.service.YbHttpUtils;
@@ -135,8 +152,15 @@ public class YbController {
Info1101ReadcardParam readcard = ybDao.getReadCard(certType, certNo);
Info1101Output perInfo = ybHttpUtils.getPerInfo(readcard);
if (perInfo != null) {
ybDao.saveReadcardAndPerinfo(readcard, perInfo);
PatientInfoDto patient = ybDao.getPatent(perInfo);
patient.setBalc(perInfo.getBalc());
patient.setInsutype(perInfo.getInsutype());
patient.setInsuplcAdmdvs(perInfo.getInsuplcAdmdvs());
patient.setAge(perInfo.getAge());
return R.ok(patient);
} else {
return R.fail("未查询到患者信息");
@@ -585,7 +609,7 @@ public class YbController {
* @return 结果
*/
@GetMapping("/apply-un-clearing")
public R<?> cancelFinancialClearing(String clrAppyEvtId, String clrOptins) {
public R<?> cancelFinancialClearing(@RequestParam(value = "clrAppyEvtId")String clrAppyEvtId, @RequestParam(value = "clrOptins")String clrOptins) {
Financial3204Param financial3204Param = new Financial3204Param();
FinancialApplyRecord financialApplyRecord = ybDao.getFinancial3204ParamByClrAppyEvtId(clrAppyEvtId);
financial3204Param.setClrOptins(clrOptins).setClrAppyEvtId(financialApplyRecord.getOutResult());
@@ -689,47 +713,47 @@ public class YbController {
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();
}
// /**
// * 【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();
}
// /**
// * 【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】商品信息删除
@@ -775,6 +799,7 @@ public class YbController {
* @return 结果
*/
@PostMapping("/query-yb-catalogue")
@Anonymous
public R<?> queryYbCatalogue(@RequestParam String hilistCode, @RequestParam String dateStr) {
Catalogue1312QueryParam catalogue1312QueryParam = new Catalogue1312QueryParam();
catalogue1312QueryParam.setHilistCode(hilistCode);
@@ -912,6 +937,7 @@ public class YbController {
@Anonymous
public R<?> ybReturnSettle(@RequestParam("psnNo") String psnNo, @RequestParam("mdtrtId") String mdtrtId,
@RequestParam("settleId") String settleId, @RequestParam("insuplcAdmdvs") String insuplcAdmdvs,
<<<<<<< HEAD
@RequestParam("contractNo") String contractNo){
Clinic2208UnSetlInfoParam clinicSetl = new Clinic2208UnSetlInfoParam();
@@ -919,17 +945,80 @@ public class YbController {
.setInsuplcAdmdvs(insuplcAdmdvs);
Clinic2208UnSetlInfoOutput clinic2208UnSetlInfoOutput = ybHttpUtils.unSettle(clinicSetl, iContractService.getContract(contractNo));
=======
@RequestParam("contractNo") String contractNo) {
Clinic2208UnSetlInfoParam clinicSetl = new Clinic2208UnSetlInfoParam();
clinicSetl.setPsnNo(psnNo).setMdtrtId(mdtrtId).setSetlId(settleId).setInsuplcAdmdvs(insuplcAdmdvs);
Clinic2208UnSetlInfoOutput clinic2208UnSetlInfoOutput =
ybHttpUtils.unSettle(clinicSetl, iContractService.getContract(contractNo));
>>>>>>> v1.3
return R.ok(clinic2208UnSetlInfoOutput);
}
/**
<<<<<<< HEAD
=======
* 【2601】冲正
*
* @param psnNo 医保人员编号
* @param oinfno 原交易编号
* @param omsgid 原发送方报文ID
* @param contractNo 合同编号
* @return 结果
*/
@GetMapping("/yb-to-reverse")
@Anonymous
public R<?> ybToReverse(@RequestParam("psnNo") String psnNo, @RequestParam("oinfno") String oinfno,
@RequestParam("omsgid") String omsgid, @RequestParam("contractNo") String contractNo,
@RequestParam("InsuplcAdmdvs") String InsuplcAdmdvs) {
Yb2601InputParam toReverse = new Yb2601InputParam();
toReverse.setPsnNo(psnNo);
toReverse.setOinfno(oinfno);
toReverse.setOmsgid(omsgid);
toReverse.setInsuplcAdmdvs(InsuplcAdmdvs);
ybHttpUtils.ybToReverse(toReverse, iContractService.getContract(contractNo));
return R.ok(toReverse);
}
@GetMapping("/yb-2204-up")
@Anonymous
public R<?> yb2204(@RequestParam("psnNo") String psnNo, @RequestParam("oinfno") String oinfno,
@RequestParam("omsgid") String omsgid, @RequestParam("contractNo") String contractNo,
@RequestParam("InsuplcAdmdvs") String InsuplcAdmdvs) {
Clinic2204OrderParam clinic2204OrderResult = new Clinic2204OrderParam();
String s1 =
"{\"feedetl_sn\":\"530389\",\"mdtrt_id\":\"220000202511101029490122280385\",\"psn_no\":\"22000011000014958451\",\"chrg_bchno\":\"SF2511100007050575\",\"dise_codg\":\"M51.202\",\"rx_circ_flag\":\"0\",\"fee_ocur_time\":\"2025-11-10 10:28:20\",\"med_list_codg\":\"014500000060000\",\"medins_list_codg\":\"yp3218\",\"det_item_fee_sumamt\":\"225\",\"cnt\":\"3.0\",\"pric\":\"75.0\",\"sin_dos_dscr\":\"\",\"used_frqu_dscr\":\"\",\"prd_days\":\"1\",\"medc_way_dscr\":\"\",\"bilg_dept_codg\":\"A21\",\"bilg_dept_name\":\"康复医学科\",\"bilg_dr_codg\":\"D220104007959\",\"bilg_dr_name\":\"齐艳英\",\"acord_dept_codg\":\"A21\",\"acord_dept_name\":\"康复医学科\",\"orders_dr_code\":\"D220104007959\",\"orders_dr_name\":\"齐艳英\",\"hosp_appr_flag\":\"1\",\"tcmdrug_used_way\":\"1\",\"etip_flag\":\"0\",\"etip_hosp_code\":\"\",\"dscg_tkdrug_flag\":\"0\",\"matn_fee_flag\":\"0\"}";
String s2 =
"{\"feedetl_sn\":\"530390\",\"mdtrt_id\":\"220000202511101029490122280385\",\"psn_no\":\"22000011000014958451\",\"chrg_bchno\":\"SF2511100007050575\",\"dise_codg\":\"M51.202\",\"rx_circ_flag\":\"0\",\"fee_ocur_time\":\"2025-11-10 10:28:20\",\"med_list_codg\":\"014400000050100\",\"medins_list_codg\":\"yp3201\",\"det_item_fee_sumamt\":\"210\",\"cnt\":\"6.0\",\"pric\":\"35.0\",\"sin_dos_dscr\":\"\",\"used_frqu_dscr\":\"\",\"prd_days\":\"1\",\"medc_way_dscr\":\"\",\"bilg_dept_codg\":\"A21\",\"bilg_dept_name\":\"康复医学科\",\"bilg_dr_codg\":\"D220104007959\",\"bilg_dr_name\":\"齐艳英\",\"acord_dept_codg\":\"A21\",\"acord_dept_name\":\"康复医学科\",\"orders_dr_code\":\"D220104007959\",\"orders_dr_name\":\"齐艳英\",\"hosp_appr_flag\":\"1\",\"tcmdrug_used_way\":\"1\",\"etip_flag\":\"0\",\"etip_hosp_code\":\"\",\"dscg_tkdrug_flag\":\"0\",\"matn_fee_flag\":\"0\"}";
Clinic2204FeeDetailParam feeDetailResult1 = JSON.parseObject(s1, Clinic2204FeeDetailParam.class);
Clinic2204FeeDetailParam feeDetailResult2 = JSON.parseObject(s2, Clinic2204FeeDetailParam.class);
clinic2204OrderResult.setFeedetail(Arrays.asList(feeDetailResult1, feeDetailResult2));
Clinic2204OrderResult clinic2204OrderResult1 =
ybHttpUtils.upload2204Record(clinic2204OrderResult, iContractService.getContract(contractNo));
return R.ok(clinic2204OrderResult1);
}
/**
>>>>>>> v1.3
* 【目录下载】
*
* @param address 接口
* @return 结果
*/
@GetMapping("/query-catalog")
<<<<<<< HEAD
public R<?> queryCatalog(@RequestParam("address") String address, @RequestParam("v") String version) {
CatalogFileInput catalogFileInput = new CatalogFileInput();
@@ -955,13 +1044,37 @@ public class YbController {
public R<?> inpatientReg(Yb2401InpatientRegParamDto yb2401InpatientRegParamDto){
Yb2401InputInpatientMdtrtInfo yb2401InputInpatientMdtrtInfo = ybDao.getYb2401InputInpatientMdtrtInfo(yb2401InpatientRegParamDto.getEncounterId());
=======
public R<?> queryCatalog(@RequestParam("address") String address,
@RequestParam(name = "v", defaultValue = "0") String version) {
return ybService.queryCatalog(address, version);
}
/**
* 【2401】入院办理(弃用)
*
* @return
*/
@PostMapping("/inpatient-reg")
public R<?> inpatientReg(Yb2401InpatientRegParamDto yb2401InpatientRegParamDto) {
Yb2401InputInpatientMdtrtInfo yb2401InputInpatientMdtrtInfo =
ybDao.getYb2401InputInpatientMdtrtInfo(yb2401InpatientRegParamDto.getEncounterId());
>>>>>>> v1.3
yb2401InputInpatientMdtrtInfo.setMdtrtCertType(yb2401InpatientRegParamDto.getYbMdtrtCertType());
yb2401InputInpatientMdtrtInfo.setMdtrtCertNo(yb2401InpatientRegParamDto.getBusiCardInfo());
<<<<<<< HEAD
InpatientReg inpatientReg = ybHttpUtils.inpatientReg(yb2401InputInpatientMdtrtInfo);
if(inpatientReg!=null){
=======
InpatientReg inpatientReg = ybHttpUtils.inpatientReg(null, null);
if (inpatientReg != null) {
>>>>>>> v1.3
inpatientReg.setInputParam(JSON.toJSONString(yb2401InputInpatientMdtrtInfo));
ybDao.save2401InpatientReg(inpatientReg);
@@ -973,6 +1086,7 @@ public class YbController {
/**
* 【2402】入院办理
<<<<<<< HEAD
* @return
*/
@PostMapping("/inpatient-dis-charge")
@@ -987,6 +1101,30 @@ public class YbController {
inpatientReg.setInputParam(JSON.toJSONString(yb2402InputInpatientDscgInfo));
ybDao.save2402InpatientDscg(inpatientReg);
=======
*
* @return
*/
@PostMapping("/inpatient-dis-charge")
public R<?> inpatientCheckOut(Long encounterId) {
Contract contract = new Contract();
Yb2402InputParam yb2402InputInpatientDscgInfo = ybDao.getYb2402InputInpatientDscgInfo(encounterId, contract);
Yb2402InputParam yb2402InputParam = ybHttpUtils.inpatientCheckOut(yb2402InputInpatientDscgInfo, null);
if (yb2402InputParam != null) {
InpatientDischarge inpatientDischarge = new InpatientDischarge();
BeanUtils.copyProperties(yb2402InputParam, inpatientDischarge);
inpatientDischarge.setInputParam(JSON.toJSONString(yb2402InputInpatientDscgInfo));
inpatientDischarge.setOutputResult(JSON.toJSONString(yb2402InputParam));
ybDao.save2402InpatientDscg(inpatientDischarge);
// inpatientReg.setInputParam(JSON.toJSONString(yb2402InputInpatientDscgInfo));
// ybDao.save2402InpatientDscg(inpatientReg);
>>>>>>> v1.3
return R.ok("医保出院办理成功!");
}
@@ -995,6 +1133,7 @@ public class YbController {
/**
* 【2403】入院办理
<<<<<<< HEAD
* @return
*/
@PostMapping("/update-inpatient-info")
@@ -1003,6 +1142,17 @@ public class YbController {
Yb2403InputParam yb2403InputParam = ybDao.getYb2403InputParam(encounterId);
ybHttpUtils.updateInpatientInfo(yb2403InputParam);
=======
*
* @return
*/
@PostMapping("/update-inpatient-info")
public R<?> updateInpatientInfo(Long encounterId) {
Yb2403InputParam yb2403InputParam = ybDao.getYb2403InputParam(encounterId);
ybHttpUtils.updateInpatientInfo(yb2403InputParam, null);
>>>>>>> v1.3
ybDao.save2403InputInpatient(yb2403InputParam);

View File

@@ -0,0 +1,236 @@
package com.openhis.web.ybmanage.controller;
import javax.servlet.http.HttpServletRequest;
import com.core.common.annotation.Anonymous;
import com.openhis.web.ybmanage.dto.PerinfoParamDto;
import com.openhis.yb.dto.*;
import com.openhis.yb.service.YbDao;
import com.openhis.yb.service.YbHttpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.inhospitalcharge.appservice.IInHospitalRegisterAppService;
import com.openhis.web.ybmanage.dto.Yb2401InputInpatientParamDto;
import com.openhis.web.ybmanage.dto.Yb2403InputInpatientParamDto;
import com.openhis.web.ybmanage.dto.YbInHospitalRegisterQueryDto;
import com.openhis.web.ybmanage.service.IYbService;
/**
* 医保接口
*
* @author SunJQ
* @date 2025-04-11
*/
@RestController
@RequestMapping("/yb-inpatient-request")
public class YbInpatientController {
@Autowired
private IInHospitalRegisterAppService iInHospitalRegisterAppService;
@Autowired
private IYbService ybService;
@Autowired
private YbDao ybDao;
@Autowired
private YbHttpUtils ybHttpUtils;
/**
* 查询住院登记信息
*
* @param inHospitalRegisterQueryDto 查询dto
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @return 住院登记信息
*/
@GetMapping(value = "/register-info")
public R<?> getRegisterInfo(YbInHospitalRegisterQueryDto inHospitalRegisterQueryDto,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
IPage<YbInHospitalRegisterQueryDto> iPage =
ybService.getRegisterInfo(inHospitalRegisterQueryDto, searchKey, pageNo, pageSize, request);
return R.ok(iPage);
}
/**
* 【1101】
*
* @param perinfoParamDto 医保信息
* @return 结果
*/
@PostMapping("/inpatient-per-info")
public R<?> getInpatPerInfo(@RequestBody PerinfoParamDto perinfoParamDto) {
Info1101ReadcardParam readcard = ybDao.getReadCard(perinfoParamDto.getCertType(), perinfoParamDto.getCertNo());
Info1101Output perInfo = ybHttpUtils.getPerInfo(readcard);
if (perInfo != null) {
ybDao.saveReadcardAndPerinfo(readcard, perInfo);
//创建医保Account
ybService.createYbAccount(perInfo,perinfoParamDto.getEncounterId(),perinfoParamDto.getCertType(),perinfoParamDto.getCertNo());
return R.ok(ybService.getInpatPerInfo(perInfo, perinfoParamDto.getEncounterId()));
} else {
return R.fail("医保端未查询到患者信息");
}
}
/**
* 查询住院就诊信息
*
* @param encounterId 住院就诊id
* @return 住院就诊信息
*/
@GetMapping(value = "/in-hospital-info")
public R<?> getInHospitalInfo(@RequestParam Long encounterId) {
return R.ok(ybService.getInHospitalInfo(encounterId));
}
/**
* 医保入院办理
*
* @param yb2401InputInpatientParamDto 住院就诊信息
* @return 医保就诊id
*/
@PostMapping(value = "/inpatient-reg")
public R<?> inpatientReg(@RequestBody Yb2401InputInpatientParamDto yb2401InputInpatientParamDto) {
return ybService.inpatientReg(yb2401InputInpatientParamDto);
}
/**
* 医保入院办理
*
* @param mdtrtId 住院就诊id
* @return 医保就诊id
*/
@GetMapping(value = "/cancel-inpatient-reg")
public R<?> cancelInpatientReg(@RequestParam(name = "mdtrtId" ,required = false) String mdtrtId) {
return ybService.cancelInpatientReg(mdtrtId);
}
/**
* 查询住院就诊信息(已上传过医保的)
*
* @param mdtrtId 住院就诊id
* @return 住院就诊信息
*/
@GetMapping(value = "/inpatient-reg-info")
public R<?> getInPatientRegInfo(@RequestParam("mdtrtId") String mdtrtId) {
return ybService.getInpatientRegInfo(mdtrtId);
}
/**
* 医保入院信息变更
*
* @param yb2403InputInpatientParamDto 住院就诊信息
* @return 医保就诊id
*/
@PostMapping(value = "/update-inpatient-reg")
public R<?> updateInpatientReg(@RequestBody Yb2403InputInpatientParamDto yb2403InputInpatientParamDto) {
return ybService.updateInpatientRegInfo(yb2403InputInpatientParamDto);
}
/**
* 医保出院信息获取(暂时该方法和上面/inpatient-reg-info接口的内容是一致的
*
* @param mdtrtId 住院就诊id
* @return 医保就诊id
*/
@PostMapping(value = "/inpatient-check-info")
public R<?> getInpatientCheckInfo(@RequestParam("mdtrtId") String mdtrtId) {
return ybService.getInpatientCheckInfo(mdtrtId);
}
/**
* 医保出院
*
* @param yb2402InputParam 出院信息
* @return 结果
*/
@PostMapping(value = "/inpatient-check-out")
public R<?> inpatientCheckOut(@RequestBody Yb2402InputParam yb2402InputParam) {
return ybService.inpatientCheckOut(yb2402InputParam);
}
/**
* 医保出院
*
* @param mdtrtId 出院信息
* @return 结果
*/
@PostMapping(value = "/cancel-inpatient-check-out")
public R<?> cancelInpatientCheckOut(@RequestParam("mdtrtId") String mdtrtId) {
return ybService.cancelInpatientCheckOut(mdtrtId);
}
/**
* 病案首页上传
*
* @param mdtrtId 出院信息
* @return 结果
*/
@PostMapping(value = "/emr-up")
public R<?> emrUp(@RequestParam("mdtrtId") String mdtrtId) {
return ybService.emrUp(mdtrtId);
}
/**
* 结算上传
*
* @param encounterId 就诊信息
* @return 结果
*/
@PostMapping(value = "/setl-up")
public R<?> settleUp(@RequestParam("encounterId") Long encounterId) {
return ybService.settleUp(encounterId);
}
/**
* 结算上传
*
* @param encounterId 就诊信息
* @return 结果
*/
@PostMapping(value = "/setl-status-up")
public R<?> settleStatusUp(@RequestParam("encounterId") Long encounterId,@RequestParam("stasType") String stasType) {
return ybService.settleStatusUp(encounterId,stasType);
}
/**
* 护士预结算
*
* @param prePaymentDto 就诊信息
* @return 结果
*/
@PostMapping(value = "/pre-setl")
public R<?> preSettle(@RequestBody PrePaymentDto prePaymentDto) {
return ybService.preSettle(prePaymentDto);
}
/**
* 取消医保入院
*
* @param mdtrtId 就诊id
* @return 结果
*/
@GetMapping(value = "/cancel-yb-reg")
@Anonymous
public R<?> cancelInpatientYbReg(@RequestParam(name = "psnNo" ,required = false) String psnNo,
@RequestParam(name = "mdtrtId" ,required = false) String mdtrtId,
@RequestParam(name = "insuplcAdmdvs" ,required = false) String insuplcAdmdvs,
@RequestParam(name = "contractNo" ,required = false) String contractNo) {
Yb2404InputInpatient yb2404InputInpatient = new Yb2404InputInpatient();
yb2404InputInpatient.setMdtrtId(mdtrtId).setPsnNo(psnNo).setInsuplcAdmdvs(insuplcAdmdvs);
// 发送请求
ybHttpUtils.cancelInpatientReg(yb2404InputInpatient, contractNo);
return R.ok("医保入院办理撤销成功!");
}
}

View File

@@ -0,0 +1,72 @@
package com.openhis.web.ybmanage.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class EncounterDiagnosisDto {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 就诊id */
private Long encounterId;
/** 诊断_id */
private Long conditionId;
/** 住院患者疾病诊 */
private Integer iptDiseCrsp;
/** 住院患者疾病诊断类型代码 */
private Integer iptDiseTypeCode;
/** 入院疾病病情代码 */
private Integer admDiseCondCode;
/** 医疗类型 */
private String medTypeCode;// 2025/05/23 该字段改为med_type 与医保同步
/** 主诊断标记 */
private Integer maindiseFlag;
/** 最高诊断依据标记 */
private Integer highDiseEvidFlag;
/** 诊断排序医保文档要求数值型字符长度为2 */
private Integer diagSrtNo;
/**
* 中医证候组号
*/
private String syndromeGroupNo;
/**
* 中医标识
*/
private Integer tcmFlag;
/**
* 诊断描述
*/
private String diagnosisDesc;
/**
* 诊断类别
*/
private String typeCode;
/**
* 医保码
*/
private String ybNo;
/**
* 名称
*/
private String name;
}

View File

@@ -0,0 +1,11 @@
package com.openhis.web.ybmanage.dto;
import lombok.Data;
@Data
public class PerinfoParamDto {
private String certType;
private String certNo;
private String psnCertType;
private Long encounterId;
}

View File

@@ -94,5 +94,7 @@ public class VeriPrescriptionDetailInfoDto {
/* --诊断信息-- */
/** 诊断名 */
private String conditionName;
/** 慢病诊断名 */
private String specialConditionName;
}

View File

@@ -8,6 +8,8 @@ import java.util.Date;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -52,4 +54,15 @@ public class VeriPrescriptionInfoDto {
/** 医保处方编号 */
private String hiRxno;
/**
* 参与者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long practitionerId;
/**
* 参与者
*/
private String practitionerName;
}

View File

@@ -3,7 +3,8 @@
*/
package com.openhis.web.ybmanage.dto;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -20,4 +21,15 @@ public class VeriPrescriptionParam {
/** 门诊号/姓名 */
private String name;
/**
* 参与者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long practitionerId;
/**
* 参与者
*/
private String practitionerName;
}

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

@@ -0,0 +1,48 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.ybmanage.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.openhis.administration.domain.Patient;
import com.openhis.yb.dto.PatientInfoDto;
import com.openhis.yb.dto.Yb2401InputInpatientDiseInfo;
import com.openhis.yb.dto.Yb2401InputInpatientMdtrtInfo;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* 【2401】
*
* @author SunJQ
* @date 2025-11-12
*/
@Data
@Accessors(chain = true)
public class Yb2401InputInpatientParamDto {
private Patient patient;
private PatientInfoDto patientInfoDto;
/**
* 就诊信息
*/
private Yb2401InputInpatientMdtrtInfo mdtrtinfo;
/**
* 诊断信息
*/
private List<Yb2401InputInpatientDiseInfo> diseinfo;
/**
* 诊断信息(出院)
*/
private List<Yb2401InputInpatientDiseInfo> outDiseinfo;
}

View File

@@ -0,0 +1,45 @@
/*
* 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.Yb2401InputInpatientDiseInfo;
import com.openhis.yb.dto.Yb2403InputAdmInfo;
import com.openhis.yb.dto.Yb2403InputDiseInfo;
import com.openhis.yb.dto.Yb2403InputMdtrtGrpContent;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* 【2403】
*
* @author SunJQ
* @date 2025-11-12
*/
@Data
@Accessors(chain = true)
public class Yb2403InputInpatientParamDto {
/**
* 登记信息
*/
private Yb2403InputAdmInfo admInfo;
/**
* 拓展信息
*/
private Yb2403InputMdtrtGrpContent grpContent;
/**
* 诊断信息
*/
@NotBlank
private List<Yb2403InputDiseInfo> diseinfo;
}

View File

@@ -0,0 +1,95 @@
package com.openhis.web.ybmanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 住院登记查询 dto
*/
@Data
@Accessors(chain = true)
public class YbInHospitalRegisterQueryDto {
/** 患者id */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/**
* 住院就诊id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/**
* 门诊就诊id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long ambEncounterId;
/**
* 申请时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date requestTime;
/**
* 记录员
*/
private String registrar;
/**
* 挂号科室(来源)
*/
private String sourceName;
/**
* 患者
*/
private String patientName;
/**
* 性别编码
*/
private Integer genderEnum;
private String genderEnum_enumText;
/**
* 生日
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthDate;
/**
* 年龄
*/
private String age;
/**
* 病区
*/
private String wardName;
/**
* 医保挂号
*/
private String mdtrtId;
/**
* 医保状态
*/
private Integer status;
/**
* 医保状态
*/
private String statusText;
}

View File

@@ -2,6 +2,13 @@ package com.openhis.web.ybmanage.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.inhospitalcharge.dto.InHospitalRegisterQueryDto;
import com.openhis.web.ybmanage.dto.EncounterDiagnosisDto;
import com.openhis.web.ybmanage.dto.YbInHospitalRegisterQueryDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -69,4 +76,23 @@ public interface YbMapper {
*/
List<Yb4101AInputOpspdiseinfo> yb4101aSelectOpspdiseinfo(@Param("paymentId") Long paymentId);
/**
* 分页查询
* @param page 分页对象
* @param encounterClass 类型
* @param encounterStatus 状态
* @param registeredFlag 登记标志
* @param formEnum 参数
* @param queryWrapper 条件
* @return 查询条件
*/
IPage<YbInHospitalRegisterQueryDto> getInHospitalRegisterInfo(@Param("page") Page<InHospitalRegisterQueryDto> page,
@Param("encounterClass") Integer encounterClass, @Param("encounterStatus") Integer encounterStatus,
@Param("formEnum") Integer formEnum,
@Param(Constants.WRAPPER) QueryWrapper<InHospitalRegisterQueryDto> queryWrapper);
List<EncounterDiagnosisDto> getDiagnosisList(@Param("encounterId")Long encounterId);
}

View File

@@ -1,6 +1,15 @@
package com.openhis.web.ybmanage.service;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.ybmanage.dto.Yb2401InputInpatientParamDto;
import com.openhis.web.ybmanage.dto.Yb2403InputInpatientParamDto;
import com.openhis.web.ybmanage.dto.YbInHospitalRegisterQueryDto;
import com.openhis.yb.dto.Info1101Output;
import com.openhis.yb.dto.PrePaymentDto;
import com.openhis.yb.dto.Yb2402InputParam;
/**
* 医保Service
@@ -35,4 +44,133 @@ public interface IYbService {
* @return 结果
*/
R<?> yb4101aUploadFundSettle(Long paymentId);
/**
* 醫保住院登記列表
*
* @param inHospitalRegisterQueryDto 参数
* @param searchKey 参数
* @param pageNo 页码
* @param pageSize 页码
* @param request 请求体
* @return 查询结果
*/
IPage<YbInHospitalRegisterQueryDto> getRegisterInfo(YbInHospitalRegisterQueryDto inHospitalRegisterQueryDto,
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 查询住院就诊信息
*
* @param encounterId 就诊id
* @return 查询结果
*/
Yb2401InputInpatientParamDto getInHospitalInfo(Long encounterId);
/**
* 查询住院就诊信息
*
* @param encounterId 就诊id
* @param perInfo 患者信息
* @return 查询结果
*/
Yb2401InputInpatientParamDto getInpatPerInfo(Info1101Output perInfo, Long encounterId);
/**
* 上传医保办理
*
* @param yb2401InputInpatientParamDto 参数
* @return 结果
*/
R<?> inpatientReg(Yb2401InputInpatientParamDto yb2401InputInpatientParamDto);
/**
* 取消医保入院
*
* @param mdtrtId 就诊id
* @return 结果
*/
R<?> cancelInpatientReg(String mdtrtId);
/**
* 获取【医保住院】信息
*
* @param mdtrtId
* @return
*/
R<?> getInpatientRegInfo(String mdtrtId);
/**
* 【住院办理信息更新】
*
* @param yb2403InputInpatientParamDto
* @return
*/
R<?> updateInpatientRegInfo(Yb2403InputInpatientParamDto yb2403InputInpatientParamDto);
/**
* 获取【医保出院】基础信息
*
* @param mdtrtId
* @return
*/
R<?> getInpatientCheckInfo(String mdtrtId);
/**
* 医保出院办理
*
* @param yb2402InputParam 参数
* @return 结果
*/
R<?> inpatientCheckOut(Yb2402InputParam yb2402InputParam);
/**
* 取消医保出院
*
* @param mdtrtId 医保就诊id
* @return 操作结果
*/
R<?> cancelInpatientCheckOut(String mdtrtId);
/**
* 病案首页上传
*
* @param mdtrtId 医保就诊id
* @return 结果
*/
R<?> emrUp(String mdtrtId);
/**
* 目录下载
* @param address 接口编号
* @param version 版本号
*/
R<?> queryCatalog(String address, String version);
/**
* 结算上传
* @param encounterId 就诊id
* @return 结果
*/
R<?> settleUp(Long encounterId);
/**
* 创建医保Account
* @param perInfo 患者信息
*/
void createYbAccount(Info1101Output perInfo,Long encounterId,String certType,String certNo);
/**
* 结算状态上传
* @param encounterId 就诊id
* @param stasType 结算状态
* @return 结果
*/
R<?> settleStatusUp(Long encounterId, String stasType);
/**
* 预结算
* @param prePaymentDto 就诊信息
* @return 结果
*/
R<?> preSettle(PrePaymentDto prePaymentDto);
}

View File

@@ -10,6 +10,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.openhis.common.enums.ybenums.YbMedType;
import com.openhis.ybcatalog.service.ICatalogSpecialInsuranceDiseaseService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -75,6 +76,8 @@ public class YbElepBaseServiceImpl implements IYbEleBaseService {
@Autowired
ICatalogSpecialDiseaseService catalogSpecialDiseaseService;
@Autowired
ICatalogSpecialInsuranceDiseaseService catalogSpecialInsuranceDiseaseService;
@Autowired
IConditionDefinitionService conditionDefinitionService;
@Autowired
IPerinfoService perinfoService;
@@ -730,7 +733,7 @@ public class YbElepBaseServiceImpl implements IYbEleBaseService {
// 查询慢病目录
CatalogSpecialInsuranceDisease catalogSpecialInsuranceDisease =
catalogSpecialDiseaseService.getOne(new LambdaQueryWrapper<CatalogSpecialInsuranceDisease>()
catalogSpecialInsuranceDiseaseService.getOne(new LambdaQueryWrapper<CatalogSpecialInsuranceDisease>()
.eq(CatalogSpecialInsuranceDisease::getDiseaseCode, medicationRequest.getOpspDiseCode()));
if (catalogSpecialInsuranceDisease == null) {
return;

View File

@@ -0,0 +1,146 @@
package com.openhis.web.ybmanage.util;
import com.opencsv.bean.CsvToBean;
import com.opencsv.bean.CsvToBeanBuilder;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class CsvHelperZipProcessor {
/**
* 处理ZIP文件并返回实体列表
* @param zipFilePath ZIP文件路径
* @param entityClass 目标实体类
* @return 实体对象列表
*/
public static <T> List<T> processZipFile(String zipFilePath, Class<T> entityClass) throws IOException {
return processZipFileInternal(zipFilePath, entityClass, null);
}
/**
* 流式处理ZIP文件
* @param zipFilePath ZIP文件路径
* @param entityClass 目标实体类
* @param recordProcessor 记录处理器
*/
public static <T> void processZipFileStreaming(String zipFilePath, Class<T> entityClass,
Consumer<T> recordProcessor) throws IOException {
processZipFileInternal(zipFilePath, entityClass, recordProcessor);
}
/**
* 内部实现处理ZIP文件
*/
private static <T> List<T> processZipFileInternal(String zipFilePath, Class<T> entityClass,
Consumer<T> recordProcessor) throws IOException {
List<T> allRecords = new ArrayList<>();
File zipFile = new File(zipFilePath);
if (!zipFile.exists()) {
throw new FileNotFoundException("ZIP文件不存在: " + zipFilePath);
}
System.out.println("开始处理ZIP文件: " + zipFilePath);
System.out.println("目标实体类: " + entityClass.getSimpleName());
try (FileInputStream fis = new FileInputStream(zipFile);
ZipInputStream zis = new ZipInputStream(fis, StandardCharsets.UTF_8)) {
ZipEntry entry;
int totalFiles = 0;
int totalRecords = 0;
while ((entry = zis.getNextEntry()) != null) {
if (!entry.isDirectory() && entry.getName().toLowerCase().endsWith(".txt")) {
totalFiles++;
System.out.println("处理文件[" + totalFiles + "]: " + entry.getName());
// 关键修复将ZIP条目内容读取到内存中
byte[] fileContent = readZipEntryContent(zis);
List<T> fileRecords = processTxtFile(fileContent, entityClass, recordProcessor);
allRecords.addAll(fileRecords);
totalRecords += fileRecords.size();
System.out.println("文件 " + entry.getName() + " 解析了 " + fileRecords.size() + " 条记录");
}
// 不需要手动调用 zis.closeEntry()try-with-resources会自动处理
}
System.out.println("处理完成: " + totalFiles + " 个文件, 总共 " + totalRecords + " 条记录");
} // 这里会自动关闭 fis 和 zis
// ==================== try-with-resources结束 ====================
return allRecords;
}
/**
* 读取ZIP条目内容到字节数组
*/
private static byte[] readZipEntryContent(InputStream inputStream) throws IOException {
// ==================== 内部的try-with-resources ====================
try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
byte[] data = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, bytesRead);
}
return buffer.toByteArray();
} // 这里会自动关闭 buffer
// ==================== try-with-resources结束 ====================
}
/**
* 处理单个TXT文件
*/
private static <T> List<T> processTxtFile(byte[] fileContent, Class<T> entityClass,
Consumer<T> recordProcessor) throws IOException {
List<T> records = new ArrayList<>();
// ==================== 内部的try-with-resources ====================
try (ByteArrayInputStream bais = new ByteArrayInputStream(fileContent);
InputStreamReader reader = new InputStreamReader(bais, StandardCharsets.UTF_8)) {
// 配置CSV解析器
CsvToBean<T> csvToBean = new CsvToBeanBuilder<T>(reader)
.withType(entityClass)
.withSeparator('\t')
.withIgnoreLeadingWhiteSpace(true)
.withIgnoreEmptyLine(true)
.withStrictQuotes(false)
.withIgnoreQuotations(true) // 忽略引号
.build();
if (recordProcessor != null) {
// 流式处理
int recordCount = 0;
for (T record : csvToBean) {
recordProcessor.accept(record);
recordCount++;
if (recordCount % 1000 == 0) {
System.out.println("已处理 " + recordCount + "");
}
}
System.out.println("文件处理完成,共 " + recordCount + "");
} else {
// 批量处理
records = csvToBean.parse();
}
} // 这里会自动关闭 bais 和 reader
// ==================== try-with-resources结束 ====================
return records;
}
}

View File

@@ -290,7 +290,7 @@ public class YbEleParamBuilderUtil {
// .eq(EncounterDiagnosis::getEncounterId, medicationRequest.getEncounterId())
// .eq(EncounterDiagnosis::getTenantId, tenantId)
// .eq(EncounterDiagnosis::getConditionId, medicationRequest.getConditionId())
// .eq(EncounterDiagnosis::getDeleteFlag, DeleteFlag.NOT_DELETED.getCode()));
// .eq(EncounterDiagnosis::getDeleteFlag, DelFlag.NO.getCode()));
EncounterDiagnosis encDiagObjs = encounterDiagnosisService.getEncounterDiagnosisByEncounterConDefId(
medicationRequest.getEncounterId(), medicationRequest.getConditionDefId(), tenantId);
// 就诊管理