| | |
| | | package com.ltkj.web.controller.sqlserver; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ltkj.common.annotation.RepeatSubmit; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | | import com.ltkj.common.enums.DataSourceType; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.TjOrder; |
| | | import com.ltkj.hosp.domain.TjOrderRemark; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.sqlDomain.*; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.ConvertingCursor; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ltkj.framework.datasource.DynamicDataSourceContextHolder.log; |
| | | import static org.apache.poi.hemf.record.emfplus.HemfPlusRecordType.save; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/sqlserver/getdata") |
| | | @Api(tags = "获取从库数据") |
| | | @Api(tags = "AAAAAAAAAAA获取从库数据") |
| | | public class TjSqlController extends BaseController { |
| | | @Resource |
| | | private TestMapper testMapper; |
| | |
| | | @Autowired |
| | | public RedisTemplate<Object,Object> redisTemplate; |
| | | @Resource |
| | | private ITjCustomerService tjCustomerService; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private TjAsyncService asyncService; |
| | |
| | | private ITjOrderService orderService; |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | @Resource |
| | | private LtkjHisUserService hisUserService; |
| | | @Resource |
| | | private ITjProjectService tjProjectService; |
| | | @Autowired |
| | | private ITjOrderDetailService tjOrderDetailService; |
| | | @Resource |
| | | private ITjOrderRemarkService tjOrderRemarkService; |
| | | |
| | | |
| | | @GetMapping("/getTjHyBgList") |
| | | @ApiOperation(value = "查询lis数据库项目信息接口") |
| | | public AjaxResult getTjHyBgList(@RequestParam(required = false)String pacCode, |
| | | @RequestParam(required = false)String pacName, |
| | | @RequestParam(required = false)String pacRemark) { |
| | | List<Map<String, Object>> maps = testMapper.getTjHyBgList(pacCode,pacName,pacRemark); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | return AjaxResult.success(maps); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/newGetTjPat") |
| | | @ApiOperation(value = "A------新的查询体检信息接口") |
| | | public AjaxResult newGetTjPat(@RequestParam(required = false)String pacCode, |
| | | @RequestParam(required = false)String pacName, |
| | | @RequestParam(required = false)String pacRemark, HttpServletRequest request, |
| | | HttpSession session) { |
| | | |
| | | // List<Map<String, Object>> maps = testMapper.newGetTjPat111111(pacName); |
| | | List<Map<String, Object>> maps = testMapper.newGetTjPat(pacCode,pacName,pacRemark); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | // List<Map<String, Object>> list=new ArrayList<>(); |
| | | // if(null !=maps && maps.size()>0){ |
| | | // for (Map<String, Object> map : maps) { |
| | | // String pacCode1 = map.get("pacCode").toString(); |
| | | // List<String> s = orderService.selectTjOrderByCardId1(); |
| | | // if(null !=s && s.size()>0){ |
| | | // if(s.contains(pacCode1)){ |
| | | //// maps.remove(map); |
| | | // continue; |
| | | // } |
| | | // list.add(map); |
| | | // } |
| | | // } |
| | | // } |
| | | // return AjaxResult.success(list); |
| | | |
| | | List<String> strings = orderService.selectTjOrderByCardId1(); |
| | | if(null !=strings && strings.size()>0){ |
| | | List<Map<String, Object>> collect = maps.stream() |
| | | .filter(item -> !strings.contains(item.get("pacCode").toString())).collect(Collectors.toList()); |
| | | return AjaxResult.success(collect); |
| | | } |
| | | return AjaxResult.success(maps); |
| | | // return AjaxResult.success(collect); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getRedisValue") |
| | | @ApiOperation(value = "测试redis模糊查询") |
| | | public AjaxResult getRedisValue(@RequestParam int aa, |
| | |
| | | @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @RequestParam(required = false) String deptId, |
| | | @RequestParam(required = false) String tjName, |
| | | @RequestParam(required = false) String tjNum) throws SQLException { |
| | | @RequestParam(required = false) String tjNum) throws SQLException, JsonProcessingException { |
| | | // long start = System.currentTimeMillis(); |
| | | // //需要匹配的key |
| | | // ScanOptions options = ScanOptions.scanOptions() |
| | |
| | | |
| | | // List<Map<String, Object>> map = deptService.getSysDeptYjWjCustomerList(deptId, tjName, tjNum, aa, page, pageSize); |
| | | // List<ResultSet> map = deptService.getSysDeptYjWjCustomerList1(deptId, tjName, tjNum, aa, page, pageSize); |
| | | ResultSet resultSet = deptService.getSysDeptYjWjCustomerList12(deptId, tjName, tjNum, aa, page, pageSize); |
| | | while (resultSet.next()){ |
| | | String anInt = resultSet.getString(1); |
| | | System.out.println(anInt); |
| | | } |
| | | return AjaxResult.success(); |
| | | // ResultSet resultSet = deptService.getSysDeptYjWjCustomerList12(deptId, tjName, tjNum, aa, page, pageSize); |
| | | // while (resultSet.next()){ |
| | | // String anInt = resultSet.getString(1); |
| | | // System.out.println(anInt); |
| | | // } |
| | | |
| | | Map<String,Object> map = deptService.getSysDeptYjWjCustomerList13(deptId, tjName, tjNum, aa, page, pageSize); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getMiddleDetail") |
| | | @ApiOperation(value = "查询收费项目详情") |
| | | public AjaxResult getMiddleDetail() { |
| | | List<LtkjMiddleDetail> list = testMapper.getMiddleDetail(); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | |
| | | |
| | | |
| | | @GetMapping("/getMiddleHead") |
| | | @ApiOperation(value = "查询收费信息") |
| | | public AjaxResult getMiddleHead() { |
| | | List<LtkjMiddleHead> list = testMapper.getMiddleHead(); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | // @GetMapping("/getVbjitem") |
| | | // @ApiOperation(value = "查看列表") |
| | | // public AjaxResult getVbjitem() { |
| | | // List<LtkjVbjitem> list = testMapper.getVbjitem(); |
| | | // return AjaxResult.success(list); |
| | | // } |
| | | @GetMapping("/getMiddleHeadByPartId") |
| | | @ApiOperation(value = "根据身份证号查询收费信息") |
| | | public AjaxResult getMiddleHeadByPartId(@RequestParam String partId) { |
| | | TjCustomer customer = tjCustomerService.getTjCustomerByCusIdCard(partId); |
| | | LtkjMiddleHead pat = testMapper.getMiddleHeadByPartId(customer.getCardId()); |
| | | if (null != pat) { |
| | | List<LtkjMiddleDetail> list = testMapper.getMiddleDetailByFeadId(pat.getFeadId()); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | LtkjMiddleHead o = headService.getMiddleHeadByPartId(customer.getCardId()); |
| | | if(o==null){ |
| | | headService.save(pat); |
| | | for (LtkjMiddleDetail ltkjMiddleDetail : list) { |
| | | middleDetailService.save(ltkjMiddleDetail); |
| | | } |
| | | testMapper.saveTjProByCusId(customer.getCardId(),customer.getCusIdcard()); |
| | | } |
| | | testMapper.saveTjProByCusId(customer.getCardId(),customer.getCusIdcard()); |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getTjPat") |
| | | @ApiOperation(value = "测试getTjPat") |
| | | public AjaxResult getTjPat() { |
| | | List<LtkjTjPat> list = testMapper.getTjPat(); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getTjPatByIdCard") |
| | | @ApiOperation(value = "根据身份证号测试getTjPat") |
| | | public AjaxResult getTjPatByIdCard(@RequestParam String idCard) { |
| | | LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(idCard.trim()); |
| | | if(null != tjPatByIdCard){ |
| | | String fcardNo = tjPatByIdCard.getFcardNo(); |
| | | if(null !=fcardNo){ |
| | | fcardNo=fcardNo.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | } |
| | | LtkjTjPat ltkjTjPat = tjvLtkjvtjpatService.getLtkjTjPatByCusIdCard(idCard); |
| | | if(null==ltkjTjPat){ |
| | | tjvLtkjvtjpatService.save(tjPatByIdCard); |
| | | } |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | //再根据身份证号写customer表 |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(idCard); |
| | | if(null == tjCustomer){ |
| | | testMapper.getTjPatByCusId(idCard); |
| | | } |
| | | return AjaxResult.success(tjPatByIdCard); |
| | | } |
| | | |
| | | @GetMapping("/getExamJcbgd") |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getLtkjHisUser") |
| | | @ApiOperation(value = "同步his用户") |
| | | public AjaxResult getLtkjHisUser() { |
| | | List<LtkjHisUser> list = testMapper.getLtkjHisUser(); |
| | | if(null !=list && list.size()>0){ |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | for (LtkjHisUser user : list) { |
| | | LtkjHisUser hisUser= hisUserService.getHisUserByHisGh(user.getHisgh()); |
| | | if(null == hisUser){ |
| | | hisUserService.save(user); |
| | | } |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/dataSynchronization") |
| | | @ApiOperation(value = "同步sql server数据到本地数据库数据接口") |
| | | @RepeatSubmit |
| | | public AjaxResult dataSynchronization(@RequestParam String tjNumber) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | // final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | // if ("Y".equals(getInfoFromSqlData)) { |
| | | TjOrder order = orderService.getOrderByTjNum(tjNumber); |
| | | if (null != order) { |
| | | List<LtkjHysqd> one = testMapper.getHysqdByTmh(order.getCardId()); |
| | | if (one != null && one.size() > 0) { |
| | | for (LtkjHysqd ltkjHysqd : one) { |
| | | // DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | LtkjHysqd hysqd = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(ltkjHysqd.getTjh(), ltkjHysqd.getTmh()); |
| | | if(hysqd==null){ |
| | | ltkjHysqdService.save(ltkjHysqd); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | List<LtkjHybgd> one1 = testMapper.getHybgdByTmh(ltkjHysqd.getTmh()); |
| | | if (one1 != null && one1.size() > 0) { |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | ltkjHybgdService.saveBatch(one1); |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // List<LtkjExamJcsqd> one2 = testMapper.getExamJcsqdTmh(tjNumber); |
| | | // if (one2 != null && one2.size() > 0) { |
| | | // DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | // ltkjExamJcsqdService.saveBatch(one2); |
| | | // DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | // for (LtkjExamJcsqd ltkjExamJcsqd : one2) { |
| | | // List<LtkjExamJcbgd> one3 = testMapper.getExamJcbgdByTjh(ltkjExamJcsqd.getTmh()); |
| | | // if (one3 != null && one3.size() > 0) { |
| | | // DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | // ltkjExamJcbgdService.saveBatch(one3); |
| | | // DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | // } |
| | | // } |
| | | // } |
| | | //同步化验项目 |
| | | testMapper.updateDetailByCall(order.getCardId(), String.valueOf(order.getOrderId()),order.getTjNumber(), "1"); |
| | | //同步检查项目 |
| | | testMapper.updateDetailByTjJcCall(order.getCardId(), String.valueOf(order.getOrderId()),order.getTjNumber(),"1"); |
| | | } |
| | | // } |
| | | return AjaxResult.success("同步成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getTjYxjcList") |
| | | @ApiOperation(value = "查询影响检查项目") |
| | | public AjaxResult getTjYxjcList() { |
| | | List<Map<String, Object>> tjYxjcList = testMapper.getTjYxjcList("杨云云",null,null); |
| | | return AjaxResult.success(tjYxjcList); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getPacTjProjectList") |
| | | @ApiOperation(value = "维护套餐页面新增项目时调用") |
| | | public AjaxResult getPacTjProjectList() { |
| | | // LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjProject::getProParentId, 0); |
| | | // wq.eq(TjProject::getProStatus, 0); |
| | | List<TjProject> tjProjects = tjProjectService.getPacTjProjectList(); |
| | | // if (tjProjects != null) { |
| | | // for (TjProject project : tjProjects) { |
| | | // List<TjProject> projectList = tjProjectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); |
| | | // project.setTjProjectList(projectList); |
| | | // } |
| | | // return AjaxResult.success(tjProjects); |
| | | // } |
| | | return AjaxResult.success(tjProjects); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getHuaYanProByTjNum") |
| | | @ApiOperation(value = "根据体检号查询化验项目接口") |
| | | public AjaxResult getHuaYanProByTjNum(@RequestParam @ApiParam(value = "体检号") String tjNumber) { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | |
| | | List<TjOrderDetail> tjOrderDetails = tjOrderDetailService.addHuaYanTable(tjNumber); |
| | | List<TjOrderRemark> tjOrderRemarks = tjOrderRemarkService.addHuaYanTable(tjNumber); |
| | | map.put("tjOrderDetails",tjOrderDetails); |
| | | map.put("tjOrderRemarks",tjOrderRemarks); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | |
| | | } |