|
|
|
@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.system.domain.TImage;
|
|
|
|
|
import com.ruoyi.system.domain.TRecord;
|
|
|
|
@ -21,12 +22,16 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -48,6 +53,9 @@ public class TRecordController extends BaseController
|
|
|
|
|
@Resource
|
|
|
|
|
private ITImageService imageService;
|
|
|
|
|
|
|
|
|
|
@Value("${export.img.url}")
|
|
|
|
|
private String imgUrl;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询诊断记录信息列表
|
|
|
|
|
*/
|
|
|
|
@ -113,6 +121,44 @@ public class TRecordController extends BaseController
|
|
|
|
|
util.exportExcel(response, list, "诊断记录信息数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出诊断记录信息列表
|
|
|
|
|
*/
|
|
|
|
|
@Log(title = "诊断记录信息导出", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/exportImg")
|
|
|
|
|
public void exportImg(HttpServletResponse response, @RequestBody @Validated TRecordResultReq tRecord)
|
|
|
|
|
{
|
|
|
|
|
List<TImage> images = imageService.queryImagByExport(tRecord);
|
|
|
|
|
List<Map<String,Object>> exportInfo = new ArrayList<>();
|
|
|
|
|
if(CollectionUtils.isNotEmpty(images)){
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
images.forEach(image -> {
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
map.put("urlPath",imgUrl + image.getPath());
|
|
|
|
|
StringBuilder downloadPath = new StringBuilder();
|
|
|
|
|
downloadPath.append(image.getIdentifier());
|
|
|
|
|
downloadPath.append("_");
|
|
|
|
|
downloadPath.append(simpleDateFormat.format(image.getCreateTime()));
|
|
|
|
|
downloadPath.append("/");
|
|
|
|
|
if("sm_front".endsWith(image.getName())){
|
|
|
|
|
downloadPath.append("舌面原图.");
|
|
|
|
|
}else if("sx_front".endsWith(image.getName())){
|
|
|
|
|
downloadPath.append("舌下原图.");
|
|
|
|
|
}
|
|
|
|
|
downloadPath.append(StringUtils.substringAfterLast(image.getPath(), "."));
|
|
|
|
|
map.put("downloadPath",downloadPath.toString());
|
|
|
|
|
exportInfo.add(map);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
|
|
try {
|
|
|
|
|
FileUtils.setAttachmentResponseHeader(response, "舌面舌下图片下载");
|
|
|
|
|
FileUtils.urlResourceWriteBytes(exportInfo, response.getOutputStream());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取诊断记录信息详细信息
|
|
|
|
|
*/
|
|
|
|
|