|
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.RxDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dicts.SiFunction;
|
|
|
+import thyyxxk.simzfeeoprnsystm.pojo.CodeName;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.ResultVo;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.digitalreceipt.*;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.digitalreceipt.request.*;
|
|
@@ -23,10 +24,8 @@ import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.nio.file.Files;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Base64;
|
|
|
+import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -126,6 +125,8 @@ public class DigitalReceiptService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
|
|
|
+ CodeName phar = rxDao.getDocYbCode(request.getStaffId());
|
|
|
+
|
|
|
JSONObject decryptResult = HseEncAndDecUtil.decryptMsg(result);
|
|
|
RxUpload rxUpload = new RxUpload();
|
|
|
rxUpload.setHiRxno(decryptResult.getString("hiRxno"));
|
|
@@ -137,8 +138,15 @@ public class DigitalReceiptService {
|
|
|
rxUpload.setCertno(request.getRxMdtrtinfo().getCertno());
|
|
|
rxUpload.setDrCode(request.getRxMdtrtinfo().getDrCode());
|
|
|
rxUpload.setPrscDrName(request.getRxMdtrtinfo().getPrscDrName());
|
|
|
+ rxUpload.setPharDeptCode(request.getRxMdtrtinfo().getPrscDeptCode());
|
|
|
+ rxUpload.setPharDeptName(request.getRxMdtrtinfo().getPrscDeptName());
|
|
|
+ rxUpload.setPharCode(phar.getYbCode());
|
|
|
+ rxUpload.setPharName(phar.getName());
|
|
|
rxUpload.setRxFile(createRxPdf(request));
|
|
|
- rxDao.insertRxPrecheck(rxUpload);
|
|
|
+ rxUpload.setPharChkTime(new Date());
|
|
|
+ int d = rxDao.deleteOldRxPreCheck(request.getHospRxno());
|
|
|
+ int i = rxDao.insertRxPrecheck(rxUpload);
|
|
|
+ log.info("电子处方预核验入库:删除:{},新增:{}", d, i);
|
|
|
deleteRxPdfFile(request);
|
|
|
return ResultVoUtil.success(decryptResult);
|
|
|
}
|
|
@@ -237,7 +245,7 @@ public class DigitalReceiptService {
|
|
|
return ResultVoUtil.success(HseEncAndDecUtil.decryptMsg(result));
|
|
|
}
|
|
|
|
|
|
- private String createRxPdf(RxPreCheckRequest request) throws Exception {
|
|
|
+ public String createRxPdf(RxPreCheckRequest request) throws Exception {
|
|
|
String pdfFilePath = Global.FILE_PATH + request.getHospRxno() + ".pdf";
|
|
|
File pdfFile = new File(pdfFilePath);
|
|
|
if (pdfFile.exists()) {
|
|
@@ -369,26 +377,29 @@ public class DigitalReceiptService {
|
|
|
}
|
|
|
|
|
|
private PdfPTable getReceiptTable(BaseFont baseFont, List<RxDrugDetail> drugList) {
|
|
|
- Font smallFont = new Font(baseFont, 10, Font.NORMAL);
|
|
|
- PdfPTable table = new PdfPTable(3);
|
|
|
+ Font smallFont = new Font(baseFont, 9, Font.NORMAL);
|
|
|
+ PdfPTable table = new PdfPTable(4);
|
|
|
table.setWidthPercentage(100);
|
|
|
|
|
|
for (RxDrugDetail item : drugList) {
|
|
|
String drugName = item.getDrugGenname() + "(" + item.getDrugSpec() + ")";
|
|
|
|
|
|
- PdfPCell chargeCell = new PdfPCell(new Phrase(drugName, smallFont));
|
|
|
- chargeCell.setBorder(-1);
|
|
|
+ PdfPCell drugNameCell = new PdfPCell(new Phrase(drugName, smallFont));
|
|
|
+ drugNameCell.setBorder(-1);
|
|
|
|
|
|
- String usedWay = item.getSinDoscnt() + item.getSinDosunt() + "/次 + " +
|
|
|
- item.getUsedFrquName() + " " + item.getMedcWayDscr();
|
|
|
+ String usedWay = "用法:" + item.getMedcWayDscr() + "(" + item.getSinDoscnt() + item.getSinDosunt() + "/次)" ;
|
|
|
+ PdfPCell usedWayCell = new PdfPCell(new Phrase(usedWay, smallFont));
|
|
|
+ usedWayCell.setBorder(-1);
|
|
|
|
|
|
- PdfPCell freqCell = new PdfPCell(new Phrase("用法:" + usedWay, smallFont));
|
|
|
+ String freq = "频率:" + item.getUsedFrquName();
|
|
|
+ PdfPCell freqCell = new PdfPCell(new Phrase(freq, smallFont));
|
|
|
freqCell.setBorder(-1);
|
|
|
|
|
|
- PdfPCell amountCell = new PdfPCell(new Phrase("× " + item.getDrugCnt() + item.getDrugTotlcntEmp(), smallFont));
|
|
|
+ PdfPCell amountCell = new PdfPCell(new Phrase("× " + item.getDrugCnt() + item.getDrugDosunt(), smallFont));
|
|
|
amountCell.setBorder(-1);
|
|
|
|
|
|
- table.addCell(chargeCell);
|
|
|
+ table.addCell(drugNameCell);
|
|
|
+ table.addCell(usedWayCell);
|
|
|
table.addCell(freqCell);
|
|
|
table.addCell(amountCell);
|
|
|
}
|
|
@@ -398,15 +409,14 @@ public class DigitalReceiptService {
|
|
|
|
|
|
private PdfPTable getFooter(BaseFont baseFont, RxMdtrtInfo mdtrt) throws Exception {
|
|
|
Font smallFont = new Font(baseFont, 10, Font.NORMAL);
|
|
|
- String drInfo = "开方医师:" + mdtrt.getPrscDrName();
|
|
|
PdfPTable table = new PdfPTable(2);
|
|
|
table.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
table.setWidthPercentage(30);
|
|
|
- PdfPCell nameCell = new PdfPCell(new Phrase(drInfo, smallFont));
|
|
|
+ PdfPCell nameCell = new PdfPCell(new Phrase("开方医师:", smallFont));
|
|
|
nameCell.setBorder(-1);
|
|
|
PdfPCell signCell = new PdfPCell();
|
|
|
signCell.setBorder(-1);
|
|
|
- signCell.setImage(getDoctorSign());
|
|
|
+ signCell.setImage(getDoctorSign(mdtrt.getDrCode()));
|
|
|
table.addCell(nameCell);
|
|
|
table.addCell(signCell);
|
|
|
return table;
|
|
@@ -419,8 +429,9 @@ public class DigitalReceiptService {
|
|
|
return stamp;
|
|
|
}
|
|
|
|
|
|
- private Image getDoctorSign() throws BadElementException, IOException {
|
|
|
- Image stamp = Image.getInstance("http://webhis.thyy.cn:8080/doctorSignatureImage/02521.png");
|
|
|
+ private Image getDoctorSign(String ybCode) throws BadElementException, IOException {
|
|
|
+ String hisCode = rxDao.getDoctorHisCode(ybCode);
|
|
|
+ Image stamp = Image.getInstance("http://webhis.thyy.cn:8080/doctorSignatureImage/" + hisCode + ".png");
|
|
|
stamp.scalePercent(35);
|
|
|
return stamp;
|
|
|
}
|