瀏覽代碼

优化门诊处方,增加模板版面,优化库存管理

hurugang 3 年之前
父節點
當前提交
751422abfa

+ 4 - 3
src/main/java/cn/hnthyy/thmz/controller/mz/TemplateController.java

@@ -115,10 +115,11 @@ public class TemplateController {
                 resultMap.put("message", "删除医疗范文失败,范文主键参数为空");
                 return resultMap;
             }
-            template.setTemplateStatus(YesNoEnum.YES.code);
+            Template dbTemplate=templateService.queryById(template.getId());
+            dbTemplate.setTemplateStatus(YesNoEnum.YES.code);
             User tokenUser = TokenUtil.getUser(httpServletRequest);
-            template.setUpdateId(tokenUser.getUserIdCode());
-            int num = templateService.saveTemplate(template);
+            dbTemplate.setUpdateId(tokenUser.getUserIdCode());
+            int num = templateService.saveTemplate(dbTemplate);
             if (num == 1) {
                 resultMap.put("code", 0);
                 resultMap.put("message", "删除医疗范文成功");

+ 4 - 3
src/main/java/cn/hnthyy/thmz/controller/mz/YpZdClassController.java

@@ -397,9 +397,10 @@ public class YpZdClassController {
             String dlName = (String) jcZdClass.get("dl_name");
             String xlCode = (String) jcZdClass.get("xl_code");
             String xlName = (String) jcZdClass.get("xl_name");
-            if (xlName != null && xlName.indexOf("第二部位") > 0) {
-                continue;
-            }
+            //TODO以后还是要去掉注释,暂时把第二部位放出来
+//            if (xlName != null && xlName.indexOf("第二部位") > 0) {
+//                continue;
+//            }
             //父编码是2位数 说明是一级树
             if (dlCode.length() == 2 && !dlCode.equals(currentGrandParentDlCode)) {
                 grandParentMap = new HashMap<>();

+ 1 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpBaseYf.java

@@ -34,6 +34,7 @@ public class YpBaseYf {
     private BigDecimal packRetprice;
     //拆零价
     private BigDecimal retprice;
+    //虚拟库存
     private Double stockAmountVirtual;
     private String jzyfFlag;
     //拆零比例

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpBaseYfMapper.java

@@ -86,7 +86,7 @@ public interface YpBaseYfMapper {
      * @return
      */
     @Select("select charge_code,serial,stock_amount,stock_value,group_no,location,visible_flag_mz,visible_flag_zy," +
-            "       visible_flag_stop,stock_amount_virtual2,open_virtual2 " +
+            "       visible_flag_stop,stock_amount_virtual,stock_amount_virtual2,open_virtual2 " +
             "from yp_base_yf WITH(NOLOCK) where charge_code=#{chargeCode} and serial=#{serial} and group_no=#{groupNo}")
     YpBaseYf selectYpBaseYf(@Param("chargeCode") String chargeCode, @Param("serial") String serial,@Param("groupNo") String groupNo);
 

+ 14 - 6
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -1666,7 +1666,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
 
     /**
-     * 设置完整处方
+     * 设置完整处方  needPatient needVerify 同事为true 时是保存处方
      *
      * @param mzPrescriptionVo 处方信息
      * @param needPatient      是否需要病人信息
@@ -1861,9 +1861,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 }
                 YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCodeAndSerial(mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial());
                 if (ypZdDict != null) {
+                    //当前处方购药量
+                    BigDecimal thisQuantity = BigDecimal.valueOf(mzChargeDetail.getQuantity()).multiply(BigDecimal.valueOf(mzChargeDetail.getDrugWin()));
                     if (ypZdDict.getMzRestrict() != null) {
-                        //当前处方购药量
-                        BigDecimal thisQuantity = BigDecimal.valueOf(mzChargeDetail.getQuantity()).multiply(BigDecimal.valueOf(mzChargeDetail.getDrugWin()));
                         //本月已经购买量
                         Integer quantityDb = mzChargeDetailMapper.selectTotalQuantityForDate(mzChargeDetail.getPatientId(), mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial(), DateUtil.getFirstSecondForMonth(new Date()));
                         quantityDb = quantityDb == null ? 0 : quantityDb;
@@ -1899,9 +1899,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         if (StringUtils.isBlank(mzChargeDetail.getFrequency())) {
                             throw new MzException("保存处方失败,第" + itemNo + "行药品频率不能为空");
                         }
+                        YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.XY_ZCY_GROUP_NO);
+                        if (ypBaseYf == null) {
+                            throw new MzException("无药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的库存信息!");
+                        }
+                        if(thisQuantity.compareTo(ypBaseYf.getStockAmountVirtual()==null?BigDecimal.ZERO:BigDecimal.valueOf(ypBaseYf.getStockAmountVirtual()))==1){
+                            throw new MzException("药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的药品超过库存数量,该药品实际库存"+(ypBaseYf.getStockAmountVirtual()==null?0:ypBaseYf.getStockAmountVirtual())+"请调整该药品数量!");
+                        }
                         if (Constants.CLF.equals(ypZdDict.getBillItemMz())) {
-                            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO);
-                            if (ypBaseYf != null) {
+                            YpBaseYf ycBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO);
+                            if (ycBaseYf != null) {
                                 mzChargeDetail.setGroupNo(Constants.YC_GROUP_NO);
                                 mzChargeDetail.setExecDept(Constants.YC_EXEC_CODE);
                             }
@@ -1998,7 +2005,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 mzChargeDetail.setReqNo(0);
                 mzChargeDetail.setOrderBill(100);
                 mzChargeDetail.setGroupId(YesNoEnum.YES.code);
-                if (!Constants.YJ_GROUP_NO.equals(mzChargeDetail.getGroupNo())) {
+                //不是医技项目且是保存处方时减虚拟库存
+                if (!Constants.YJ_GROUP_NO.equals(mzChargeDetail.getGroupNo()) && needPatient && needVerify) {
                     int num = ypBaseYfMapper.updateStockAmountVirtual(mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial(), mzChargeDetail.getGroupNo(), BigDecimal.valueOf(mzChargeDetail.getQuantity()).multiply(BigDecimal.valueOf(mzChargeDetail.getDrugWin())));
                     if (num == 0) {
                         throw new MzException("保存处方失败,第" + itemNo + "行药品库存锁定失败,没有对应的药品记录");

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/MzZdYpYshServiceImpl.java

@@ -38,7 +38,7 @@ public class MzZdYpYshServiceImpl implements MzZdYpYshService {
         List<MzZdYpYsh> mzZdYpYshes = mzZdYpYshMapper.selectMzZdYpYshByCommonParamsAndGroupNo(commonParams, letterLowerParamsCase, letterParamsUpperCase, groupNo);
         //如果查询的是西成药,需要把医材 和诊疗项目,麻、精一,精二也查询过来
         if (Constants.XY_ZCY_GROUP_NO.equals(groupNo)) {
-            Integer pageSize =10;
+            Integer pageSize =5;
             List<MzZdYpYsh> ycList = mzZdYpYshMapper.selectYcByCommonParams(commonParams, letterLowerParamsCase, letterParamsUpperCase,pageSize);
             mzZdYpYshes.addAll(ycList);
             List<MzZdYpYsh> mjList = mzZdYpYshMapper.selectMjyByCommonParams(commonParams, letterLowerParamsCase, letterParamsUpperCase,pageSize);

+ 11 - 8
src/main/resources/static/js/mz/clinic.js

@@ -456,7 +456,7 @@ function contentMethod() {
         $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
         $("#" + popoverId + " .popover-content").css("height", "100%");
         $("#smartAssistPopoverContent").css("height", "100%");
-        var html = ' <div style="height: 34%;padding-left: 15px;width: 100%;">' +
+        var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
             '                <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;    font-size: 12px;"' +
             '                        class="btn btn-primary">' +
             '                    <span id="patientHisData"></span>就医轨迹' +
@@ -469,7 +469,7 @@ function contentMethod() {
             '                    </form>' +
             '                </div>' +
             '            </div>' +
-            '            <div style="height: 33%;padding-left: 15px;width: 100%;">' +
+            '            <div style="height: 23%;padding-left: 15px;width: 100%;">' +
             '                <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
             '                class="btn btn-primary">' +
             '                <span id="recommendType"></span>推荐' +
@@ -481,7 +481,7 @@ function contentMethod() {
             '                    </form>' +
             '                </div>' +
             '            </div>' +
-            '            <div style="height: 33%;padding-left: 15px;width: 100%;">' +
+            '            <div style="height: 53%;padding-left: 15px;width: 100%;">' +
             '                <button type="button"' +
             '                        style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;    font-size: 12px;"' +
             '                        class="btn btn-primary">' +
@@ -569,7 +569,7 @@ function fitPatientHisData() {
                             icdText = "空白诊断";
                         }
                         icdText = icdText.trim();
-                        html += '                        <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
+                        html += '                        <div class="item form-group thmz_alert" style="width: 100%;">';
                         html += '                            <div style="float: left;width: 172px;">';
                         html += '                                <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
                         html += '                                     style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
@@ -676,7 +676,7 @@ function fitRecommendData(paramsType) {
                 } else {
                     for (var i = 0; i < data.length; i++) {
                         var paramsContent = data[i].paramsContent;
-                        html += '                        <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
+                        html += '                        <div class="item form-group thmz_alert" style="width: 100%;">';
                         html += '                            <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
                         html += paramsContent;
                         html += '                            </div>';
@@ -727,7 +727,7 @@ function fitTemplateData() {
                 } else {
                     for (var i = 0; i < data.length; i++) {
                         var template = data[i];
-                        html += '                        <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
+                        html += '                        <div class="item form-group thmz_alert" style="width: 100%;">';
                         html += '                            <div title="' + template.name + '"';
                         html += '                                 style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
                         html += template.name;
@@ -4434,7 +4434,8 @@ function checkYpInfo(code, serial, groupNo, needNotice) {
         return;
     }
     $("#current_groupNo").val(groupNo);
-    $("#treeButton").webuiPopover('hide');
+    //不需要每次都关闭这个帮助字典
+    //$("#treeButton").webuiPopover('hide');
     $.ajax({
         type: "GET",
         url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
@@ -4746,7 +4747,8 @@ function checkJcJyItemInfo(code, name, type, async) {
     if (verifyRepeat(code, null, 2)) {
         return;
     }
-    $("#treeButton").webuiPopover('hide');
+    //不需要每次都关闭帮助树
+    //$("#treeButton").webuiPopover('hide');
     $.ajax({
         type: "GET",
         url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
@@ -6811,6 +6813,7 @@ function printPrescription(patientId, times, clnicId, payMark, printType) {
                     $("#deptPrescription").text(res.deptName);
                     $("#doctorPrescription").text(res.doctorName);
                     $("#cfTime").text(res.opDate);
+                    $("#socialNo").text(mzPatientMi.socialNo);
                     $("#zdPrescription").text(res.data.icdText);
                     $("#patientIdGuideCard").text(mzPatientMi.patientId);
                     $("#patientNameGuideCard").text(mzPatientMi.name);

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

@@ -1669,6 +1669,10 @@
                 <td style="text-align: right">处方时间:</td>
                 <td id="cfTime" colspan="3"></td>
             </tr>
+            <tr>
+                <td style="text-align: right">身份证号码:</td>
+                <td id="socialNo" colspan="5"></td>
+            </tr>
             <tr>
                 <td style="text-align: right">诊断:</td>
                 <td id="zdPrescription" colspan="5"></td>