| | |
| | | */ |
| | | public interface InsSampleMapper extends BaseMapper<InsSample> { |
| | | |
| | | IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId,String sonLaboratory); |
| | | IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page, @Param("ew") QueryWrapper<InsOrderPlanDTO> ew, @Param("userId") Integer userId, @Param("sonLaboratory") String sonLaboratory, @Param("laboratory") String laboratory); |
| | | |
| | | IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId,String sonLaboratory); |
| | | IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, @Param("ew") QueryWrapper<InsOrderPlanDTO> ew, @Param("userId") Integer userId, @Param("sonLaboratory") String sonLaboratory, @Param("laboratory") String laboratory); |
| | | |
| | | List<SampleProductDto> selectSampleProductListByOrderId(Integer id); |
| | | |
| | |
| | | public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(InsOrderPlanVO.class)); |
| | | Integer userId = null; |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | Integer userId =null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) { |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | userId = map1.get("userId"); |
| | | userId = map1.get("userId"); |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | |
| | | map.put("head", PrintChina.printChina(InsOrderPlanTaskSwitchVo.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | |
| | | <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto"> |
| | | select * |
| | | from ( |
| | | SELECT |
| | | <!--SELECT |
| | | io.*, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | (select count(*) from ins_sample isa2 |
| | | where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num, |
| | | where isa2.ins_order_id = io.id and CHAR_LENGTH(isa2.sample_code) <32 ) sample_num, |
| | | concat(ROUND((select count(*) from ins_product ip |
| | | where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where |
| | | ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2 |
| | |
| | | and io.laboratory=#{laboratory} |
| | | </if> |
| | | GROUP BY |
| | | io.id--> |
| | | |
| | | SELECT |
| | | io.*, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | sample_counts.sample_num, |
| | | CONCAT(ROUND(approved_product_counts.approved_count / total_product_counts.total_count * 100, 2), '%') AS insProgress, |
| | | GROUP_CONCAT(DISTINCT isa.sample_code SEPARATOR ' ') AS sample_code, |
| | | GROUP_CONCAT(DISTINCT isa.sample SEPARATOR ' ') AS sample_name, |
| | | GROUP_CONCAT(DISTINCT isa.model SEPARATOR ' ') AS sample_model, |
| | | u.name |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN |
| | | ins_sample isa ON io.id = isa.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT id, ins_order_id, is_ratify, url, url_s FROM ins_report WHERE is_ratify = 1) ir ON io.id = ir.ins_order_id |
| | | LEFT JOIN |
| | | user u ON io.create_user = u.id |
| | | LEFT JOIN |
| | | (SELECT ins_order_id, COUNT(*) AS sample_num |
| | | FROM ins_sample |
| | | WHERE id in(select id1 from (select is2.id id1 ,ip.id from ins_sample is2 left join ins_product ip on is2.id = ip.ins_sample_id where ip.id is not null)s ) |
| | | GROUP BY ins_order_id) sample_counts ON io.id = sample_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS total_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 |
| | | GROUP BY ins_sample.ins_order_id) total_product_counts ON io.id = total_product_counts.ins_order_id |
| | | LEFT JOIN |
| | | (SELECT ins_sample.ins_order_id, COUNT(*) AS approved_count |
| | | FROM ins_product |
| | | JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id |
| | | WHERE ins_product.state = 1 AND ins_product.ins_result IS NOT NULL |
| | | GROUP BY ins_sample.ins_order_id) approved_product_counts ON io.id = approved_product_counts.ins_order_id |
| | | WHERE |
| | | 1=1 |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | AND io.laboratory=#{laboratory} |
| | | </if> |
| | | GROUP BY |
| | | io.id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | |
| | | isu.user_id, |
| | | user.name userName, |
| | | ip.son_laboratory, |
| | | io.ins_time |
| | | io.ins_time, |
| | | io.laboratory |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | |
| | | a.type DESC, |
| | | a.id |
| | | ) b |
| | | where ins_state is not null)A |
| | | where ins_state is not null |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | )A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | |
| | | isu.user_id, |
| | | user.name userName, |
| | | ip.son_laboratory, |
| | | io.ins_time |
| | | io.ins_time, |
| | | io.laboratory |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | |
| | | a.type DESC, |
| | | a.id |
| | | ) b |
| | | where ins_state is not null )A |
| | | where ins_state is not null |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and laboratory=#{laboratory} |
| | | </if> |
| | | )A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |