|
|
|
|
@ -15,6 +15,7 @@ import com.emr.util.Jpg2PdfUtil;
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.util.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@ -37,7 +38,41 @@ public class Archive_DetailServiceImpl implements Archive_DetailService {
|
|
|
|
|
public OffsetLimitPage detailByClo(Archive_Detail_Vo record, Integer offset, Integer limit) {
|
|
|
|
|
PageHelper.offsetPage(offset, limit);
|
|
|
|
|
List<Archive_Detail_Vo> list = archiveDetailMapper.detailByClo(record);
|
|
|
|
|
return new OffsetLimitPage((Page) list);
|
|
|
|
|
OffsetLimitPage offsetLimitPage = new OffsetLimitPage((Page) list);
|
|
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
//定义新的集合。病程记录分类中的首次病程记录排前头
|
|
|
|
|
String strTemp = "首次病程";
|
|
|
|
|
String assortId = "AFB9FBE656D7492C80AEDE6E685A851A";
|
|
|
|
|
List<Archive_Detail_Vo> returnList = new Page<>();
|
|
|
|
|
//定义接收首次病程记录的对象
|
|
|
|
|
Archive_Detail_Vo detailVoTemp = new Archive_Detail_Vo();
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
if(list.get(i).getAssortId().equals(assortId) && list.get(i).getTitle().contains(strTemp)){
|
|
|
|
|
detailVoTemp = list.get(i);
|
|
|
|
|
list.remove(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(list)) {
|
|
|
|
|
//重新排序
|
|
|
|
|
//定义是否已添加首次病程
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
for (Archive_Detail_Vo detailVo : list) {
|
|
|
|
|
if (StringUtils.isNotBlank(detailVo.getAssortId()) && detailVo.getAssortId().equals(assortId) && !flag) {
|
|
|
|
|
returnList.add(detailVoTemp);
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
returnList.add(detailVo);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//只有首次病程记录的情况
|
|
|
|
|
returnList.add(detailVoTemp);
|
|
|
|
|
}
|
|
|
|
|
((Page<Archive_Detail_Vo>) returnList).setTotal(offsetLimitPage.getTotal());
|
|
|
|
|
return new OffsetLimitPage((Page) returnList);
|
|
|
|
|
}else{
|
|
|
|
|
return offsetLimitPage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -98,11 +133,35 @@ public class Archive_DetailServiceImpl implements Archive_DetailService {
|
|
|
|
|
public void mulFile2OneById(HttpServletResponse response, String pdfWater, List<Archive_Detail> arList) {
|
|
|
|
|
List<String> pdfList = new ArrayList<>();
|
|
|
|
|
if (arList != null && !arList.isEmpty()) {
|
|
|
|
|
for (Archive_Detail detail : arList) {
|
|
|
|
|
String str = detail.getPdfPath();
|
|
|
|
|
if (StringUtils.isNoneBlank(str)) {
|
|
|
|
|
pdfList.add(str);
|
|
|
|
|
//抽取首次病程记录
|
|
|
|
|
String strTemp = "首次病程";
|
|
|
|
|
String assortId = "AFB9FBE656D7492C80AEDE6E685A851A";
|
|
|
|
|
String strPath = "";
|
|
|
|
|
for (int i = 0; i < arList.size(); i++) {
|
|
|
|
|
String assortid = arList.get(i).getAssortid();
|
|
|
|
|
if(StringUtils.isNotBlank(assortid) && assortid.equals(assortId) && arList.get(i).getTitle().contains(strTemp)){
|
|
|
|
|
strPath = arList.get(i).getPdfPath();
|
|
|
|
|
arList.remove(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(arList)) {
|
|
|
|
|
//定义是否添加首次病程
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
for (Archive_Detail detail : arList) {
|
|
|
|
|
String str = detail.getPdfPath();
|
|
|
|
|
if (StringUtils.isNoneBlank(str)) {
|
|
|
|
|
//病程分类先添加首次病程
|
|
|
|
|
if (detail.getAssortid().equals(assortId) && !flag) {
|
|
|
|
|
pdfList.add(strPath);
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
pdfList.add(str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//只有首次病程记录的情况
|
|
|
|
|
pdfList.add(strPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Jpg2PdfUtil.mulFile2One(response, pdfList, pdfWater);
|
|
|
|
|
|