| | |
| | | </resultMap> |
| | | |
| | | <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> |
| | | <!--SELECT * |
| | | FROM ( |
| | | SELECT * |
| | | FROM ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | io.send_time, |
| | | GROUP_CONCAT(DISTINCT isa.sample SEPARATOR ' ') AS sample, |
| | | isu.userName, |
| | | isu2.checkName, |
| | | ip.son_laboratory, |
| | | io.ins_time, |
| | | io.laboratory, |
| | | ios.ins_state, |
| | | ios.verify_tell, |
| | | ios.verify_user |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ( |
| | | SELECT |
| | | ins_sample_id, |
| | | GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS userName |
| | | FROM |
| | | ins_sample_user u |
| | | LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE |
| | | son_laboratory = #{sonLaboratory} AND u.state = 0 |
| | | GROUP BY |
| | | ins_sample_id |
| | | ) isu ON isu.ins_sample_id = io.id |
| | | LEFT JOIN ( |
| | | SELECT |
| | | ins_sample_id, |
| | | uu.name AS checkName |
| | | FROM |
| | | ins_sample_user u |
| | | LEFT JOIN user uu ON u.user_id = uu.id |
| | | WHERE |
| | | son_laboratory = #{sonLaboratory} AND u.state = 1 |
| | | GROUP BY |
| | | ins_sample_id |
| | | ) isu2 ON isu2.ins_sample_id = io.id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = io.id AND ios.laboratory = ip.son_laboratory |
| | | WHERE |
| | | io.state = 1 |
| | | AND io.send_time IS NOT NULL |
| | | AND (ip.son_laboratory = #{sonLaboratory} OR isu.userName IS NULL OR isu2.checkName IS NULL) |
| | | <if test="userName != null and userName != ''"> |
| | | AND (isu.userName LIKE CONCAT('%', #{userName}, '%') OR isu2.checkName LIKE CONCAT('%', #{userName}, '%')) |
| | | </if> |
| | | GROUP BY |
| | | io.id, ip.son_laboratory |
| | | ORDER BY |
| | | io.type DESC, io.id |
| | | ) a |
| | | WHERE |
| | | a.ins_state IS NOT NULL |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | AND a.laboratory = #{laboratory} |
| | | </if> |
| | | ) b--> |
| | | select * from(select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId,ios.create_time,ios.sort |
| | | FROM |
| | | ( |
| | | SELECT |
| | |
| | | GROUP BY ins_sample_id |
| | | ORDER BY ins_sample_id |
| | | ) isu ON isu.ins_sample_id = io.id |
| | | |
| | | LEFT JOIN ( |
| | | SELECT ins_sample_id,uu.name checkName |
| | | FROM ins_sample_user u LEFT JOIN user uu ON u.user_id = uu.id |
| | |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | ORDER BY |
| | | ios.sort, |
| | | a.type DESC, |
| | | a.id |
| | | ios.create_time |
| | | ) b |
| | | where ins_state is not null |
| | | and son_laboratory=#{sonLaboratory} |
| | |
| | | LEFT JOIN user ON isu.user_id = user.id |
| | | WHERE |
| | | io.state = 1 |
| | | # AND io.ins_state != 5 |
| | | -- # AND io.ins_state != 5 |
| | | and send_time is not null |
| | | <if test="userId !=null and userId!=''"> |
| | | and (isu.user_id = #{userId} OR isu.user_id is NULL ) |
| | |
| | | isu2.ins_sample_id = a.id |
| | | where ins_state is not null |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and laboratory=#{laboratory} |
| | | and a.laboratory=#{laboratory} |
| | | </if> |
| | | ORDER BY |
| | | <!--a.user_id DESC,--> |
| | |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_order_id = #{id} |
| | | and state = 1 |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | -- and ins_fiber_id is null |
| | | -- and ins_fibers_id is null |
| | | and <!--isa.sample_code NOT REGEXP '/'--> |
| | | isa.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 ) |
| | | order by case when man_hour_group is NULL then 1 |
| | | when man_hour_group ='' then 1 else 0 end, |
| | | CASE |
| | | WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序 |
| | | WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分 |
| | | ,id asc |
| | | </select> |
| | | <select id="getInsOrderAndSample" resultMap="sampleDto"> |
| | | select isa.*, |
| | |
| | | where ins_order_id = #{id} |
| | | and ip.standard_method_list_id is not null |
| | | and state = 1 |
| | | order by case when man_hour_group is NULL then 1 |
| | | when man_hour_group ='' then 1 else 0 end, |
| | | CASE |
| | | WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序 |
| | | WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分 |
| | | ,id asc |
| | | </select> |
| | | |
| | | <select id="selectSampleProductListByOrderId3" resultMap="sampleDto3"> |
| | |
| | | <foreach collection="ids" open="(" close=")" item="id" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | order by case when man_hour_group is NULL then 1 |
| | | when man_hour_group ='' then 1 else 0 end, |
| | | CASE |
| | | WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序 |
| | | WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分 |
| | | ,id asc |
| | | </select> |
| | | |
| | | <select id="getInsProduct1" resultMap="product"> |