费用清单上传

master
hcy 2 years ago
parent eea3a023a8
commit 500a87a77e

@ -241,6 +241,33 @@
<artifactId>imageio-tiff</artifactId> <artifactId>imageio-tiff</artifactId>
<version>3.6</version> <version>3.6</version>
</dependency> </dependency>
<!-- 反向自动生成 -->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<!-- 导入zip解压包 -->
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>0.7</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -267,6 +294,24 @@
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
<!--反向自动生成实体类-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<configuration>
<!--配置文件的路径-->
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
</dependencies>
</plugin>
</plugins> </plugins>
</build> </build>

@ -52,4 +52,34 @@ public class ExportExcelController {
} }
} }
} }
@RequestMapping(value="exportWrongExcel1")
public void exportWrongExcel1(String workBookKey,String fileName, HttpServletResponse response){
OutputStream os = null;
if(StringUtils.isNoneBlank(fileName)){
//文件名
fileName = fileName+"上传出错数据列表.xls";
try {
//导出excel的操作
Workbook workbook = ImportExcelUtil.getWorkBookMapByKey(workBookKey);
os = response.getOutputStream();
response.reset();
response.setContentType("application/OCTET-STREAM;charset=gbk");
response.setHeader("pragma", "no-cache");
fileName = new String(fileName.getBytes("utf-8"), "iso-8859-1");
response.setHeader("Content-disposition", "attachment;filename=\"" + fileName + "\"");
workbook.write(os);
}catch (Exception e){
e.printStackTrace();
}finally {
if(os != null){
try {
os.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}
} }

@ -1301,4 +1301,15 @@ public class CommomSearchController {
} }
return result.toString(); return result.toString();
} }
/**
*
*/
@RequiresPermissions("/commom/uploadCostList")
@RequestMapping("/uploadCostList")
@ResponseBody
public ResultUtil uploadCost(HttpServletRequest request) {
return commomService.uploadCost(request);
}
} }

@ -142,4 +142,12 @@ public interface CommomMapper {
String getPatientIdByInpNoAndVisitId(@Param("inpNo")String inpNo,@Param("visitId")String visitId); String getPatientIdByInpNoAndVisitId(@Param("inpNo")String inpNo,@Param("visitId")String visitId);
/**
*commomtable
* @param inpatientNo
* @param disDate
* @return
*/
CommomVo getCommomTableList(@Param("inpatientNo") String inpatientNo, @Param("disDate") String disDate);
} }

@ -41,4 +41,11 @@ public interface Zd_AssortMapper {
* id * id
* */ * */
List<Zd_Assort> selectAllAndUserReaderByUserIdAndRoleId(@Param("userId") Integer userId,@Param("roleId") Integer roleId); List<Zd_Assort> selectAllAndUserReaderByUserIdAndRoleId(@Param("userId") Integer userId,@Param("roleId") Integer roleId);
/**
*
* @param assortName
* @return
*/
Zd_Assort getZdAssortByName(@Param("assortName") String assortName);
} }

@ -4,18 +4,26 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.emr.dao.Archive_DetailMapper; import com.emr.dao.Archive_DetailMapper;
import com.emr.dao.CommomMapper; import com.emr.dao.CommomMapper;
import com.emr.dao.Zd_AssortMapper;
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper; import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
import com.emr.entity.EmrComomSet; import com.emr.entity.EmrComomSet;
import com.emr.entity.Power_User; import com.emr.entity.Power_User;
import com.emr.entity.ResultUtil; import com.emr.entity.ResultUtil;
import com.emr.entity.Zd_Assort;
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet; import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
import com.emr.entity.tScanAssort.T_Scan_Assort; import com.emr.entity.tScanAssort.T_Scan_Assort;
import com.emr.service.ImportExcel.ImportExcelEntity;
import com.emr.service.ImportExcel.ImportExcelUtil;
import com.emr.service.tScanAssort.T_Scan_AssortService; import com.emr.service.tScanAssort.T_Scan_AssortService;
import com.emr.util.Jpg2PdfUtil; import com.emr.util.Jpg2PdfUtil;
import com.emr.util.Pdf2ImgUtil;
import com.emr.util.UploadUtil;
import com.emr.util.img2PdfUtil; import com.emr.util.img2PdfUtil;
import com.emr.vo.ExportInpVo;
import com.emr.vo.User; import com.emr.vo.User;
import com.emr.vo.commomSearch.CommomTree; import com.emr.vo.commomSearch.CommomTree;
import com.emr.vo.commomSearch.CommomVo; import com.emr.vo.commomSearch.CommomVo;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -28,9 +36,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -69,6 +79,10 @@ public class CommomService {
private String EMRRECORDJSP; private String EMRRECORDJSP;
@Value("${waterTifToJpgPath}") @Value("${waterTifToJpgPath}")
private String WATERTIFTOJPGPATH; private String WATERTIFTOJPGPATH;
@Value("${cost_pdf_path}")
private String costPdfPath;
@Autowired @Autowired
private CommomMapper commomMapper; private CommomMapper commomMapper;
@Autowired @Autowired
@ -79,6 +93,10 @@ public class CommomService {
private EmrPdfWaterSetMapper pdfWaterSetMapper; private EmrPdfWaterSetMapper pdfWaterSetMapper;
@Autowired @Autowired
private Archive_DetailMapper archiveDetailMapper; private Archive_DetailMapper archiveDetailMapper;
@Autowired
private Zd_AssortMapper zd_assortMapper;
public static final Map<String, Object> CACHE_MAP = new ConcurrentHashMap<>(); public static final Map<String, Object> CACHE_MAP = new ConcurrentHashMap<>();
//获取所属医院用户名集合 //获取所属医院用户名集合
@ -633,8 +651,8 @@ public class CommomService {
//定义输出地址 //定义输出地址
String outSrc = ""; String outSrc = "";
//获取项目上下文地址 //获取项目上下文地址
if ((printEffective != null && printEffective == 1 ) || if ((printEffective != null && printEffective == 1) ||
(printIsImg != null && printIsImg == 1) ) { (printIsImg != null && printIsImg == 1)) {
if ("99".equals(sourceList[i])) { if ("99".equals(sourceList[i])) {
String rootSrcPath = selectRootByNotWater(srcPath); String rootSrcPath = selectRootByNotWater(srcPath);
String str2 = srcPath.substring(0, srcPath.indexOf(File.separator)); String str2 = srcPath.substring(0, srcPath.indexOf(File.separator));
@ -981,4 +999,115 @@ public class CommomService {
} }
} }
} }
/**
*
*
* @param request
* @return
*/
public ResultUtil uploadCost(HttpServletRequest request) {
//读取文件
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) (request);
MultipartFile multipartFile = multiRequest.getFile("upfile");
if (multipartFile == null) {
return ResultUtil.error("上传文件不能为空");
}
try {
//解析压缩包文件上传并解压返回存放pdf的全路径
String saveFileName = UploadUtil.resolveCompressUploadFile(request, multipartFile, costPdfPath);
//获取pdf文件名
List<String> pdfNameList = Pdf2ImgUtil.getPdfName(saveFileName);
//导出失败病案号,出院日期数组
List<ExportInpVo> exportInpVoList = new ArrayList<>();
//定义导出异常病案号,出院日期实体对象
ExportInpVo exportInpVo = null;
if (pdfNameList != null && pdfNameList.size() > 0) {
//病案号
String inpatientNo = "";
//出院日期
String disDate = "";
for (int i = 0; i < pdfNameList.size(); i++) {
String pdfName = pdfNameList.get(i);
if (pdfName.contains("_")) {
inpatientNo = pdfName.substring(0, pdfName.indexOf("_"));
disDate = pdfName.substring(pdfName.lastIndexOf("_") + 1);
}
if (pdfName.contains("-")) {
inpatientNo = pdfName.substring(0, pdfName.indexOf("-"));
disDate = pdfName.substring(pdfName.lastIndexOf("-") + 1);
}
//病案号转为数值型
//inpatientNo =String.valueOf(Long.parseLong(inpatientNo));
//格式化日期
String disDateStr = disDate.substring(0, 4) + "-" + disDate.substring(4, 6) + "-" + disDate.substring(6, 8);
CommomVo commomVo = commomMapper.getCommomTableList(inpatientNo, disDateStr);
if (ObjectUtils.isEmpty(commomVo)) {
exportInpVo = new ExportInpVo();
exportInpVo.setInpatientNo(inpatientNo);
exportInpVo.setDisDate(disDateStr);
exportInpVoList.add(exportInpVo);
continue;
}
if (commomVo != null && StringUtils.isNotBlank(commomVo.getFilePath())) {
File filePath = new File(commomVo.getFilePath());
if (!filePath.exists()) {
filePath.mkdirs();
}
//pdf转jpg图片生成到指定路徑
List<String> picNameList = Pdf2ImgUtil.pdfToPic(saveFileName, pdfName, "jpg", commomVo.getFilePath());
if (picNameList != null && picNameList.size() > 0) {
Zd_Assort zd_assort = zd_assortMapper.getZdAssortByName("费用");
List<T_Scan_Assort> insertList = new ArrayList<>();
T_Scan_Assort t_scan_assort = null;
for (int k = 0; k < picNameList.size(); k++) {
t_scan_assort = new T_Scan_Assort();
t_scan_assort.setPatientId(commomVo.getPatientId());
t_scan_assort.setAssortId(zd_assort.getAssortId());
t_scan_assort.setScanPage(picNameList.get(k));
t_scan_assort.setIsDel((short) 0);
t_scan_assort.setSource((short) 1);
insertList.add(t_scan_assort);
}
//批量新增图片记录
scanAssortService.SimpleInsert(insertList);
}
}
}
ImportExcelEntity excelEntity = null;
if (exportInpVoList != null && exportInpVoList.size() > 0) {
//创建生成excel
excelEntity = ImportExcelUtil.getExcle(exportInpVoList);
}
FileUtils.deleteDirectory(new File(saveFileName));
return ResultUtil.ok(excelEntity);
} else {
//FileUtils.deleteDirectory(new File(saveFileName));
return ResultUtil.error("pdf文件不存在");
}
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("费用清单上传失败");
}
}
} }

@ -1,10 +1,9 @@
package com.emr.service.ImportExcel; package com.emr.service.ImportExcel;
import com.emr.util.UUIDUtils; import com.emr.util.UUIDUtils;
import com.emr.vo.ExportInpVo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
@ -496,4 +495,52 @@ public class ImportExcelUtil {
} }
return null; return null;
} }
public static ImportExcelEntity getExcle(List<ExportInpVo> exportInpVoList) throws Exception {
//1.创建HSSFWorkbook 对象
HSSFWorkbook wb = new HSSFWorkbook();
// 2.在workbook中添加一个sheet对应Excel中的一个sheet
HSSFSheet sheet = wb.createSheet("费用清单");
// 3.在sheet中添加表头第0行老版本poi对excel行数列数有限制short
HSSFRow row = sheet.createRow((int) 0);
// 4.创建单元格,设置值表头,设置表头居中
HSSFCellStyle style = wb.createCellStyle();
// 居中格式
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//设置颜色
Font font = wb.createFont();
font.setColor(HSSFColor.RED.index);
style.setFont(font);
// 5. 设置表头
HSSFCell cell = row.createCell(0);
cell.setCellValue("病案号");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue("出院日期");
cell.setCellStyle(style);
// 6.设置excle内容
for (int i = 0; i < exportInpVoList.size(); i++) {
row = sheet.createRow((int) i + 1);
ExportInpVo exportInpVo = exportInpVoList.get(i);
// 创建单元格,设置值
row.createCell(0).setCellValue(exportInpVo.getInpatientNo());
row.createCell(1).setCellValue(exportInpVo.getDisDate());
}
String workBookKey = UUIDUtils.getUUID();
workBookMap.put(workBookKey, wb);
ImportExcelEntity excelEntity = new ImportExcelEntity();
excelEntity.setWorkBookKey(workBookKey);
return excelEntity;
}
} }

@ -0,0 +1,123 @@
package com.emr.util;
import com.github.junrar.Archive;
import com.github.junrar.rarfile.FileHeader;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
*
*/
public class CompressFileUtils {
/**
*
*
* @param zipPath
* @param descDir
* @author
*/
public static void unZipFiles(String zipPath, String descDir) throws IOException {
unZipFiles(new File(zipPath), descDir);
}
/**
*
*
* @param zipFile
* @param descDir
* @author isea533
*/
@SuppressWarnings("rawtypes")
public static void unZipFiles(File zipFile, String descDir) throws IOException {
File pathFile = new File(descDir);
if (!pathFile.exists()) {
pathFile.mkdirs();
}
ZipFile zip = new ZipFile(zipFile,Charset.forName("GBK"));
for (Enumeration entries = zip.entries(); entries.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) entries.nextElement();
String zipEntryName = entry.getName();
InputStream in = zip.getInputStream(entry);
String outPath = (descDir + zipEntryName).replaceAll("\\*", "/");
;
//判断路径是否存在,不存在则创建文件路径
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
if (!file.exists()) {
file.mkdirs();
}
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
if (new File(outPath).isDirectory()) {
continue;
}
//输出文件路径信息
System.out.println(outPath);
OutputStream out = new FileOutputStream(outPath);
byte[] buf1 = new byte[1024];
int len;
while ((len = in.read(buf1)) > 0) {
out.write(buf1, 0, len);
}
in.close();
out.close();
}
System.out.println("******************解压完毕********************");
}
/**
* rar.
*
* @param srcRarPath rar
* @param dstDirectoryPath
*/
public static void unRarFile(String srcRarPath, String dstDirectoryPath) {
if (!srcRarPath.toLowerCase().endsWith(".rar")) {
System.out.println("非rar文件");
return;
}
File dstDiretory = new File(dstDirectoryPath);
if (!dstDiretory.exists()) {// 目标目录不存在时,创建该文件夹
dstDiretory.mkdirs();
}
Archive a = null;
try {
a = new Archive(new File(srcRarPath));
if (a != null) {
a.getMainHeader().print(); // 打印文件信息.
FileHeader fh = a.nextFileHeader();
while (fh != null) {
if (fh.isDirectory()) { // 文件夹
File fol = new File(dstDirectoryPath + File.separator
+ fh.getFileNameString());
fol.mkdirs();
} else { // 文件
File out = new File(dstDirectoryPath + File.separator
+ fh.getFileNameString().trim());
//System.out.println(out.getAbsolutePath());
try {// 之所以这么写try是因为万一这里面有了异常不影响继续解压.
if (!out.exists()) {
if (!out.getParentFile().exists()) {// 相对路径可能多级,可能需要创建父目录.
out.getParentFile().mkdirs();
}
out.createNewFile();
}
FileOutputStream os = new FileOutputStream(out);
a.extractFile(fh, os);
os.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
fh = a.nextFileHeader();
}
a.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,151 @@
package com.emr.util;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Pdf2ImgUtil {
/**
* 使pdfboxpdf
*
* @param fileAddress :C:\\Users\\user\\Desktop\\test
* @param filename PDF
* @param type png jpg
* @param picPath
* @return List<String>
*/
public static List<String> pdfToPic(String fileAddress, String filename, String type, String picPath) throws IOException {
//long startTime = System.currentTimeMillis();
// 将文件地址和文件名拼接成路径 注意:线上环境不能使用\\拼接
File file = new File(fileAddress + "\\" + filename + ".pdf");
List<String> picNameList = new ArrayList<>();
PDDocument doc = null;
try {
// 写入文件
doc = PDDocument.load(file);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
for (int i = 0; i < pageCount; i++) {
// dpi为144越高越清晰转换越慢
BufferedImage image = renderer.renderImageWithDPI(i, 150); // Windows native DPI
// 将图片写出到该路径下
ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + (i + 1) + "." + type));
picNameList.add("FY_" + filename + "_" + (i + 1) + "." + type);
}
//long endTime = System.currentTimeMillis();
//System.out.println("共耗时:" + ((endTime - startTime) / 1000.0) + "秒"); //转化用时
return picNameList;
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
if (doc != null) {
doc.close();
}
}
}
public static void main(String[] args) {
//pdf2png("D://cost///467f76bec51b4853b640609b0b8feb35/", "35923-20180918", "jpg");
//File file = new File("D://cost///467f76bec51b4853b640609b0b8feb35/");
//File file1 = new File("C:\\Users\\user\\Desktop\\test//");
//System.out.println(file);
//System.out.println(file1);
/*File folder = new File("D://cost///e8554937829b4624b20c89b427bae411/");
File[] files = folder.listFiles(); // 获取路径下的所有文件和文件夹
if (files != null) {
for (File file : files) {
if (file.isFile()) {
System.out.println(file.getName()); // 输出文件名
}
}
}*/
/*String extension = ".pdf"; // 设置你想要的文件后缀
File folder = new File("D://cost///467f76bec51b4853b640609b0b8feb35/");
String[] files = folder.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(extension);
}
});
if (files != null) {
for (String file : files) {
System.out.println(file.substring(0, file.lastIndexOf(".")));
}
}*/
//String pathName="\\\\192.168.2.22\\d\\厦门仙岳1期图像\\22盘\\01930\\35923-20180918-64efbec3f1e84472b013dd8f5383d448";
//File file = new File("\\192.168.2.22\d\\厦门仙岳1期图像\\22盘\\01930\\35923-20180918-64efbec3f1e84472b013dd8f5383d448")
/*List<String> fileNameList = new ArrayList<>();
String extension = ".pdf"; // 设置你想要的文件后缀
File folder = new File("D://cost///467f76bec51b4853b640609b0b8feb35/");
String[] files = folder.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(extension);
}
});
if (files != null) {
for (String file : files) {
String fileName = file.substring(0, file.lastIndexOf("."));
fileNameList.add(fileName);
}
}
System.out.println(fileNameList);*/
/*String disDateStr ="2018-09-18";
String disDateStr1 = disDateStr.substring(0, 4) + disDateStr.substring(5, 7) + disDateStr.substring(8, 10);
System.out.println(disDateStr1);*/
}
/**
* pdf
*
* @param pathName pdf
* @return
*/
public static List<String> getPdfName(String pathName) {
List<String> fileNameList = new ArrayList<>();
String extension = ".pdf"; // 设置你想要的文件后缀
File folder = new File(pathName);
String[] files = folder.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(extension);
}
});
if (files != null) {
String fileName = "";
for (String file : files) {
fileName = file.substring(0, file.lastIndexOf("."));
fileNameList.add(fileName);
}
}
return fileNameList;
}
}

@ -0,0 +1,89 @@
package com.emr.util;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
@Component
public class UploadUtil {
/**
*
*
* @param request
* @param file
* @return
* @throws Exception
*/
public static String resolveCompressUploadFile(HttpServletRequest request, MultipartFile file, String path) throws Exception {
/* 截取后缀名 */
if (file.isEmpty()) {
return "文件不能为空";
}
String fileName = file.getOriginalFilename();
int pos = fileName.lastIndexOf(".");
String extName = fileName.substring(pos + 1).toLowerCase();
//判断上传文件必须是zip或者是rar否则不允许上传
if (!extName.equals("zip") && !extName.equals("rar")) {
throw new Exception("上传文件格式错误,请重新上传");
}
// 时间加后缀名保存
//SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd");
//String format = dateFormat.format (new Date());
String saveName = UUIDUtils.getUUID() + "." + extName; //353fdsfdfsdfdsf7887878.zip
//文件名
String saveFileName = saveName.substring(0, saveName.lastIndexOf("."));//353fdsfdfsdfdsf7887878
// 根据服务器的文件保存地址和原文件名创建目录文件全路径
//设置上传文件夹的真实路径
//String realPath = request.getSession().getServletContext().getRealPath("/upfile");
File pushFile = new File(path + "/" + saveFileName + "/" + saveName);//存放压缩包文件的路径下的压缩文件
File descFile = new File(path + "/" + saveFileName);//存放压缩包文件的路径
if (!descFile.exists()) {
descFile.mkdirs();
}
//解压目的文件
String descDir = path + "/" + saveFileName + "/";
file.transferTo(pushFile);
//开始解压zip
if (extName.equals("zip")) {
CompressFileUtils.unZipFiles(pushFile, descDir);
} else if (extName.equals("rar")) {
//开始解压rar
CompressFileUtils.unRarFile(pushFile.getAbsolutePath(), descDir);
} else {
throw new Exception("文件格式不正确不能解压");
}
return descDir;
}
/**
* MultipartFile
*
* @param strPath
* @return
*/
/*public static List<MultipartFile> getMultipartFileListByPath(String strPath) throws IOException {
File dir = new File(strPath);
File[] files = dir.listFiles(); // 该文件目录下文件全部放入数组
List<MultipartFile> multipartFiles = new ArrayList<>();
if (files != null) {
for (File file : files) {
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), "text/plain", input);
multipartFiles.add(multipartFile);
input.close();
}
}
return multipartFiles;
}*/
}

@ -1336,4 +1336,12 @@
</set> </set>
where patient_id = #{patientId} where patient_id = #{patientId}
</update> </update>
<select id="getCommomTableList" resultType="com.emr.vo.commomSearch.CommomVo">
select * from commomtable c
where 1 = 1
and c.inpatient_no= #{inpatientNo}
AND CONVERT ( VARCHAR ( 100 ), c.dis_date, 23 ) = #{disDate}
</select>
</mapper> </mapper>

@ -156,4 +156,7 @@
<select id="selectEmrType" resultType="com.emr.entity.recordType.Emr_Type"> <select id="selectEmrType" resultType="com.emr.entity.recordType.Emr_Type">
select * from emr_type select * from emr_type
</select> </select>
<select id="getZdAssortByName" resultType="com.emr.entity.Zd_Assort">
select * from zd_assort t where t.assort_name like '%${assortName}%'
</select>
</mapper> </mapper>

@ -50,6 +50,7 @@
$("#form1").attr('disabled', 'disabled'); $("#form1").attr('disabled', 'disabled');
$('#loadingModel').modal('show'); $('#loadingModel').modal('show');
$("#loading").css("background", "url(" + path + "/static/img/load.gif) no-repeat 10px 50%"); $("#loading").css("background", "url(" + path + "/static/img/load.gif) no-repeat 10px 50%");
$('#myModal3').modal('hide');
$('#form1').ajaxSubmit({ $('#form1').ajaxSubmit({
type: 'POST', type: 'POST',
url: path + '/commom/uploadCostList', url: path + '/commom/uploadCostList',
@ -60,19 +61,16 @@
toastr.warning("上传文件出错!") toastr.warning("上传文件出错!")
}, },
success: function (data) { success: function (data) {
$('#loadingModel').modal('hide'); $('#loadingModel').modal('hide');
var dataObj = eval("(" + data + ")"); var dataObj = eval("(" + data + ")");
if (dataObj.code == 0) { if (dataObj.code == 0) {
var dataExcel = dataObj.data; var dataExcel = dataObj.data;
toastr.success("费用清单上传成功"); toastr.success("费用清单上传成功");
if (dataExcel.workBookKey != null && dataExcel.workBookKey != '') { if (dataExcel != null && dataExcel.workBookKey != null && dataExcel.workBookKey != '') {
var exportFileName = "费用清单"; var exportFileName = "费用清单";
window.location.href = path + "/exportWrongExcel1?fileName=" + exportFileName + "&workBookKey=" + dataExcel.workBookKey; window.location.href = path + "/exportWrongExcel1?fileName=" + exportFileName + "&workBookKey=" + dataExcel.workBookKey;
} else {
setTimeout(function () {
window.location.reload();
}, 1000)
} }
} else { } else {
toastr.error("费用清单上传失败"); toastr.error("费用清单上传失败");
@ -80,6 +78,7 @@
$("#upfile").val(""); $("#upfile").val("");
$("#form1").removeAttr('disabled'); $("#form1").removeAttr('disabled');
} }
}); });
} }

@ -4,6 +4,7 @@
<c:set var="path" value="${pageContext.request.contextPath}"/> <c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/common.jspf" %> <%@ include file="/WEB-INF/jspf/common.jspf" %>
<%@ include file="/WEB-INF/jspf/boostrapSelect.jspf" %> <%@ include file="/WEB-INF/jspf/boostrapSelect.jspf" %>
<%@ include file="/WEB-INF/jspf/importPackageJsp.jspf" %>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -105,7 +106,17 @@
background-color: #199ED8; background-color: #199ED8;
text-align: center; text-align: center;
} }
.control-label1{
width:30%;
text-align: right;
padding-top:2px;
font-weight: 700;
}
.modelBtns{
/*text-align: center;*/
margin-left: 40%;
}
/*搜索按钮div*/ /*搜索按钮div*/
.searchDiv { .searchDiv {
margin-left: 33px; margin-left: 33px;
@ -638,6 +649,11 @@
<div class="btn"> <div class="btn">
<button type="button" class="btn btn-sm btn-default" onclick="clearForm()">&nbsp;&nbsp;清&nbsp;&nbsp;空&nbsp;&nbsp;</button> <button type="button" class="btn btn-sm btn-default" onclick="clearForm()">&nbsp;&nbsp;清&nbsp;&nbsp;空&nbsp;&nbsp;</button>
</div> </div>
<shiro:hasPermission name="/commom/uploadCostList">
<div class="btn">
<button type="button" class="btn btn-sm btn-success" onclick="uploadBtn()">费用清单上传</button>
</div>
</shiro:hasPermission>
<shiro:hasPermission name="/commom/exportExcel"> <shiro:hasPermission name="/commom/exportExcel">
<div class="btn"> <div class="btn">
<button type="button" class="btn btn-sm btn-success" onclick="exportExcel()">导出excel</button> <button type="button" class="btn btn-sm btn-success" onclick="exportExcel()">导出excel</button>
@ -855,6 +871,38 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 模态框Modal1 导入-->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel3">导入信息</h4>
</div>
<div class="modal-body" style="height:380px">
<form method="POST" enctype="multipart/form-data"
id="form1">
<div class="formDiv">
<label class="control-label1 left">选择文件:</label>
<input id="upfile" type="file" name="upfile" calss="layui-btn">
</div>
<div class="modelBtns">
<input class="btn btn-primary btn-sm" type="button" value="文件上传"
onclick="uploadCostList()">
</div>
<%--<div class="formDiv">
<label class="warningLabel">友情提醒:</label>
<div class="warningDiv">
<span style="color: red"></br>1、病案号不能为空,不能重复,内容最多30个字</span></br>
<span style="color: red">2、出院日期不能为空</span></br>
</div>
</div>--%>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</div> </div>
<script> <script>
$(function () { $(function () {

@ -145,37 +145,6 @@ function refreshTable() {
} }
/**
* 显示申请信息详情
* @param id
*/
function showApprove(id) {
loadSelect(path + '/approve/loadType', null, 'applyType1');
//加载申请原因模板
loadSelect(path + '/approve/loadReasonModle', null, 'parentId1');
$.ajax({
type: 'get',
url: path + '/approve/getApproveById',
data: {id: id},
dataType: 'json',
success: function (data) {
if (null != data) {
$("#approveId1").val(data.id);
$("#effeTime1").val(data.effeTime);
$("#effeDays1").val(data.effeDays);
$("#applyType1").val(data.applyType);
$("#parentId1").val(data.reasonParentId);
$("#applyReason1").val(data.applyReason);
$("#inpatientNo1").val(data.inpatientNo);
$("#admissTimes1").val(data.admissTimes);
$("#name1").val(data.name);
$("#startTime3").val(data.disTime);
}
}
})
}
/** /**
* 导出excel功能 * 导出excel功能
*/ */

Loading…
Cancel
Save