| | |
| | | package com.ltkj.web.config.timer; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.TjJcycxm; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | |
| | | String dsqjssj = configService.selectConfigByKey("dsqjssj"); |
| | | String yqbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | boolean panduandangqianshijian = panduandangqianshijian(dsqkssj, dsqjssj); |
| | | log.info("定时器自动同步检验检查结果"); |
| | | log.info("当前时间是否在 " + dsqkssj + " 点到 " + dsqjssj + " 点之间: " + panduandangqianshijian); |
| | | String dsrwsjjg = configService.selectConfigByKey("dsrwsjjg"); |
| | | boolean lock = reentrantLock.tryLock(); |
| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import com.ltkj.common.core.domain.entity.SysMenu; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.DictHosp; |
| | | import com.ltkj.hosp.domain.TjJcycxm; |
| | | import com.ltkj.hosp.domain.TjProject; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.sqlDomain.LtkjExamJcsqd; |
| | | import com.ltkj.hosp.sqlDomain.*; |
| | | import com.ltkj.system.service.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Case; |
| | | import org.apache.ibatis.jdbc.Null; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | @Api(tags = "A---PC端参数配置接口集") |
| | | @Slf4j |
| | | public class SysConfigController extends BaseController { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | |
| | | private TjJcycxmService jcycxmService; |
| | | @Resource |
| | | private LtkjExamJcsqdService jcsqdService; |
| | | @Resource |
| | | private LtkjExamJcbgdService jcbgdService; |
| | | @Resource |
| | | private LtkjHybgdService ltkjHybgdService; |
| | | @Resource |
| | | private LtkjHysqdService ltkjHysqdService; |
| | | @Resource |
| | | private TestMapper testMapper; |
| | | @Autowired |
| | | private AwsService awsService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping ("/shoudongtbjyjcwsxmjg") |
| | | @ApiOperation(value = "手动同步检验检查外送项目结果接口") |
| | | public AjaxResult shoudongtbjyjcwsxmjg(@RequestParam @ApiParam(value = "jy检验 jc检查 jyjc检验和检查") String tblx, |
| | | @ApiParam(value = "体检号")@RequestParam String tjh) { |
| | | |
| | | log.info("手动同步检验或检查结果开始->{}",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
| | | try { |
| | | |
| | | switch (tblx){ |
| | | case "jy": |
| | | tbjianyan(tjh); |
| | | log.info("当前同步的是->{} 结果","检验"); |
| | | break; |
| | | case "jc": |
| | | tbjiancha(tjh); |
| | | log.info("当前同步的是->{} 结果","检查"); |
| | | break; |
| | | case "jyjc": |
| | | tbjianyan(tjh); |
| | | tbjiancha(tjh); |
| | | log.info("当前同步的是->{} 结果","检验检查"); |
| | | break; |
| | | default: |
| | | log.info("没有找到所匹配的同步类型"); |
| | | return AjaxResult.error("没有找到所匹配的同步类型!"); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | testMapper.tjplUpdateDetatilByVi(map); |
| | | Integer object = (Integer) map.get("total"); |
| | | log.info("执行存储过程后出参->{}", object); |
| | | log.info("手动同步检验或检查结果结束->{}",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
| | | return AjaxResult.success("同步成功"); |
| | | |
| | | } catch (Exception e) { |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | private void tbjianyan(String s) { |
| | | try { |
| | | List<Aws> awsList = testMapper.getWsxmLtkjHysqdByLisViBySLAVEWS(s); |
| | | if(null !=awsList && !awsList.isEmpty()){ |
| | | log.info(awsList.toString()); |
| | | testMapper.delWsxmjg(s); |
| | | log.info("删除外送项目成功"); |
| | | awsService.saveBatch(awsList); |
| | | log.info("保存外送项目成功"); |
| | | } |
| | | List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s); |
| | | List<LtkjHysqd> wssq = testMapper.getWsxmLtkjHysqdByLisVi(s); |
| | | if(null !=wssq && !wssq.isEmpty())hysqdList.addAll(wssq); |
| | | if (null != hysqdList && !hysqdList.isEmpty()) { |
| | | for (LtkjHysqd hysqd : hysqdList) { |
| | | LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh()); |
| | | if (null != jybgid) { |
| | | ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh()); |
| | | ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(hysqd.getTmh()); |
| | | } |
| | | if (ltkjHysqdService.save(hysqd)) { |
| | | List<LtkjHybgd> hybgdList = testMapper.getCcXZxYyLtkjHybgdByLisVi(hysqd.getTmh()); |
| | | List<LtkjHybgd> wsbg = testMapper.getWsxmLtkjHybgdByLisVi(s); |
| | | if(null !=wsbg && !wsbg.isEmpty())hybgdList.addAll(wsbg); |
| | | ltkjHybgdService.saveBatch(hybgdList); |
| | | } |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("同步检验数据失败"); |
| | | // throw new RuntimeException(e); |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | private void tbjiancha(String s) { |
| | | |
| | | try { |
| | | List<LtkjExamJcsqd> jcsqdList = testMapper.getCcXZxYyPacsLtkjExamJcsqd(s); |
| | | if (null != jcsqdList && !jcsqdList.isEmpty()) { |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | jcsqdService.deletedLtkjJcsqdByTjhAndTmh(s); |
| | | jcbgdService.deletedLtkjJcbgdByTjhAndTmh(s); |
| | | jcsqdService.saveBatch(jcsqdList); |
| | | List<LtkjExamJcbgd> jcbgdList = testMapper.getCcXZxYyPacsLtkjExamJcbgd(s); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | if (null != jcbgdList && !jcbgdList.isEmpty()) jcbgdService.saveBatch(jcbgdList); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.info("同步检查数据失败"); |
| | | // throw new RuntimeException(e); |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping ("/zxsq")//执行 |
| | | @ApiOperation(value = "zxsq") |
| | | public AjaxResult zx(@RequestParam int day) { |
| | |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public AjaxResult savePdf() { |
| | | //从文件地址读入PDF文件 仅存储一次 |
| | | String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_pdf5Template")); |
| | | reportTemplateService.remove(new LambdaQueryWrapper<TjReportTemplate>().eq(TjReportTemplate::getName,"体检报告模板5")); |
| | | TjReportTemplate tem = new TjReportTemplate(); |
| | | tem.setName("体检报告模板5"); |
| | | tem.setRemark("体检报告模板5"); |
| | | tem.setTemplate(base64String); |
| | | tem.setFlag("1"); |
| | | tem.setOpen("0"); |
| | | tem.setCreateTime(DateUtil.date()); |
| | | final boolean save = reportTemplateService.save(tem); |
| | | if (save) { |
| | | return AjaxResult.success("保存成功"); |
| | | if(StringUtil.isNotBlank(base64String)){ |
| | | reportTemplateService.remove(new LambdaQueryWrapper<TjReportTemplate>().eq(TjReportTemplate::getName,"体检报告模板5")); |
| | | TjReportTemplate tem = new TjReportTemplate(); |
| | | tem.setName("体检报告模板5"); |
| | | tem.setRemark("体检报告模板5"); |
| | | tem.setTemplate(base64String); |
| | | tem.setFlag("1"); |
| | | tem.setOpen("0"); |
| | | tem.setCreateTime(DateUtil.date()); |
| | | final boolean save = reportTemplateService.save(tem); |
| | | if (save) { |
| | | return AjaxResult.success("保存成功"); |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success("保存失败"); |
| | | // String base64String2 = PDFBinaryUtil.getPDFBinary("D:\\Tjreport\\心电图1.pdf"); |
| | | // TjReport tem2 = new TjReport(); |
| | |
| | | we.eq(TjReport::getType, "体检报告"); |
| | | TjReport one = tjReportService.getOne(we); |
| | | if (one == null) { |
| | | return AjaxResult.error("暂无体检报告"); |
| | | return AjaxResult.error("暂无体检报告,请撤回到总检未审核页面,需总检医生重新审核并生成报告!"); |
| | | } |
| | | if ("pdf".equals(one.getPrint())) { |
| | | res.put("flag", "0"); |
| | |
| | | res.put("url", one.getPath()); |
| | | return AjaxResult.success(res); |
| | | } else { |
| | | return AjaxResult.error("暂无体检报告"); |
| | | return AjaxResult.error("暂无体检报告,请撤回到总检未审核页面,需总检医生重新审核并生成报告!"); |
| | | } |
| | | |
| | | } |
| | |
| | | // 不在使用逻辑删除 逻辑删除导致打印报告生成 查询sql缓慢 |
| | | int i = tjReportService.deleteTjReportByReId(tjReport.getReId()); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | return AjaxResult.error("暂无体检报告,请撤回到总检未审核页面,需总检医生重新审核并生成报告!"); |
| | | } |
| | | } |
| | | |
| | |
| | | one.setPrintLastTime(null); |
| | | one.setDownloadLastTime(null); |
| | | if (tjOrderService.updateById(one)) { |
| | | // ycxmService.delOrderYcXmJyByTjh(tjNumber); |
| | | return AjaxResult.success("撤回成功!"); |
| | | } |
| | | } |
| | | return AjaxResult.error("撤回失败!"); |
| | | return AjaxResult.error("该人员体检记录不存在,请核实人员信息!"); |
| | | |
| | | } |
| | | |
| | |
| | | private ITjReportTemplateService reportTemplateService; |
| | | @Autowired |
| | | private HisPDFUtil hisPDFUtil; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private RedisTemplate<String,Object> redisTemplate; |
| | | |
| | | // @Autowired |
| | | // private RedisCache redisCache; |
| | | // @Autowired |
| | | // private RedisTemplate<String,Object> redisTemplate; |
| | | |
| | | public static String generateId() { |
| | | String id; |
| | |
| | | template.setOpen("1"); |
| | | reportTemplateService.save(template); |
| | | } |
| | | |
| | | @Test |
| | | public void test11(){ |
| | | redisCache.setCacheList("list1",new ArrayList<>()); |
| | | redisTemplate.opsForList().set("list2",0,new ArrayList<>()); |
| | | } |
| | | // |
| | | // @Test |
| | | // public void test11(){ |
| | | // redisCache.setCacheList("list1",new ArrayList<>()); |
| | | // redisTemplate.opsForList().set("list2",0,new ArrayList<>()); |
| | | // } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | // @DataSource(value = DataSourceType.SLAVE_WS) |
| | | @Select("SELECT aa.tjh,ws.pro_id tmh,aa.bbbh,aa.bbmc,ws.pro_id xmid,aa.xmmc,aa.sqsj,aa.sqys,aa.jgsj,aa.sqdh,aa.sqrxm,aa.sqrdm,aa.jybgjg,aa.create_time FROM tj_wsxm ws LEFT JOIN (\n" + |
| | | @Select("SELECT aa.tjh,CONCAT(aa.tjh,RIGHT(ws.pro_id, 6)) tmh,aa.bbbh,aa.bbmc,ws.pro_id xmid,aa.xmmc,aa.sqsj,aa.sqys,aa.jgsj,aa.sqdh,aa.sqrxm,aa.sqrdm,aa.jybgjg,aa.create_time FROM tj_wsxm ws LEFT JOIN (\n" + |
| | | " SELECT\n" + |
| | | " a.brid tjh,\n" + |
| | | " a.brid tmh,\n" + |
| | |
| | | List<LtkjHysqd> getWsxmLtkjHysqdByLisVi(String tjNum); |
| | | |
| | | // @DataSource(value = DataSourceType.SLAVE_WS) |
| | | @Select("SELECT ws.pro_id tmh,aa.jcxmid,aa.jcxm,NULL tdh,aa.jyjg,null jgdw,null fwzdz,null fwzgz,aa.jysj,aa.shsj,NULL shys,aa.shysmc,NULL tpurl,NULL ycbz,aa.create_time\n" + |
| | | @Select("SELECT CONCAT(aa.tmh,RIGHT(ws.pro_id, 6)) tmh,aa.jcxmid,aa.jcxm,NULL tdh,aa.jyjg,null jgdw,null fwzdz,null fwzgz,aa.jysj,aa.shsj,NULL shys,aa.shysmc,NULL tpurl,NULL ycbz,aa.create_time\n" + |
| | | " FROM tj_wsxm ws \n" + |
| | | " LEFT JOIN (\n" + |
| | | " SELECT distinct a.brid tmh,a.xmbm jcxmid,a.xmmc jcxm,NULL tdh,a.result jyjg,null jgdw,null fwzdz,null fwzgz,null fwz,a.bgsj jysj,a.bgys jyys,a.bgsj shsj," + |
| | |
| | | |
| | | |
| | | |
| | | @DataSource(value = DataSourceType.SLAVE_WS) |
| | | @Select("SELECT * from lis_result a where a.brid=#{tjNum}") |
| | | // @DataSource(value = DataSourceType.SLAVE_WS) |
| | | // @Select("SELECT * from lis_result a where a.brid=#{tjNum}") |
| | | // List<Aws> getWsxmLtkjHysqdByLisViBySLAVEWS(String tjNum); |
| | | |
| | | @DataSource(value = DataSourceType.SLAVE_WS) |
| | | @Select("select t.brid,t.xmbm,t.xmmc,t.result,t.gdpd ,t.xmckz,t.dw,t.bgys,max(bgsj) bgsj\n" + |
| | | " from lis_result t WHERE t.brid=#{tjNum} \n" + |
| | | " group by t.brid,t.xmbm,t.xmmc,t.result,t.gdpd,t.xmckz,t.dw,t.bgys") |
| | | List<Aws> getWsxmLtkjHysqdByLisViBySLAVEWS(String tjNum); |
| | | |
| | | |