inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
@@ -37,7 +37,7 @@ //获取检验结论,检验数量 List<Map<String, Object>> getResultNum(); //计算原材料与成品的合格率 //计算原材料的合格率 Long qualified(Integer b); //计算原材料检验单总数 @@ -45,5 +45,8 @@ //计算成品检验单总数 Integer getallfin(); //计算原材料合格率 Long qualifiedfin(Integer i); } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
@@ -6,6 +6,7 @@ import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; import com.yuanchu.limslaboratory.service.HomeService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; @@ -64,6 +65,7 @@ //计算原材料与成品的合格率 @Override @Transactional(rollbackFor = Exception.class) public StatisticsDataVo qualified() { StatisticsDataVo statisticsDataVo = new StatisticsDataVo(); //原材料检验单总数 @@ -81,8 +83,14 @@ //成品检验单总数 Integer allfin = inspectionMapper.getallfin(); //成品合格率 Long finished = inspectionMapper.qualifiedfin(1); statisticsDataVo.setFinished(getRadio(allfin, finished)); //成品不合格率 Long unfinished = inspectionMapper.qualifiedfin(0); statisticsDataVo.setUnfinished(getRadio(allfin, unfinished)); //成品未检验率 Long notfinished = inspectionMapper.qualifiedfin(null); statisticsDataVo.setNotfinished(getRadio(allfin, notfinished)); return statisticsDataVo; } inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -51,6 +51,20 @@ </select> <!--检验结论,检验数量--> <select id="qualified" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 <if test="b!=null "> and inspection_status = #{b} </if> <if test="b==null"> and inspection_status is null </if> </select> <!--计算原材料与成品的合格率--> <select id="getResultNum" resultType="java.util.Map"> select inspection_status result, count(id) num @@ -58,15 +72,6 @@ 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> <!--计算原材料检验单总数--> @@ -82,6 +87,20 @@ select count(id) from lims_laboratory.inspection where state = 1 and type in (1,2) and type in (1, 2) </select> <!--计算原材料合格率--> <select id="qualifiedfin" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) <if test="i!=null "> and inspection_status = #{i} </if> <if test="i==null"> and inspection_status is null </if> </select> </mapper> laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -23,7 +23,8 @@ <!--选择设备--> <resultMap id="chooseinstumMap" type="map"> <id property="name" column="father_name"/> <id property="id" column="cid"/> <result property="name" column="father_name"/> <collection property="children" resultMap="chooseinstumTowMap" javaType="List"/> </resultMap> <resultMap id="chooseinstumTowMap" type="map">