| | |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; |
| | | import com.yuanchu.limslaboratory.service.HomeService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Resource |
| | | HomeService homeService; |
| | | |
| | | @ApiOperation("è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°éæ¥å£") |
| | | @ApiOperation("è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°é") |
| | | @GetMapping("/checkProjectNum") |
| | | public Result checkProjectNum() { |
| | | ProjectNumVo projectNumVo =homeService.checkProjectNum(); |
| | |
| | | List<Map<String, Object>> unchecktop4s =homeService.unchecktop4(); |
| | | return Result.success(unchecktop4s); |
| | | } |
| | | |
| | | @ApiOperation("计ç®åææä¸æåçåæ ¼ç") |
| | | @GetMapping("/qualified") |
| | | public Result qualified() { |
| | | StatisticsDataVo statisticsData =homeService.qualified(); |
| | | return Result.success(statisticsData); |
| | | } |
| | | } |
| | |
| | | |
| | | //è·åæ£éªç»è®º,æ£éªæ°é |
| | | List<Map<String, Object>> getResultNum(); |
| | | |
| | | //计ç®åææä¸æåçåæ ¼ç |
| | | Long qualified(Integer b); |
| | | |
| | | //计ç®åæææ£éªåæ»æ° |
| | | Integer getallmater(); |
| | | |
| | | //è®¡ç®æåæ£éªåæ»æ° |
| | | Integer getallfin(); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class StatisticsDataVo { |
| | | |
| | | private BigDecimal material; //åææåæ ¼ç |
| | | private BigDecimal unmaterial; //åææä¸åæ ¼ç |
| | | private BigDecimal notmaterial; //åæææªæ£éªç |
| | | |
| | | |
| | | private BigDecimal finished; //æååæ ¼ç |
| | | private BigDecimal unfinished; //æåä¸åæ ¼ç |
| | | private BigDecimal notfinished; //æåæªæ£éªç |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | /** |
| | | * è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°éæ¥å£ |
| | | * |
| | | * @return |
| | | */ |
| | | ProjectNumVo checkProjectNum(); |
| | | |
| | | /** |
| | | * å·²æ£éªtop3 |
| | | * |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> checktop3(); |
| | | |
| | | /** |
| | | * æªæ£éªtop4 |
| | | * |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> unchecktop4(); |
| | | |
| | | /** |
| | | * 计ç®åææä¸æåçåæ ¼ç |
| | | * @return |
| | | */ |
| | | StatisticsDataVo qualified(); |
| | | } |
| | |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; |
| | | import com.yuanchu.limslaboratory.service.HomeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | //éåè·åæ°é |
| | | Long num = (Long) map.get("num"); |
| | | //计ç®ç¾åæ¯å¹¶åå
¥mapä¸ |
| | | map.put("chact",getRadio(allIns,num)); |
| | | map.put("chact", getRadio(allIns, num)); |
| | | } |
| | | return mapList; |
| | | } |
| | |
| | | return mapList; |
| | | } |
| | | |
| | | //计ç®åææä¸æåçåæ ¼ç |
| | | @Override |
| | | public StatisticsDataVo qualified() { |
| | | StatisticsDataVo statisticsDataVo = new StatisticsDataVo(); |
| | | //åæææ£éªåæ»æ° |
| | | Integer allmater = inspectionMapper.getallmater(); |
| | | //åææåæ ¼ç |
| | | Long mater = inspectionMapper.qualified(1); |
| | | statisticsDataVo.setMaterial(getRadio(allmater, mater)); |
| | | //åææä¸åæ ¼ç |
| | | Long unmater = inspectionMapper.qualified(0); |
| | | statisticsDataVo.setUnmaterial(getRadio(allmater, unmater)); |
| | | //åæææªæ£éªç |
| | | Long notmater = inspectionMapper.qualified(null); |
| | | statisticsDataVo.setNotmaterial(getRadio(allmater, notmater)); |
| | | |
| | | //æåæ£éªåæ»æ° |
| | | Integer allfin = inspectionMapper.getallfin(); |
| | | //æååæ ¼ç |
| | | //æåä¸åæ ¼ç |
| | | //æåæªæ£éªç |
| | | |
| | | return statisticsDataVo; |
| | | } |
| | | |
| | | /*计ç®ç¾åæ¯*/ |
| | | private BigDecimal getRadio(Integer all, Long num) { |
| | | if (all.intValue() == 0) { |
| | |
| | | select inspection_status result, |
| | | count(id) num |
| | | from lims_laboratory.inspection |
| | | where state=1 |
| | | where state = 1 |
| | | group by result |
| | | order by num desc |
| | | </select> |
| | | |
| | | <!--计ç®åææä¸æåçåæ ¼ç--> |
| | | <select id="qualified" resultType="java.lang.Long"> |
| | | select count(id) |
| | | from lims_laboratory.inspection |
| | | where state = 1 |
| | | and type = 0 |
| | | and inspection_status = #{b} |
| | | </select> |
| | | |
| | | <!--计ç®åæææ£éªåæ»æ°--> |
| | | <select id="getallmater" resultType="java.lang.Integer"> |
| | | select count(id) |
| | | from lims_laboratory.inspection |
| | | where state = 1 |
| | | and type = 0 |
| | | </select> |
| | | |
| | | <!--è®¡ç®æåæ£éªåæ»æ°--> |
| | | <select id="getallfin" resultType="java.lang.Integer"> |
| | | select count(id) |
| | | from lims_laboratory.inspection |
| | | where state = 1 |
| | | and type in (1,2) |
| | | </select> |
| | | </mapper> |
| | |
| | | <!--è·åæ£éªé¡¹ç®,设å¤,æ£éªå¼å§æ¶é´,æ§è¡äºº,æ£éªç»ææ¶é´--> |
| | | <select id="getResultNum" resultType="java.util.Map"> |
| | | select ip.name, |
| | | equipment_name instrumentname, |
| | | start_time startTime, |
| | | user.name checkname, |
| | | end_time endTime |
| | | equipment_name instrumentname, |
| | | DATE_FORMAT(start_time, '%Y-%m-%d') startTime, |
| | | user.name checkname, |
| | | DATE_FORMAT(end_time, '%Y-%m-%d') endTime |
| | | from lims_laboratory.inspection_product ip |
| | | left join lims_laboratory.inspection_material on ip.inspection_material_id = inspection_material.id |
| | | left join lims_laboratory.inspection i on inspection_material.inspection_id = i.id |
| | | left join lims_laboratory.instrument on ip.instrument_id = instrument.id |
| | | left join lims_laboratory.user on ip.user_id = user.id |
| | | where ip.state=1 |
| | | and test_state is null |
| | | where ip.state = 1 |
| | | and test_state is null |
| | | order by start_time |
| | | limit 4 |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <!--éæ©è®¾å¤--> |
| | | <resultMap id="chooseinstumMap" type="map"> |
| | | <id property="father_name" column="father_name"/> |
| | | <collection property="father" resultMap="chooseinstumTowMap" javaType="List"/> |
| | | <id property="name" column="father_name"/> |
| | | <collection property="children" resultMap="chooseinstumTowMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="chooseinstumTowMap" type="map"> |
| | | <id property="son_name" column="son_name"/> |
| | | <collection property="chldren" resultMap="chooseinstumTowsMap" javaType="List"/> |
| | | <id property="id" column="cid"/> |
| | | <result property="name" column="son_name"/> |
| | | <collection property="children" resultMap="chooseinstumTowsMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="chooseinstumTowsMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | </resultMap> |
| | | <select id="chooseinstum" resultMap="chooseinstumMap"> |
| | | select instrument.id, |
| | | father_name, |
| | | son_name, |
| | | select c.id cid, |
| | | instrument.id, |
| | | father_name , |
| | | son_name , |
| | | equipment_name name |
| | | from lims_laboratory.instrument |
| | | left join lims_laboratory.classify c on c.id = instrument.classify_id |