| | |
| | | </where> |
| | | </select> |
| | | <select id="selectProcedureProcessList" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.ProcedureProcessModel"> |
| | | select a.PROCEDURE_ID as procedureId, |
| | | <!-- select a.PROCEDURE_ID as procedureId, |
| | | b.name as procedureName, |
| | | sum(a.num) as num, |
| | | count(DISTINCT(a.id)) as planCount, |
| | |
| | | and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} |
| | | and b.DELETED=0 |
| | | GROUP BY a.PROCEDURE_ID |
| | | order by b.SORTNUM |
| | | order by b.SORTNUM--> |
| | | |
| | | select t.PROCEDURE_ID as procedureId,count(t.id) as planCount, t.SORTNUM,t.procedureName,sum(t.num) as num ,sum(t.qualifiedNum) as qualifiedNum,sum(t.unqualifiedNum) as unqualifiedNum |
| | | from (select a.id,a.PROCEDURE_ID , |
| | | b.name as procedureName, |
| | | a.num as num, |
| | | b.SORTNUM, |
| | | (select sum(d.QUALIFIED_NUM) from workorder_record d where d.DELETED=0 and d.PLAN_ID=a.id and d.TYPE=1 ) as qualifiedNum , |
| | | (select sum(d.UNQUALIFIED_NUM) from workorder_record d where d.DELETED=0 and d.PLAN_ID=a.id and d.TYPE=1 ) as unqualifiedNum |
| | | from plans a |
| | | left join procedures b on a.PROCEDURE_ID =b.ID |
| | | where ( a.`STATUS` in (1,4) or (a.`STATUS`=6 and EXISTS(select e.id from workorder_record e where e.PLAN_ID = a.id and TO_DAYS(now())=TO_DAYS(e.CREATE_TIME)))) and b.DELETED=0 |
| | | and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} |
| | | ) t |
| | | GROUP BY t.PROCEDURE_ID |
| | | order by t.SORTNUM |
| | | </select> |
| | | <select id="selectStatisticsList" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.ProcedurePlansPageModel"> |
| | | select a.status,a.NUM,m.name as categoryName,m.code as materialCode,m.name as materialName |
| | |
| | | </insert> |
| | | <select id="getPlansStaticticsData" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultType="doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel"> |
| | | SELECT count(a.id) as ingNum, |
| | | (select count(b.id) FROM `plans` b where b.DELETED = 0 and b.PROCEDURE_ID=#{procedureId} AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND (b.`STATUS` in (1,4) and now() > b.plan_Date )) as delayNum, |
| | | (select count(b.id) FROM `plans` b where b.DELETED = 0 and b.PROCEDURE_ID=#{procedureId} AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND (b.`STATUS` in (1,4) and to_days(now()) > to_days(b.plan_Date) )) as delayNum, |
| | | (select count(distinct(b.CREATE_USER)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status in (0,1,2,3,4,7) AND to_days(b.create_time)=to_days(now())) as prouserNum, |
| | | (select count(distinct(b.PRO_GROUP_ID)) FROM workorder b where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND b.status in (0,1,2,3,4,7) AND to_days(b.create_time)=to_days(now())) as deviceNum, |
| | | (select sum(ifnull(b.UNQUALIFIED_NUM,0)) FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.PROCEDURE_ID=#{procedureId} AND b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId} AND c.status=4 AND to_days(b.create_time)=to_days(now())) as unqualifiedNum, |