Browse Source

初步诊断逻辑控制

hurugang 4 năm trước cách đây
mục cha
commit
46df6266bd

+ 48 - 37
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -138,6 +138,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     @SuppressWarnings("all")
     @Autowired
     private MzZdYpYshMapper mzZdYpYshMapper;
+
     @Override
     public int countMzChargeDetail(MzChargeDetailPageDto mzChargeDetailPageDto) {
         mzChargeDetailPageDto.setTableName("mz_charge_detail");
@@ -756,6 +757,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
     public int savePrescription(MzPrescriptionVo mzPrescriptionVo, Clinic dbClinic) throws MzException {
+        String realIcdText = null;
+        if (mzPrescriptionVo.getIcdText() != null) {
+            realIcdText = mzPrescriptionVo.getIcdText().replaceAll(",", "");
+            if (StringUtils.isBlank(realIcdText)) {
+                realIcdText = null;
+            }
+        }
+        if (realIcdText == null && (mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis() == null || StringUtils.isBlank(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis()))) {
+            throw new MzException("诊断和初步诊断不能同时为空!");
+        }
         setFullMzPrescriptionVo(mzPrescriptionVo, true);
         if (dbClinic != null && dbClinic.getId() != null && StringUtils.isNotBlank(dbClinic.getPatientId()) && dbClinic.getTimes() != null) {
             List<MzChargeDetail> dbMzChargeDetailList = mzChargeDetailMapper.selectNotPayMzChargeDetailByPatientId(mzPrescriptionVo.getPatientId(), dbClinic.getTimes());
@@ -833,8 +844,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         clinic.setDoctorCode(mzPrescriptionVo.getDoctorCode());
         clinic.setOpId(mzPrescriptionVo.getDoctorCode());
         clinic.setOpDay(new Date());
-        clinic.setIcdCode(mzPrescriptionVo.getIcdCode());
-        clinic.setIcdText(mzPrescriptionVo.getIcdText());
+        clinic.setIcdCode(realIcdText != null?mzPrescriptionVo.getIcdCode():null);
+        clinic.setIcdText(realIcdText != null?mzPrescriptionVo.getIcdText():mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
         clinic.setClinicStatus(ClinicStatusEnum.HAD_CLINIC.code);
         clinicMapper.insertClinic(clinic);
         return 1;
@@ -960,16 +971,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         int itemNo = 1;
         if (mzPrescriptionVo.getMzChargeDetailList() != null && mzPrescriptionVo.getMzChargeDetailList().size() > 0) {
             //处方类型
-            Map<Integer,String> orderNoMap = new HashMap<>();
+            Map<Integer, String> orderNoMap = new HashMap<>();
             //精一药品编码
-            Set<String> mjSet=null;
+            Set<String> mjSet = null;
             //精二药品编码
-            Set<String> jeSet=null;
-            if(needPatient){
-                List<MzZdYpYsh> mjList = mzZdYpYshMapper.selectMjyByCommonParams(null, null, null,null);
-                List<MzZdYpYsh> jeList = mzZdYpYshMapper.selectJeByCommonParams(null, null, null,null);
-                mjSet=mjList.stream().map(m->m.getCode()).collect(Collectors.toSet());
-                jeSet=jeList.stream().map(m->m.getCode()).collect(Collectors.toSet());
+            Set<String> jeSet = null;
+            if (needPatient) {
+                List<MzZdYpYsh> mjList = mzZdYpYshMapper.selectMjyByCommonParams(null, null, null, null);
+                List<MzZdYpYsh> jeList = mzZdYpYshMapper.selectJeByCommonParams(null, null, null, null);
+                mjSet = mjList.stream().map(m -> m.getCode()).collect(Collectors.toSet());
+                jeSet = jeList.stream().map(m -> m.getCode()).collect(Collectors.toSet());
             }
             for (MzChargeDetail mzChargeDetail : mzPrescriptionVo.getMzChargeDetailList()) {
                 if (StringUtils.isBlank(mzChargeDetail.getChargeItemCode())) {
@@ -996,20 +1007,20 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 //                if (StringUtils.isBlank(mzChargeDetail.getSupplyExec())) {
 //                    throw new MzException("保存处方失败,第" + itemNo + "行药品给药方式执行科室不能为空");
 //                }
-                if(needPatient){
+                if (needPatient) {
                     //设置处方类型
                     String jzFlag = orderNoMap.get(mzChargeDetail.getOrderNo());
-                    if(jzFlag==null){
-                        if(mjSet.contains(mzChargeDetail.getChargeItemCode())){
-                            jzFlag="2";
-                        }else if(jeSet.contains(mzChargeDetail.getChargeItemCode())){
-                            jzFlag="3";
-                        }else if(Constants.EMERGENCY_WARD_CODE.equals(mzPrescriptionVo.getVisitDeptCode())){
-                            jzFlag="1";
-                        }else {
-                            jzFlag="0";
+                    if (jzFlag == null) {
+                        if (mjSet.contains(mzChargeDetail.getChargeItemCode())) {
+                            jzFlag = "2";
+                        } else if (jeSet.contains(mzChargeDetail.getChargeItemCode())) {
+                            jzFlag = "3";
+                        } else if (Constants.EMERGENCY_WARD_CODE.equals(mzPrescriptionVo.getVisitDeptCode())) {
+                            jzFlag = "1";
+                        } else {
+                            jzFlag = "0";
                         }
-                        orderNoMap.put(mzChargeDetail.getOrderNo(),jzFlag);
+                        orderNoMap.put(mzChargeDetail.getOrderNo(), jzFlag);
                     }
                     mzChargeDetail.setJzFlag(jzFlag);
                 }
@@ -1333,7 +1344,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //四舍五入 和套餐
         //List<String> otherList = Arrays.asList(Constants.XYF, Constants.ZCYF, Constants.CYF, Constants.SSWRF, Constants.TC);
         List<String> otherList = Arrays.asList(Constants.SSWRF, Constants.TC);
-        int orderNo=0;
+        int orderNo = 0;
         Map<String, Object> resultMap = new HashMap<>();
         for (MzChargeDetail md : mzChargeDetails) {
             BigDecimal unitPrice = md.getUnitPrice() == null ? BigDecimal.ZERO : md.getUnitPrice().setScale(2, BigDecimal.ROUND_HALF_UP);
@@ -1341,21 +1352,21 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 unitPrice = BigDecimal.valueOf(0.01D);
                 md.setUnitPrice(unitPrice);
             }
-            if(otherList.contains(md.getBillItemCode())){
+            if (otherList.contains(md.getBillItemCode())) {
                 continue;
             }
             BigDecimal tempAmount = unitPrice.multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin()));
             amount = amount.add(tempAmount);
             String key = md.getOrderNo().toString();
-            BigDecimal orderAmount=(BigDecimal)resultMap.get(key);
-            if(orderAmount==null){
-                orderAmount=BigDecimal.ZERO;
+            BigDecimal orderAmount = (BigDecimal) resultMap.get(key);
+            if (orderAmount == null) {
+                orderAmount = BigDecimal.ZERO;
             }
-            if(md.getOrderNo()>orderNo){
-                orderNo=md.getOrderNo();
+            if (md.getOrderNo() > orderNo) {
+                orderNo = md.getOrderNo();
             }
-            orderAmount=orderAmount.add(tempAmount);
-            resultMap.put(key,orderAmount);
+            orderAmount = orderAmount.add(tempAmount);
+            resultMap.put(key, orderAmount);
 //            if (xyList.contains(md.getBillItemCode()) || Constants.YC_GROUP_NO.equals(md.getGroupNo())) {
 //                xyAmount = xyAmount.add(tempAmount);
 //            } else if (zyList.contains(md.getBillItemCode())) {
@@ -1366,8 +1377,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             notDiscountAmount = notDiscountAmount.add((md.getOrigPrice() == null ? BigDecimal.ZERO : md.getOrigPrice()).multiply(BigDecimal.valueOf(md.getQuantity() == null ? 1D : md.getQuantity())).multiply(BigDecimal.valueOf(md.getDrugWin() == null ? 1D : md.getDrugWin())));
         }
         List<BigDecimal> amountList = new ArrayList<>();
-        for(int i=1;i<=orderNo;i++){
-            amountList.add((BigDecimal)resultMap.get(String.valueOf(i)));
+        for (int i = 1; i <= orderNo; i++) {
+            amountList.add((BigDecimal) resultMap.get(String.valueOf(i)));
             resultMap.remove(String.valueOf(i));
         }
         discountAmount = notDiscountAmount.subtract(amount).setScale(1, BigDecimal.ROUND_HALF_UP);
@@ -1414,24 +1425,24 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             return mzPrescriptionVo;
         }
         List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectMzChargeDetailByPatientId(patientId, times, null, payMark);
-        List<MzChargeDetail> removeList =null;
+        List<MzChargeDetail> removeList = null;
         for (MzChargeDetail mzChargeDetail : mzChargeDetailList) {
             if (PayMarkEnum.CHARGED.code.equals(payMark)) {
                 //对于已经收费的药品记录查询,只需要查询医生开立的药品,给要方式等记录需要过滤
-                if(removeList==null){
+                if (removeList == null) {
                     removeList = new ArrayList<>();
                 }
                 if (YesNoEnum.YES.code != (mzChargeDetail.getGroupId())) {
                     removeList.add(mzChargeDetail);
                 }
             }
-            if("2".equals(mzChargeDetail.getJzFlag())){
+            if ("2".equals(mzChargeDetail.getJzFlag())) {
                 mzChargeDetail.setGroupNo("111");
-            }else if("3".equals(mzChargeDetail.getJzFlag())){
+            } else if ("3".equals(mzChargeDetail.getJzFlag())) {
                 mzChargeDetail.setGroupNo("131");
             }
         }
-        if (PayMarkEnum.CHARGED.code.equals(payMark) && removeList!=null) {
+        if (PayMarkEnum.CHARGED.code.equals(payMark) && removeList != null) {
             //对于已经收费的药品记录查询,只需要查询医生开立的药品,给要方式等记录需要过滤
             mzChargeDetailList.removeAll(removeList);
         }

+ 17 - 9
src/main/resources/static/js/mz/clinic.js

@@ -110,8 +110,13 @@ $(function () {
             return;
         }
         var diagnoseValue = $("#diagnoseValue").val();
-        if (diagnoseValue == null || diagnoseValue == "") {
-            errorMesageSimaple("诊断不能为空!");
+        var tentativeDiagnosis = $("#tentativeDiagnosis").val();
+        if(diagnoseValue!=null){
+            var reg = new RegExp( ',' , "g" )
+            diagnoseValue = diagnoseValue.replace( reg , '' );
+        }
+        if ((diagnoseValue == null || diagnoseValue == "") && (tentativeDiagnosis == null || tentativeDiagnosis == "")) {
+            errorMesageSimaple("诊断和初步诊断不能同时为空!");
             return;
         }
         $("#saveapidAcceptsModal").modal("show");
@@ -1271,8 +1276,8 @@ function editPrescription(jsonData) {
     $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
     var icdCode = jsonData.icdCode;
     var icdText = jsonData.icdText;
-    var icdCodeArr = icdCode.split(",");
-    var icdTextArr = icdText.split(",");
+    var icdCodeArr = icdCode!=null?icdCode.split(","):null;
+    var icdTextArr = icdText!=null?icdText.split(","):null;
     if (icdCodeArr != null && icdCodeArr.length > 0 && icdTextArr != null && icdTextArr.length > 0) {
         for (var i = 0; i < icdCodeArr.length; i++) {
             fitDiagnoseValue(icdTextArr[i], icdCodeArr[i]);
@@ -1378,6 +1383,8 @@ function callTemplate() {
             if (res.code == 0) {
                 var jsonData = JSON.parse(res.data.templateData);
                 editPrescription(jsonData);
+                $("#templateId").val(res.data.id);
+                $("#templateName").val(res.data.name);
                 $("#medicalModelModal").modal("hide");
                 closePopover();
             } else {
@@ -2553,7 +2560,9 @@ function calculateTotalAmount() {
                 $("#totalAmount").html(res.data.amount.toFixed(1));
                 var arrs = $("span.cf_amount");
                 for (var i = 0; i < arrs.length; i++) {
-                    $(arrs[i]).html(res.data.amountList[i].toFixed(1));
+                    if(res.data.amountList[i]!=undefined && res.data.amountList[i]!=null){
+                        $(arrs[i]).html(res.data.amountList[i].toFixed(1));
+                    }
                 }
                 // var arrs = $("#xyTabContent").find("span.cf_amount");
                 // for (var i = 0; i < arrs.length; i++) {
@@ -5034,7 +5043,7 @@ function saveapidAccepts() {
             data: JSON.stringify({
                 "id": $("#templateId").val(),
                 "name": templateName,
-                "icdText": jsonData.icdText,
+                "icdText": jsonData.icdText!=null?jsonData.icdText:jsonData.mzBlRecord.tentativeDiagnosis,
                 "templateType": templateType,
                 "templateStatus": templateStatus,
                 "templateData": JSON.stringify(jsonData)
@@ -5445,6 +5454,8 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
                         html += '</div>';
                     }
                     $("#prescriptionDetail_zd").html(html);
+                }else {
+                    $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
                 }
                 var emrProcess = jsonData.mzBlRecord.emrProcess;
                 if (emrProcess != null) {
@@ -5887,9 +5898,6 @@ function printPrescription(patientId, times, clnicId,payMark) {
                             }
                         }
                     });
-
-
-
                    // printGuideCard(patientId, times);
                 }
             } else {

+ 4 - 3
src/main/resources/templates/mz/clinic.html

@@ -1484,7 +1484,7 @@
     <div class="modal-dialog modal-sm">
         <div class="modal-content" style="width: 550px;">
             <div class="modal-header">
-                <button type="button" class="close" data-dismiss="modal" onclick="clearApidAcceptsModal()"><span aria-hidden="true">×</span>
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
                 </button>
                 <h4 class="modal-title modal-title-thmz">医疗范文</h4>
             </div>
@@ -1527,7 +1527,7 @@
             <div class="modal-footer">
                 <input type="hidden" id="templateId"/>
                 <button type="button" class="btn btn-primary" onclick="saveapidAccepts()">确定</button>
-                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clearApidAcceptsModal()">取消</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
             </div>
         </div>
     </div>
@@ -1648,7 +1648,7 @@
        <div>
            <div style="float: left"><img src="/thmz/images/taihe-logo.png" style="height: 60px;"></div>
            <div style="text-align:left;font-weight: 700;float: left;height: 60px;line-height: 60px;margin-left: 20px;">门诊指引单</div>
-           <div style="float: right;padding-right: 20px;"><img id="imgcode" style="height: 60px;"/> </div>
+           <div style="float: right;padding-right: 20px;"><img id="imgcode" style="height: 60px;"/></div>
        </div>
 
         <table class="table table-striped table-bordered" style="border-bottom: 1px solid black;font-size: 13px;">
@@ -1668,6 +1668,7 @@
             </tbody>
         </table>
         <table class="table table-striped table-bordered" style="font-size: 13px;margin-top: 10px;">
+
             <tbody>
             <tr>
                 <td style="font-weight: 700">合计:<span id="totalAmountGuideCard"></span></td>