|
@ -11,6 +11,7 @@ import com.yihu.jw.entity.a1entity.Mediicinedrugs;
|
|
import com.yihu.jw.entity.a1entity.Mediicinestockoutdetail;
|
|
import com.yihu.jw.entity.a1entity.Mediicinestockoutdetail;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
@ -18,18 +19,18 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import jxl.Workbook;
|
|
import jxl.Workbook;
|
|
import jxl.write.Label;
|
|
|
|
import jxl.write.WritableSheet;
|
|
|
|
import jxl.write.WritableWorkbook;
|
|
|
|
import jxl.write.WriteException;
|
|
|
|
|
|
import jxl.format.Alignment;
|
|
|
|
import jxl.write.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@ -146,9 +147,8 @@ public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
|
|
@RequestParam(value = "heightPrice", required = false) String heightPrice,
|
|
@RequestParam(value = "heightPrice", required = false) String heightPrice,
|
|
HttpServletResponse response) {
|
|
HttpServletResponse response) {
|
|
try {
|
|
try {
|
|
JSONObject result = drugsService.queryDrugListFullInfo(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
|
|
|
|
List<Mediicinedrugs> list = JSONObject.parseArray(result.getJSONArray("msg").toJSONString(), Mediicinedrugs.class);
|
|
|
|
|
|
|
|
|
|
MixEnvelop result = drugsService.queryDrugListFullInfo2(state, content, drugClass, drugType, lowVolume, heightVolume, lowPrice, heightPrice,1,10000,wechatId);
|
|
|
|
List<Map<String,Object>> list=result.getDetailModelList();
|
|
response.setContentType("application/octet-stream");
|
|
response.setContentType("application/octet-stream");
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + new String("volunteerInfo.xls"));
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + new String("volunteerInfo.xls"));
|
|
OutputStream os = response.getOutputStream();
|
|
OutputStream os = response.getOutputStream();
|
|
@ -158,8 +158,8 @@ public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void write(OutputStream os, List<Mediicinedrugs> list) throws Exception {
|
|
|
|
WritableWorkbook wwb = Workbook.createWorkbook(os);
|
|
|
|
|
|
private void write(OutputStream os, List<Map<String,Object>> list) throws Exception {
|
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
try {
|
|
try {
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
WritableSheet sheet = wwb.createSheet("sheet", 1);
|
|
String header[] = {"图片", "药品名称/药品条码", "分类", "剂型", "类型", "单位", "售价", "库存", "销量", "自编码", "规格", "厂家", "批准文号", "品牌", "状态"};
|
|
String header[] = {"图片", "药品名称/药品条码", "分类", "剂型", "类型", "单位", "售价", "库存", "销量", "自编码", "规格", "厂家", "批准文号", "品牌", "状态"};
|
|
@ -170,35 +170,40 @@ public class MedicineDrugsEndpoint extends EnvelopRestEndpoint {
|
|
}
|
|
}
|
|
int j = 1;
|
|
int j = 1;
|
|
int ii=1;
|
|
int ii=1;
|
|
for (Mediicinedrugs tmp : list) {
|
|
|
|
|
|
for (Map<String,Object> tmp : list) {
|
|
addCell(sheet, j, 0, ii + "img");
|
|
addCell(sheet, j, 0, ii + "img");
|
|
addCell(sheet, j, 1, tmp.getDrugNameAlies() +"/" + tmp.getDrugBarCode());
|
|
|
|
addCell(sheet, j, 2, tmp.getDrugTypeCode());
|
|
|
|
addCell(sheet, j, 3, tmp.getDosForm() + "");
|
|
|
|
addCell(sheet, j, 4, tmp.getDrugTypeCode()+"");
|
|
|
|
addCell(sheet, j, 5, tmp.getUnit() + "");
|
|
|
|
addCell(sheet, j, 6, tmp.getPrice() + "");
|
|
|
|
addCell(sheet, j, 7, tmp.getInventory() + "");
|
|
|
|
addCell(sheet, j, 8, tmp.getSaleVolume() + "");
|
|
|
|
addCell(sheet, j, 9, tmp.getSelfCode() + "");
|
|
|
|
addCell(sheet, j, 10, tmp.getSpecif() + "");
|
|
|
|
addCell(sheet, j, 11, tmp.getManufactor() + "");
|
|
|
|
addCell(sheet, j, 12, tmp.getApprovalNum() + "");
|
|
|
|
addCell(sheet, j, 13, tmp.getBrand() + "");
|
|
|
|
addCell(sheet, j, 14, tmp.getState() + "");
|
|
|
|
|
|
addCell(sheet, j, 1, tmp.get("drugNameAlies") +"/" + tmp.get("drugBarCode"));
|
|
|
|
addCell(sheet, j, 2, tmp.get("drugTypeCode").toString());
|
|
|
|
addCell(sheet, j, 3, tmp.get("dosForm") + "");
|
|
|
|
addCell(sheet, j, 4, tmp.get("drugTypeCode")+"");
|
|
|
|
addCell(sheet, j, 5, tmp.get("unit") + "");
|
|
|
|
addCell(sheet, j, 6, tmp.get("price") + "");
|
|
|
|
addCell(sheet, j, 7, tmp.get("inventory") + "");
|
|
|
|
addCell(sheet, j, 8, tmp.get("saleVolume") + "");
|
|
|
|
addCell(sheet, j, 9, tmp.get("selfCode") + "");
|
|
|
|
addCell(sheet, j, 10, tmp.get("specif") + "");
|
|
|
|
addCell(sheet, j, 11, tmp.get("manufactor") + "");
|
|
|
|
addCell(sheet, j, 12, tmp.get("approvalNum") + "");
|
|
|
|
addCell(sheet, j, 13, tmp.get("brand") + "");
|
|
|
|
addCell(sheet, j, 14, tmp.get("state") + "");
|
|
j++;
|
|
j++;
|
|
ii++;
|
|
ii++;
|
|
}
|
|
}
|
|
wwb.write();
|
|
wwb.write();
|
|
wwb.close();
|
|
wwb.close();
|
|
} catch (Exception e) {
|
|
|
|
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
if (wwb != null) wwb.close();
|
|
if (wwb != null) wwb.close();
|
|
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
|
|
private void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
|
|
Label label = new Label(column, row, data);
|
|
Label label = new Label(column, row, data);
|
|
|
|
WritableCellFormat cellFormat=new WritableCellFormat();
|
|
|
|
cellFormat.setAlignment(Alignment.CENTRE);
|
|
|
|
cellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
|
|
label.setCellFormat(cellFormat);
|
|
ws.addCell(label);
|
|
ws.addCell(label);
|
|
}
|
|
}
|
|
|
|
|