|
@ -11,6 +11,7 @@ import com.yihu.jw.door.service.WlyyDoorServiceOrderService;
|
|
|
import com.yihu.jw.door.service.common.HospitalService;
|
|
|
import com.yihu.jw.door.service.common.ServerPackageService;
|
|
|
import com.yihu.jw.door.service.prescription.JwDoorPrescriptionService;
|
|
|
import com.yihu.jw.door.util.StreamUtil;
|
|
|
import com.yihu.jw.entity.door.WlyyDoorConclusionDO;
|
|
|
import com.yihu.jw.entity.door.WlyyDoorServiceOrderDO;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
@ -1246,28 +1247,24 @@ public class DoorOrderController extends BaseController {
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
//获取相对路径
|
|
|
String pathName = DoorOrderController.class.getResource("/").getPath().replaceFirst("/", "");
|
|
|
pathName = pathName.replace("target/classes/", "src/main/resources/conclusion.mht");
|
|
|
// String pathName = DoorOrderController.class.getResource("/").getPath().replaceFirst("/", "");
|
|
|
// pathName = pathName.replace("target/classes/", "src/main/resources/conclusion.mht");
|
|
|
// Document doc = Jsoup.parse(new File(pathName), "UTF-8");
|
|
|
|
|
|
String txt = "";
|
|
|
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
|
|
Resource[] resources = resolver.getResources("/conclusion.mht");
|
|
|
Resource resource = resources[0];
|
|
|
//获得文件流,因为在jar文件中,不能直接通过文件资源路径拿到文件,但是可以在jar包中拿到文件流
|
|
|
InputStream stream = resource.getInputStream();
|
|
|
StringBuilder buffer = new StringBuilder();
|
|
|
byte[] bytes = new byte[1024];
|
|
|
try {
|
|
|
for (int n; (n = stream.read(bytes)) != -1; ) {
|
|
|
buffer.append(new String(bytes, 0, n));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
txt = buffer.toString();
|
|
|
System.out.println("txt ===== " + txt);
|
|
|
Document aa = Jsoup.parse(txt,"UTF-8");
|
|
|
// String txt = StreamUtil.readResources();
|
|
|
// ByteArrayInputStream ins = new ByteArrayInputStream(txt.getBytes());
|
|
|
// File file = new File("conclusion.mht");
|
|
|
// OutputStream os1 = new FileOutputStream(file);
|
|
|
// int bytesRead = 0;
|
|
|
// byte[] buffer1 = new byte[8192];
|
|
|
// while ((bytesRead = ins.read(buffer1, 0, 8192)) != -1) {
|
|
|
// os1.write(buffer1, 0, bytesRead);
|
|
|
// }
|
|
|
// os1.close();
|
|
|
// ins.close();
|
|
|
// Document aa = Jsoup.parse(file,"UTF-8");
|
|
|
|
|
|
Document aa = Jsoup.parse(StreamUtil.readResources());
|
|
|
String html = doorOrderService.handleData(aa,orderId);
|
|
|
byte b[] = html.getBytes();
|
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(b);
|