|  | @ -31,10 +31,13 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.mysql.query.BaseJpaService;
 | 
	
		
			
				|  |  | import jxl.*;
 | 
	
		
			
				|  |  | import jxl.write.*;
 | 
	
		
			
				|  |  | import net.sf.json.JSONArray;
 | 
	
		
			
				|  |  | import net.sf.json.JSONObject;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.time.DateUtils;
 | 
	
		
			
				|  |  | import org.apache.poi.ss.usermodel.*;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
	
		
			
				|  | @ -43,6 +46,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.IOException;
 | 
	
		
			
				|  |  | import java.io.OutputStream;
 | 
	
		
			
				|  |  | import java.lang.Boolean;
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
	
		
			
				|  | @ -969,7 +975,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Boolean setMailno(String mailno,String expressageId){
 | 
	
		
			
				|  |  |     public Boolean setMailno(String mailno, String expressageId){
 | 
	
		
			
				|  |  |         WlyyPrescriptionExpressageDO expressageDO =  prescriptionExpressageDao.findOne(expressageId);
 | 
	
		
			
				|  |  |         expressageDO.setMailno(mailno);
 | 
	
		
			
				|  |  |         prescriptionExpressageDao.save(expressageDO);
 | 
	
	
		
			
				|  | @ -977,5 +983,81 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void pushListWrite(OutputStream os, List<Map<String,Object>> ls) throws Exception{
 | 
	
		
			
				|  |  |         WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             WritableSheet ws;
 | 
	
		
			
				|  |  |             ws = wwb.createSheet("sheet",1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String[] header = {"订单日期","收货人","诊断结果","配送方式", "订单状态"};
 | 
	
		
			
				|  |  |             int k = 0;
 | 
	
		
			
				|  |  |             for (String h : header) {
 | 
	
		
			
				|  |  |                 addCell(ws, 0, k, h);//表名,行,列,header
 | 
	
		
			
				|  |  |                 k++;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             int i = 1;
 | 
	
		
			
				|  |  |             for (Map<String,Object> m : ls) {
 | 
	
		
			
				|  |  |                 addCell(ws, i, 0, DateUtil.dateToStr((Date)m.get("createTime"),"yyyy-MM-dd HH:mm:ss"),"");
 | 
	
		
			
				|  |  |                 addCell(ws, i, 1, (String)m.get("name"),"");
 | 
	
		
			
				|  |  |                 addCell(ws, i, 2, (String)m.get("icd10Name"),"");
 | 
	
		
			
				|  |  |                 addCell(ws, i, 3, getOneselfPickupFlgString((Integer)m.get("oneselfPickupFlg")),"");
 | 
	
		
			
				|  |  |                 addCell(ws, i, 4, getStatusName((Integer)m.get("status")),"");
 | 
	
		
			
				|  |  |                 i++;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             wwb.write();
 | 
	
		
			
				|  |  |             wwb.close();
 | 
	
		
			
				|  |  |         } catch (IOException e) {
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             if (wwb != null) wwb.close();
 | 
	
		
			
				|  |  |             throw e;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String getOneselfPickupFlgString(Integer oneselfPickupFlg){
 | 
	
		
			
				|  |  |         if(1 == oneselfPickupFlg){
 | 
	
		
			
				|  |  |             return "自取";
 | 
	
		
			
				|  |  |         }else if(0 == oneselfPickupFlg){
 | 
	
		
			
				|  |  |             return "快递";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             return "其他";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String getStatusName(Integer status){
 | 
	
		
			
				|  |  |         if(31==status){
 | 
	
		
			
				|  |  |             return "待配送";
 | 
	
		
			
				|  |  |         }else if(32==status){
 | 
	
		
			
				|  |  |             return "配送中";
 | 
	
		
			
				|  |  |         }else if(100==status){
 | 
	
		
			
				|  |  |             return "已完成";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             return "其他";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //添加单元格内容
 | 
	
		
			
				|  |  |     public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
 | 
	
		
			
				|  |  |         Label label = new Label(column ,row, data);
 | 
	
		
			
				|  |  |         ws.addCell(label);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     //添加单元格内容
 | 
	
		
			
				|  |  |     public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
 | 
	
		
			
				|  |  |         Label label = new Label(column ,row, data);
 | 
	
		
			
				|  |  |         if(!org.springframework.util.StringUtils.isEmpty(memo)){
 | 
	
		
			
				|  |  |             WritableCellFeatures cellFeatures = new WritableCellFeatures();
 | 
	
		
			
				|  |  |             cellFeatures.setComment(memo);
 | 
	
		
			
				|  |  |             label.setCellFeatures(cellFeatures);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         ws.addCell(label);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |