| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @Description: 导出详情 |
| | | */ |
| | | public void exportDetail() throws Exception { |
| | | try { |
| | | if (startTime == null || endTime == null){ FacesUtils.warn("请选择日期范围");return;} |
| | | |
| | | List<Map> list = opeUseFlowService.selectExportDetail(reagentCode, getUserId(), startTime, endTime, receiptNumber, department, project, applyPerson, reagentName); |
| | | if (list == null || list.size() < 1) {FacesUtils.warn("没有数据导出");return;} |
| | | opeUseFlowService.export22Excel(list); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | FacesUtils.warn("导出失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @SuppressWarnings("serial") |
| | | public LazyDataModel<OpeReagentStatus> getDataModel() { |
| | | if (this.dataModel == null) { |
| | |
| | | OpeUseFlow selectByReceiptNumber(Map params); |
| | | |
| | | List<Map> selectAll(Map params); |
| | | |
| | | List<Map> selectDetail(Map<String, Object> params); |
| | | |
| | | } |
| | |
| | | <include refid="queryWhereSql"/> |
| | | order by oa.create_time desc |
| | | </select> |
| | | |
| | | <select id="selectDetail" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | sr.product_sn productSn, |
| | | sr.NAME reagentName, |
| | | ouf.reagent_code reagentCode, |
| | | bm3.meta_value controlProducts, |
| | | bm.meta_value reagentFormat, |
| | | CONCAT(sr.main_metering,bm1.meta_value) perInfo, |
| | | bm2.meta_value productHome, |
| | | ors.article_number articleNumber, |
| | | su.name username, |
| | | su.project, |
| | | bm4.meta_value department, |
| | | sl.name location, |
| | | date_format(ouf.create_time,'%Y-%m-%d %H:%i') createTime |
| | | from `ope_use_flow` ouf |
| | | LEFT JOIN ope_reagent_status ors ON ors.reagent_code = ouf.reagent_code |
| | | LEFT join sys_reagent sr ON ors.reagent_id = sr.id |
| | | LEFT JOIN base_meta bm ON bm.id = sr.reagent_format |
| | | LEFT JOIN base_meta bm1 on bm1.id = sr.reagent_unit |
| | | LEFT JOIN base_meta bm2 on bm2.id = sr.product_home |
| | | LEFT JOIN base_meta bm3 on bm3.id = sr.control_products |
| | | LEFT JOIN sys_user as su on su.id = ouf.user_id |
| | | left join base_meta bm4 on bm4.id = su.department |
| | | LEFT JOIN sys_laboratory sl on sl.id = ouf.house_id |
| | | WHERE |
| | | (ouf.operatestate = #{operatestate} |
| | | or ouf.operatestate = #{operatestate1}) |
| | | and ouf.valid_flag = 1 |
| | | and LENGTH(trim(ouf.receipt_number))>0 |
| | | <if test="userId !=null and userId != ''"> |
| | | and ouf.user_id = #{userId} |
| | | </if> |
| | | <if test="reagentCode !=null and reagentCode != ''"> |
| | | and ouf.reagent_code like concat("%",#{reagentCode},"%") |
| | | </if> |
| | | <if test="startTime !=null and startTime != ''"> |
| | | and ouf.create_time >#{startTime} |
| | | </if> |
| | | <if test="endTime !=null and endTime != ''"> |
| | | and ouf.create_time <#{endTime} |
| | | </if> |
| | | <if test="project !=null and project != ''"> |
| | | and su.project like concat("%",#{project},"%") |
| | | </if> |
| | | <if test="department !=null and department != ''"> |
| | | and su.bm1.meta_value like concat("%",#{department},"%") |
| | | </if> |
| | | <if test="receiptNumber !=null and receiptNumber != ''"> |
| | | and ouf.receipt_number like concat("%",#{receiptNumber},"%") |
| | | </if> |
| | | <if test="reagentName !=null and reagentName != ''"> |
| | | and sr.name like concat("%",#{reagentName},"%") |
| | | </if> |
| | | <if test="applyPerson !=null and applyPerson != ''"> |
| | | and su.name like concat("%",#{applyPerson},"%") |
| | | </if> |
| | | </select> |
| | | |
| | | <insert id="insertOpeUseFlow" parameterType="com.nanometer.smartlab.entity.OpeUseFlow"> |
| | | insert into ope_use_flow(id, reagent_code, status, house_id, container_id, user_id, remainder, place, store_type, valid_flag, create_time, realstatus, operatestate |
| | | <if test="receiptNumber != null"> |
| | |
| | | List<Map> selectAll(String houseName, String reagentId, String reagentCode, String containerCode, String userId, Date startDate, Date endDate); |
| | | |
| | | boolean export2Excel(List<Map> list) throws Exception; |
| | | |
| | | List<Map> selectExportDetail(String reagentCode, String userId, Date startTime, Date endTime, String receiptNumber, String department, String project, String applyPerson, String reagentName); |
| | | |
| | | boolean export22Excel(List<Map> list) throws Exception; |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.hazelcast.core.IFunction; |
| | | import com.nanometer.smartlab.dao.*; |
| | | import com.nanometer.smartlab.entity.*; |
| | | import com.nanometer.smartlab.entity.dto.PersonUseDetail; |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 查询导出 |
| | | */ |
| | | @Override |
| | | public List<Map> selectExportDetail(String reagentCode, String userId, Date startTime, Date endTime, String receiptNumber, String department, String project, String applyPerson, String reagentName) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | Map<String, String> metaMap2 = new HashMap<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | if (startTime != null) { |
| | | params.put("startTime", sdf.format(startTime) +" 00:00:00"); |
| | | } |
| | | |
| | | if (endTime != null) { |
| | | params.put("endTime", sdf.format(endTime) + " 23:59:59"); |
| | | } |
| | | |
| | | params.put("reagentCode", reagentCode); |
| | | |
| | | params.put("endTime", endTime); |
| | | params.put("receiptNumber", receiptNumber); |
| | | params.put("department", department); |
| | | params.put("project", project); |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("reagentName", reagentName); |
| | | params.put("groupId", "operate_status"); |
| | | metaMap2.put("metaKey", String.valueOf(OperateStatus.WAREHOUSEOUT.getKey())); |
| | | List<BaseMeta> baseMetas = baseMetaDao.getBaseMetaList(metaMap2); |
| | | params.put("operatestate", baseMetas.get(0).getId()); |
| | | |
| | | metaMap2.put("metaKey", String.valueOf(OperateStatus.TRANSFER.getKey())); |
| | | List<BaseMeta> baseMetas1 = baseMetaDao.getBaseMetaList(metaMap2); |
| | | params.put("operatestate1", baseMetas1.get(0).getId()); |
| | | addParamByUserId(userId, params); |
| | | return opeUseFlowDao.selectDetail(params); |
| | | } |
| | | |
| | | @Override |
| | | public boolean export22Excel(List<Map> list) throws Exception { |
| | | Map<String,String> map = new LinkedHashMap<>(); |
| | | map.put("productSn", "产品编号"); |
| | | map.put("reagentName", "试剂名称"); |
| | | map.put("reagentCode", "试剂条形码"); |
| | | map.put("controlProducts", "管制品"); |
| | | map.put("reagentFormat", "规格型号"); |
| | | map.put("perInfo", "包装"); |
| | | map.put("productHome", "厂家"); |
| | | map.put("articleNumber", "批号"); |
| | | map.put("username", "申领人"); |
| | | map.put("project", "课题组"); |
| | | map.put("department", "部门"); |
| | | map.put("location", "地点"); |
| | | map.put("createTime", "领用时间"); |
| | | ExcelUtils.export2Excel(list,"试剂领用记录表",map); |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | oncomplete="PF('dialog').show()"/> |
| | | |
| | | |
| | | <p:commandButton value="导出" |
| | | styleClass="store-btn" |
| | | ajax="false" |
| | | actionListener="#{personalUseInfoController.exportDetail}" /> |
| | | |
| | | |
| | | </p:panelGrid> |
| | | </p:panel> |
| | | </p:panel> |