浏览代码

药品防止重复和默认用法功能开发完成

hurugang 4 年之前
父节点
当前提交
2eef5f0fd1

+ 44 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzZdYpYshController.java

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.controller.mz;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.mz.JyZdItem;
 import cn.hnthyy.thmz.entity.his.zd.MzZdYpYsh;
+import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import cn.hnthyy.thmz.service.his.mz.JcJyItemChargeService;
 import cn.hnthyy.thmz.service.his.zd.MzZdYpYshService;
 import lombok.extern.slf4j.Slf4j;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -91,4 +93,46 @@ public class MzZdYpYshController {
             return resultMap;
         }
     }
+
+
+
+    /**
+     * 查询诊疗与医技项目明细
+     *
+     * @param code 诊疗与医技项目明细
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getJcJyItemChargeByCode", method = {RequestMethod.GET})
+    public Map<String, Object> getJcJyItemChargeByCode(@RequestParam("code") String code) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(StringUtils.isBlank(code)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "项目编码不能为空");
+                return resultMap;
+            }
+            List<ZdChargeItem> zdChargeItemList = jcJyItemChargeService.queryJcJyItemChargeByCode(code);
+            if (zdChargeItemList == null || zdChargeItemList.size() == 0) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "未查询到符合条件的诊疗与医技项目明细");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("data", zdChargeItemList);
+            BigDecimal totalAmount =BigDecimal.ZERO;
+            for (ZdChargeItem zd:zdChargeItemList){
+                totalAmount=totalAmount.add(zd.getTotalAmount()==null?BigDecimal.ZERO:zd.getTotalAmount());
+            }
+            resultMap.put("totalAmount", totalAmount);
+            resultMap.put("message", "查询诊疗与医技项目明细成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询诊疗与医技项目明细失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询诊疗与医技项目明细失败");
+            return resultMap;
+        }
+    }
 }

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdChargeItem.java

@@ -114,4 +114,8 @@ public class ZdChargeItem {
     private String xlCode;
     //操作用户idcode
     private String operId;
+    //使用数量 非数据库字段
+    private BigDecimal num;
+    //收费总金额 非数据库字段
+    private BigDecimal totalAmount;
 }

+ 3 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/YpZdDictMapper.java

@@ -13,7 +13,7 @@ public interface YpZdDictMapper {
      * @param code
      * @return
      */
-    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency from yp_zd_dict where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
+    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial from yp_zd_dict where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
     YpZdDict selectYpZdDictByCodeAndSerial(@Param("code") String code,@Param("serial") String serial);
 
     /**
@@ -23,7 +23,7 @@ public interface YpZdDictMapper {
      * @return
      */
     @Select({"<script>",
-            "select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency from yp_zd_dict",
+            "select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial from yp_zd_dict",
             "<when test='codes!=null'>",
             " where code in",
             "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
@@ -41,6 +41,6 @@ public interface YpZdDictMapper {
      * @param code
      * @return
      */
-    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency from yp_zd_dict where code = #{code,jdbcType=VARCHAR} ")
+    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial from yp_zd_dict where code = #{code,jdbcType=VARCHAR} ")
     List<YpZdDict> selectYpZdDictByCode(@Param("code") String code);
 }

+ 13 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/JcJyItemChargeMapper.java

@@ -42,6 +42,7 @@ public interface JcJyItemChargeMapper {
 
     /**
      * 查询诊疗项目  检验和检查
+     *
      * @param commonParams
      * @return
      */
@@ -76,4 +77,16 @@ public interface JcJyItemChargeMapper {
             "</script>"})
     List<JyZdItem> selectJcJyItemByCommonParams(@Param("commonParams") String commonParams);
 
+    /**
+     * 根据检查检验编码查询对应的明细项目
+     * @param code
+     * @return
+     */
+    @Select("select rtrim(code) code,rtrim(charge_code) charge_code,amount,rtrim(charge_type) charge_type,rtrim(tc_no) tc_no,rtrim(zy_flag) zy_flag," +
+            "rtrim(mz_flag) mz_flag from jc_item_charge where  charge_code <> '' and charge_code is not null and code=#{code} UNION ALL " +
+            "select rtrim(code) code,rtrim(charge_code) charge_code,amount,rtrim(charge_type) charge_type,rtrim(tc_no) tc_no,rtrim(zy_flag) zy_flag," +
+            "rtrim(mz_flag) mz_flag from jy_item_charge where  charge_code <> '' and charge_code is not null and code=#{code} ")
+    List<JcJyItemCharge> selectJcJyItemChargeByCode(@Param("code") String code);
+
+
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/JcJyItemChargeService.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.service.his.mz;
 
 import cn.hnthyy.thmz.entity.his.mz.JcJyItemCharge;
 import cn.hnthyy.thmz.entity.his.mz.JyZdItem;
+import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 
 import java.util.List;
 
@@ -28,4 +29,12 @@ public interface JcJyItemChargeService {
      * @return
      */
     List<JyZdItem> queryJcJyItemByCommonParams(String commonParams);
+
+
+    /**
+     * 根据检查检验编码查询对应的收费明细项目
+     * @param code
+     * @return
+     */
+    List<ZdChargeItem> queryJcJyItemChargeByCode(String code) throws Exception;
 }

+ 41 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/JcJyItemChargeServiceImpl.java

@@ -3,21 +3,29 @@ package cn.hnthyy.thmz.service.impl.his.mz;
 import cn.hnthyy.thmz.Utils.SignUtil;
 import cn.hnthyy.thmz.entity.his.mz.JcJyItemCharge;
 import cn.hnthyy.thmz.entity.his.mz.JyZdItem;
+import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import cn.hnthyy.thmz.enums.ReqTypeEnum;
 import cn.hnthyy.thmz.mapper.his.mz.JcJyItemChargeMapper;
+import cn.hnthyy.thmz.mapper.his.zd.ZdChargeItemMapper;
 import cn.hnthyy.thmz.service.his.mz.JcJyItemChargeService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class JcJyItemChargeServiceImpl implements JcJyItemChargeService {
     @SuppressWarnings("all")
     @Autowired
     private JcJyItemChargeMapper jcJyItemChargeMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private ZdChargeItemMapper zdChargeItemMapper;
     @Autowired
     private ZdUnitCodeService zdUnitCodeService;
 
@@ -37,16 +45,45 @@ public class JcJyItemChargeServiceImpl implements JcJyItemChargeService {
             commonParams = null;
         }
         if (SignUtil.isAlpha(commonParams)) {
-            commonParams = "%"+commonParams.toUpperCase()+"%";
+            commonParams = commonParams.toUpperCase();
+        }
+        if (StringUtils.isNotBlank(commonParams)) {
+            commonParams = "%" + commonParams.toUpperCase() + "%";
         }
         List<JyZdItem> jyZdItemList = jcJyItemChargeMapper.selectJcJyItemByCommonParams(commonParams);
-        if(jyZdItemList!=null && jyZdItemList.size()>0){
-            jyZdItemList.stream().forEach(j->{
-                if(StringUtils.isNotBlank(j.getExecUnit())){
+        if (jyZdItemList != null && jyZdItemList.size() > 0) {
+            jyZdItemList.stream().forEach(j -> {
+                if (StringUtils.isNotBlank(j.getExecUnit())) {
                     j.setExecUnitName(zdUnitCodeService.queryDeptNameByIdInCache(j.getExecUnit()));
                 }
             });
         }
         return jyZdItemList;
     }
+
+    @Override
+    public List<ZdChargeItem> queryJcJyItemChargeByCode(String code) throws Exception {
+        if (StringUtils.isBlank(code)) {
+            throw new Exception("诊疗与医技编码为空!");
+        }
+        List<JcJyItemCharge> jcJyItemChargeList = jcJyItemChargeMapper.selectJcJyItemChargeByCode(code);
+        if (jcJyItemChargeList == null || jcJyItemChargeList.size() == 0) {
+            return null;
+        }
+        List<String> chargeCodeLists = jcJyItemChargeList.stream().map(j -> j.getChargeCode()).collect(Collectors.toList());
+        Map<String, BigDecimal> map = jcJyItemChargeList.stream().collect(Collectors.toMap(JcJyItemCharge::getChargeCode, JcJyItemCharge::getAmount));
+        if (chargeCodeLists == null || chargeCodeLists.size() == 0) {
+            return null;
+        }
+        List<ZdChargeItem> zdChargeItemList = zdChargeItemMapper.selectZdChargeItemByCodeList(chargeCodeLists);
+        if (map != null && map.size() > 0) {
+            for (ZdChargeItem zd : zdChargeItemList) {
+                zd.setNum(map.get(zd.getCode()));
+                zd.setTotalAmount((zd.getChargeAmount() == null ? BigDecimal.ZERO : zd.getChargeAmount()).multiply(zd.getNum() == null ? BigDecimal.ZERO : zd.getNum()));
+            }
+        }
+        return zdChargeItemList;
+    }
+
+
 }

+ 372 - 30
src/main/resources/static/js/mz/clinic.js

@@ -3,6 +3,8 @@
 var msg_list_loading = false;
 //挂号卡片列表页面下标
 var pageIndex = 0;
+//药品使用方法,天数和频次的集合
+var groupIdMap = null;
 $(function () {
     initGenderSelect();
     initResponceTypeSelect();
@@ -154,6 +156,7 @@ function initGroupOrder() {
     $('#groupId').selectpicker('refresh');
     $("#groupId").selectpicker('val', 1);
     $('#groupId').selectpicker('refresh');
+    groupIdMap = new Map();
 }
 
 /**
@@ -168,8 +171,39 @@ function appendGroupOrder() {
 
 }
 
+
 /**
- * 关闭只能问诊弹框
+ * 组号改变事件
+ */
+function groupIdChange() {
+    var last = parseInt($("#groupId > option:last").val());
+    var groupId = $("#groupId").val();
+    if (groupId == last) {
+        clearWesternMedicine(true);
+    } else {
+        var map = groupIdMap.get(groupId);
+        if (map != null) {
+            var supplyType = map.get("supplyType");
+            var orderFrequency = map.get("orderFrequency");
+            var dayNum = map.get("dayNum");
+            //用法编码
+            $("#supplyType").selectpicker('val', supplyType);
+            $('#supplyType').selectpicker('refresh');
+            //$("#supplyType").attr("disabled", "disabled");
+            //天数
+            $("#dayNum").selectpicker('val', dayNum);
+            $('#dayNum').selectpicker('refresh');
+           // $("#dayNum").attr("disabled", "disabled");
+            //频次编码
+            $("#orderFrequency").selectpicker('val', orderFrequency);
+            $('#orderFrequency').selectpicker('refresh');
+          //  $("#orderFrequency").attr("disabled", "disabled");
+        }
+    }
+}
+
+/**
+ * 关闭智能问诊弹框
  */
 function closePopover() {
     //$(".popover").popover('hide');
@@ -1302,7 +1336,7 @@ function initSupplyTypes() {
             var html = '';
             $.each(res.data, function (commentIndex, comment) {
                 if (comment.groupNo === "71") {
-                    html += '<option value="' + comment.code + '">' + comment.name + '('+comment.pyCode+')'+'</option>';
+                    html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
                 }
             });
             $('#supplyType').empty();
@@ -1331,7 +1365,7 @@ function initZySupplyTypes(id) {
             $.each(res.data, function (commentIndex, comment) {
                 if (comment.groupNo === "81") {
                     // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
-                    html += '<option value="' + comment.code + '">' + comment.name + '('+comment.pyCode+')'+'</option>';
+                    html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
                 }
             });
             $('#' + id).empty();
@@ -1396,23 +1430,14 @@ function saveMedicine(index) {
             $("#messageButton").off("click").on("click", function (t) {
                 $("#messageModal").modal("hide");
                 refreshNavTabs(index);
-                if (index == 0) {
-                    saveWesternMedicine();
-                } else if (index == 1) {
-
-                } else if (index == 2) {
-
-                }
+                saveWesternMedicine();
             });
         } else {
             saveWesternMedicine();
         }
     } else if (index == 1) {
         saveChineseMedicine();
-    } else if (index == 2) {
-
     }
-
 }
 
 
@@ -1452,6 +1477,10 @@ function saveWesternMedicine() {
     var medicalAdvice = $("#medicalAdvice").val();
     //金额
     var totalRetprice = parseFloat($("#totalRetprice").val());
+    if (currentCode == null || currentCode == '') {
+        errorMesageSimaple("未选择任何药品!");
+        return;
+    }
     var html = '<div class="form-group">';
     html += groupId + '.&nbsp;&nbsp;';
     html += westernMedicineNamme + ' ';
@@ -1466,6 +1495,9 @@ function saveWesternMedicine() {
     }
     html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
     html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
+    html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
+    html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
     html += '</div>';
 
     var tableId = $("#xyTab li.active").find("a").attr("href");
@@ -1484,23 +1516,94 @@ function saveWesternMedicine() {
     if (groupId === groupIdLast) {
         appendGroupOrder();
     }
-    clearWesternMedicine();
+    //设置药品的用法,频次,天数
+    var map = groupIdMap.get(groupId);
+    if (map == null) {
+        map = new Map();
+        map.put("supplyType", supplyType);
+        map.put("orderFrequency", orderFrequency);
+        map.put("dayNum", dayNum);
+        groupIdMap.put(groupId, map);
+    }
+    clearWesternMedicine(false);
+}
+
+
+/**
+ * 保存当前项目到右边处方区域
+ * @param
+ */
+function saveJyJcItem() {
+    var tableId = $("#zlTab li.active").find("a").attr("href");
+    //组号
+    var groupId = $(tableId).find("div:eq(0)").children().length + 1;
+    //药品名称
+    var jcJyItem = $("#jcJyItem").val();
+    //当前药品编码
+    var currentCode = $("#current_code").val();
+    //当前项目价格
+    var jcjyItemPrice = $("#jcjyItemPrice").val();
+    //备注
+    var remark = $("#remark").val();
+    if (currentCode == null || currentCode == '') {
+        errorMesageSimaple("未选择任何项目!");
+        return;
+    }
+    var html = '<div class="form-group">';
+    html += groupId + '.&nbsp;&nbsp;';
+    html += jcJyItem + ' ';
+    if (remark != null && remark != '') {
+        html += '备注:' + remark;
+    }
+    html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '<i class="fa fa-eye" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;" onclick="getJcJyItemChargeByCode(\'' + currentCode + '\')"></i>';
+    html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
+    html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
+    html += '</div>';
+    $(tableId).find("div:eq(0)").append(html);
+    //设置单张处方金额
+    var cfAmount = $(tableId).find("span.cf_amount").html();
+    if (cfAmount != null && cfAmount != "") {
+        cfAmount = parseFloat($(tableId).find("span.cf_amount").html());
+    }
+    cfAmount = Add(cfAmount, jcjyItemPrice);
+    $(tableId).find("span.cf_amount").html(cfAmount);
+    //设置总金额
+    calculateTotalAmount();
+    clearJyJcItem();
 }
 
 
 /**
  * 清空西药
+ * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  */
-function clearWesternMedicine() {
+function clearWesternMedicine(flag) {
     //药品名称
     $("#western_medicine_name").val(null);
     //当前药品编码
     $("#current_code").val(null);
     //当前药品规格
     $("#current_serial").val(null);
-    //用法编码
-    $("#supplyType").selectpicker('val', null);
-    $('#supplyType').selectpicker('refresh');
+    if (flag) {
+        //用法编码
+        $("#supplyType").selectpicker('val', null);
+        $('#supplyType').selectpicker('refresh');
+        //$("#supplyType").removeAttr("disabled");
+        //天数
+        $("#dayNum").selectpicker('val', null);
+        $('#dayNum').selectpicker('refresh');
+       // $("#dayNum").removeAttr("disabled");
+        //频次编码
+        $("#orderFrequency").selectpicker('val', null);
+        $('#orderFrequency').selectpicker('refresh');
+      //  $("#orderFrequency").removeAttr("disabled");
+    } else {
+        //$("#supplyType").attr("disabled", "disabled");
+        //$("#dayNum").attr("disabled", "disabled");
+       // $("#orderFrequency").attr("disabled", "disabled");
+    }
     //药品默认单次使用剂量
     $("#drugWinDb").val(null);
     //处方实际单次使用剂量
@@ -1508,12 +1611,6 @@ function clearWesternMedicine() {
     //剂量单位
     $("#drugWinUnit").selectpicker('val', null);
     $('#drugWinUnit').selectpicker('refresh');
-    //天数
-    $("#dayNum").selectpicker('val', null);
-    $('#dayNum').selectpicker('refresh');
-    //频次编码
-    $("#orderFrequency").selectpicker('val', null);
-    $('#orderFrequency').selectpicker('refresh');
     //总量
     $("#gross").val(null);
     //包装单位
@@ -1546,6 +1643,12 @@ function saveChineseMedicine() {
     var zyInstructionText = $('#zyInstruction option:selected').text();
     //单价
     var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
+    //当前中药的总价
+    var totalRetprice = Multiply(drugWin, zyPackRetprice);
+    if (currentCode == null || currentCode == '') {
+        errorMesageSimaple("未选择任何药品!");
+        return;
+    }
     var html = '<div class="form-group" style="float: left;">';
     html += chineseMedicineNamme;
     if (zyInstruction != null && zyInstruction != '') {
@@ -1555,12 +1658,13 @@ function saveChineseMedicine() {
     html += drugWin + 'g';
     html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
     html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 30px;font-size: 20px;"></i>';
+    html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
+    html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
+    html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
     html += '</div>';
 
     var tableId = $("#zyTab li.active").find("a").attr("href");
     $(tableId).find("div:eq(0)").append(html);
-    //当前中药的总价
-    var totalRetprice = Multiply(drugWin, zyPackRetprice);
     //获取中药付数
     var zyfs = $(tableId).find("input.zyfs").val();
     //当前处方单付金额
@@ -1598,6 +1702,21 @@ function clearChineseMedicine() {
     $("#zy_packRetprice").val(null);
 }
 
+
+/**
+ * 清空项目
+ */
+function clearJyJcItem() {
+    //项目名称
+    $("#jcJyItem").val(null);
+    //当前项目编码
+    $("#current_code").val(null);
+    //单价
+    $("#jcjyItemPrice").val(null);
+    //备注
+    $("#remark").val(null);
+}
+
 /**
  * 计算总金额
  */
@@ -2417,7 +2536,7 @@ function fitValue(value, id) {
         var arr = value.split("/");
         $("#pressure_high").val(arr[0]);
         $("#pressure_floor").val(arr[1]);
-        if($("#pressureLeftFlag").hasClass("in")){
+        if ($("#pressureLeftFlag").hasClass("in")) {
             $("#pressure_high_left").val(arr[0]);
             $("#pressure_floor_left").val(arr[1]);
         }
@@ -2593,13 +2712,16 @@ function loadYpList(index) {
 }
 
 
-
 /**
  * 按照药品的编码 和药品拆零规格查询药品信息 西药
  * @param code
  * @param serial
  */
 function checkYpInfo(code, serial) {
+    //判断是否有重复的项目  返回true 说明有重复的
+    if (verifyRepeat(code, serial, 0)) {
+        return;
+    }
     $.ajax({
         type: "GET",
         url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
@@ -2642,6 +2764,10 @@ function checkYpInfo(code, serial) {
  * @param serial
  */
 function checkZyInfo(code, serial) {
+    //判断是否有重复的项目  返回true 说明有重复的
+    if (verifyRepeat(code, serial, 1)) {
+        return;
+    }
     $.ajax({
         type: "GET",
         url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
@@ -2670,7 +2796,6 @@ function checkZyInfo(code, serial) {
 }
 
 
-
 /**
  * 加载医技与诊疗列表
  * @param index
@@ -2759,12 +2884,228 @@ function loadjcJyItemList() {
         },
         onClickRow: function (row, $element) {
             $('#jcJyItem').webuiPopover('hide');
-           // checkYpInfo(row.code, row.serial);
+            checkJcJyItemInfo(row.code, row.name);
+        }
+    });
+}
+
+
+/**
+ * 诊疗与医技选中
+ * @param code
+ */
+function checkJcJyItemInfo(code, name) {
+    //判断是否有重复的项目  返回true 说明有重复的
+    if (verifyRepeat(code, null, 2)) {
+        return;
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getJcJyItemChargeByCode?code=' + code,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                if (res.data != null) {
+                    $("#jcJyItem").val(name);
+                    $("#jcJyItem").blur();
+                    $("#jcjyItemPrice").val(res.totalAmount);
+                    $("#current_code").val(code);
+                }
+            } else {
+                errorMesage(res);
+            }
         }
     });
 }
 
 
+/**
+ * 查询诊疗与医技项目明细
+ * @param code 编码
+ */
+function getJcJyItemChargeByCode(code) {
+    if (code != null) {
+        $("#itemCodeSearch").val(code);
+    } else if ($("#current_code").val() == null || $("#current_code").val() == '') {
+        errorMesageSimaple("未选中任何项目!");
+        return;
+    }
+    $("#jcJyItemModal").modal("show");
+    $('#jcJyItemTable').bootstrapTable('refresh');
+    $('#jcJyItemTable').bootstrapTable({
+        url: '/thmz/getJcJyItemChargeByCode',         //请求后台的URL(*)
+        method: 'GET',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: true,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: false,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: function (params) {
+            var itemCodeSearch = $("#itemCodeSearch").val()
+            if (itemCodeSearch == null || itemCodeSearch == "") {
+                itemCodeSearch = $("#current_code").val();
+            }
+            var temp = {
+                code: itemCodeSearch
+            };
+            return temp;
+        },           //传递参数(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 5,                       //每页的记录行数(*)
+        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)
+        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        strictSearch: true,
+        showColumns: false,                  //是否显示所有的列
+        showRefresh: false,                  //是否显示刷新按钮
+        minimumCountColumns: 2,             //最少允许的列数
+        clickToSelect: true,                //是否启用点击选中行
+        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
+        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
+        cardView: false,                    //是否显示详细视图
+        detailView: false,
+        //rowStyle:rowStyle,//通过自定义函数设置行样式
+        ajaxOptions: {
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token")
+            }
+        },
+        columns: [
+            {
+                title: '项目编码',
+                align: "center",
+                valign: 'middle',
+                // sortable: true
+                formatter: function (value, row, index) {
+                    if (code == null || code == "") {
+                        code = $("#current_code").val();
+                    }
+                    return code;
+                }
+            }, {
+                field: 'code',
+                title: '收费编码',
+                align: "center",
+                valign: 'middle',
+                //  sortable: true
+            }
+            , {
+                field: 'name',
+                title: '收费名称',
+                align: "center",
+                valign: 'middle',
+                // sortable: true
+            }, {
+                field: 'num',
+                title: '数量',
+                align: "center",
+                valign: 'middle',
+                // sortable: true
+            }, {
+                field: 'chargeAmount',
+                title: '单价',
+                align: "center",
+                valign: 'middle',
+                // sortable: true
+                formatter: function (value, row, index) {
+                    if (value == null || value == "") {
+                        return 0;
+                    }
+                    return value.toFixed(2);
+                }
+            }, {
+                field: 'totalAmount',
+                title: '总金额',
+                align: "center",
+                valign: 'middle',
+                // sortable: true
+                formatter: function (value, row, index) {
+                    if (value == null || value == "") {
+                        return 0;
+                    }
+                    return value.toFixed(2);
+                }
+            }
+        ],
+        responseHandler: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            $("#itemCodeSearch").val(null);
+            var ress = eval(res);
+            if (ress.code == -1) {
+                errorMesage(res);
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+
+            return {
+                "total": ress.data.length,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+        onClickRow: function (row, $element) {
+            $('#jcJyItem').webuiPopover('hide');
+            checkJcJyItemInfo(row.code);
+        }
+    });
+}
+
+
+/**
+ * 判断是否有重复的项目  返回true 说明有重复的
+ * @param code
+ * @param serial
+ * @param index
+ */
+function verifyRepeat(code, serial, index) {
+    var tabId = null;
+    //西药
+    if (index == 0) {
+        tabId = "xyTab";
+    } else if (index == 1) {
+        //中成药
+        tabId = "zyTab";
+    } else if (index == 2) {
+        //医技与诊疗
+        tabId = "zlTab";
+    }
+    var tableId = $("#" + tabId + " li.active").find("a").attr("href");
+    var items = $(tableId).find("div:eq(0)").find("div.form-group");
+    if (items != null && items.length > 0) {
+        for (var i = 0; i < items.length; i++) {
+            if (serial == null) {
+                var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
+                if (code === temporary_items_code) {
+                    errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
+                    return true;
+                }
+            } else {
+                var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
+                var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
+                if (code === temporary_items_code && serial === temporary_items_serial) {
+                    errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
+                    return true;
+                }
+            }
+
+        }
+    }
+    return false;
+}
+
+
 /**
  * 初始化处方分页
  * @param index 0 西药 1 中药 2 诊疗
@@ -2948,6 +3289,7 @@ function fitWesternMedicine(res) {
     $("#packSize").val(res.data.packSize);
     $("#current_code").val(res.data.code);
     $("#current_serial").val(res.data.serial);
+    calculate();
 }
 
 /**

+ 63 - 32
src/main/resources/templates/mz/clinic.html

@@ -402,7 +402,7 @@
                         <div class="form-group has-feedback" style="float: right;width: calc(100% - 65px);">
                             <div class="el-select__tags"><span id="diagnoseTags"></span></div>
                             <input type="text" class="form-control has-feedback-left" id="diagnose"
-                                   placeholder="请输入" style="padding-left: 10px;">
+                                   placeholder="请输入" style="padding-left: 10px;" readonly>
                             <input id="diagnoseValue" type="hidden"/>
                             <span class="fa fa-search form-control-feedback right" aria-hidden="true"
                                   style="right: 0px;"></span>
@@ -443,7 +443,7 @@
                                         <label class="my_label_2">组号:</label>
                                         <div style="width: 85px;float: left;">
                                             <select class="form-control selectpicker show-tick"
-                                                    title="请选择"
+                                                    title="请选择" onchange="groupIdChange()"
                                                     id="groupId">
                                             </select>
                                         </div>
@@ -546,7 +546,7 @@
                                     </div>
                                 </div>
                                 <div style="width: 100%;height: 22px;line-height: 22px;">
-                                    <div style="float: left;display: inline-block;"><a onclick="clearWesternMedicine()"
+                                    <div style="float: left;display: inline-block;"><a onclick="clearWesternMedicine(true)"
                                                                                        style="cursor: pointer;font-size: 14px;color: #2e69eb!important;"><i
                                             class="fa fa-trash">&nbsp;&nbsp;清空</i></a></div>
 
@@ -634,7 +634,8 @@
                                                 class="required">*</span>:</label>
                                         <div class="form-group has-feedback" style="float: right;width: 340px;">
                                             <input type="text" class="form-control has-feedback-left" id="jcJyItem"
-                                                   placeholder="请输入" style="padding-left: 10px;width: 99%" onKeyUp="loadjcJyItemList()"
+                                                   placeholder="请输入" style="padding-left: 10px;width: 99%"
+                                                   onKeyUp="loadjcJyItemList()"
                                                    required="required">
                                             <span class="fa fa-search form-control-feedback right"
                                                   aria-hidden="true"></span>
@@ -644,40 +645,44 @@
                                 <div class="item form-group">
                                     <div style="width: 130px;float: left;">
                                         <label class="my_label_2">单价:</label>
-                                        <input type="text" class="form-control my_label_input_2" id="symptom110"
+                                        <input type="text" class="form-control my_label_input_2" id="jcjyItemPrice"
                                                style="padding-left: 10px;" readonly>
                                     </div>
-                                    <div style="width: 256px;float: left;">
-                                        <label class="my_label">总量<span
-                                                class="required">*</span>:</label>
-                                        <input type="text" class="form-control my_label_input_2" id="symptom120"
-                                               style="padding-left: 10px;" required="required">
-                                    </div>
-                                </div>
-                                <div class="item form-group">
-                                    <div style="width: 100%">
-                                        <label class="my_label_2">内涵:</label>
-                                        <input type="text" class="form-control " id="symptom130"
-                                               style="padding-left: 10px;width: 340px;" placeholder="请输入">
-                                    </div>
+                                    <!--<div style="width: 256px;float: left;">-->
+                                        <!--<label class="my_label">总量<span-->
+                                                <!--class="required">*</span>:</label>-->
+                                        <!--<input type="text" class="form-control my_label_input_2" id="symptom120"-->
+                                               <!--style="padding-left: 10px;" required="required">-->
+                                    <!--</div>-->
                                 </div>
+                                <!--<div class="item form-group">-->
+                                <!--<div style="width: 100%">-->
+                                <!--<label class="my_label_2">内涵:</label>-->
+                                <!--<input type="text" class="form-control " id="symptom130"-->
+                                <!--style="padding-left: 10px;width: 340px;" placeholder="请输入">-->
+                                <!--</div>-->
+                                <!--</div>-->
                                 <div class="item form-group">
                                     <div style="width: 100%">
                                         <label class="my_label_2">备注:</label>
-                                        <input type="text" class="form-control " id="symptom131"
+                                        <input type="text" class="form-control " id="remark"
                                                style="padding-left: 10px;width: 340px;" placeholder="请输入">
                                     </div>
                                 </div>
                                 <div style="width: 100%;height: 22px;line-height: 22px;">
-                                    <div style="float: left;display: inline-block;"><a onclick="clearWesternMedicine()"
+                                    <div style="float: left;display: inline-block;"><a onclick="clearJyJcItem()"
                                                                                        style="cursor: pointer;font-size: 14px;color: #2e69eb!important;"><i
-                                            class="fa fa-trash">&nbsp;&nbsp;清空</i></a></div>
+                                            class="fa fa-trash">&nbsp;&nbsp;清空</i></a>
+                                        <a style="cursor: pointer;font-size: 14px;color: #2e69eb!important;margin-left: 20px;" onclick="getJcJyItemChargeByCode(null)"><i
+                                                class="fa fa-eye">&nbsp;&nbsp;查看明细</i></a>
+                                    </div>
 
-                                    <div style="float: right;display: inline-block;"><a id="clearRegistration5"
-                                                                                        style="cursor: pointer;font-size: 14px;color: #333333;"
-                                                                                        onclick="saveMedicine(2)">&nbsp;&nbsp;保存到右侧<i
-                                            class="fa fa-long-arrow-right"
-                                            style="font-size: 20px;vertical-align: middle;width: 30px;height: 20px;text-align: center;background-color: #337AB7;color: white;margin-left: 10px"></i></a>
+                                    <div style="float: right;display: inline-block;">
+                                        <a id="clearRegistration5"
+                                           style="cursor: pointer;font-size: 14px;color: #333333;"
+                                           onclick="saveJyJcItem()">&nbsp;&nbsp;保存到右侧<i
+                                                class="fa fa-long-arrow-right"
+                                                style="font-size: 20px;vertical-align: middle;width: 30px;height: 20px;text-align: center;background-color: #337AB7;color: white;margin-left: 10px"></i></a>
                                     </div>
 
                                 </div>
@@ -1347,7 +1352,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" ><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>
@@ -1363,19 +1368,19 @@
                                 <input type="checkbox" class="flat" id="emrHpiFlagCheck">&nbsp;&nbsp;现病史
                             </label>
                             <label style="padding-left: 0px;" class="col-md-3 col-sm-3 col-xs-3">
-                                <input type="checkbox" class="flat"  id="emrPsFlagCheck">&nbsp;&nbsp;既往史
+                                <input type="checkbox" class="flat" id="emrPsFlagCheck">&nbsp;&nbsp;既往史
                             </label>
                             <label style="padding-left: 0px;" class="col-md-3 col-sm-3 col-xs-3">
-                                <input type="checkbox" class="flat"  id="personalHistoryFlagCheck">&nbsp;&nbsp;个人史
+                                <input type="checkbox" class="flat" id="personalHistoryFlagCheck">&nbsp;&nbsp;个人史
                             </label>
                             <label style="padding-left: 0px;" class="col-md-3 col-sm-3 col-xs-3">
-                                <input type="checkbox" class="flat"  id="familyHistoryFlagCheck">&nbsp;&nbsp;家族史
+                                <input type="checkbox" class="flat" id="familyHistoryFlagCheck">&nbsp;&nbsp;家族史
                             </label>
                             <label style="padding-left: 0px;" class="col-md-3 col-sm-3 col-xs-3">
-                                <input type="checkbox" class="flat"  id="obstericalHistoryFlagCheck">&nbsp;&nbsp;婚育史
+                                <input type="checkbox" class="flat" id="obstericalHistoryFlagCheck">&nbsp;&nbsp;婚育史
                             </label>
                             <label style="padding-left: 0px;" class="col-md-3 col-sm-3 col-xs-3">
-                                <input type="checkbox" class="flat"  id="pressureLeftFlagCheck">&nbsp;&nbsp;血压(左)
+                                <input type="checkbox" class="flat" id="pressureLeftFlagCheck">&nbsp;&nbsp;血压(左)
                             </label>
                         </div>
                     </div>
@@ -1391,3 +1396,29 @@
 <!--配置工作台弹窗结尾-->
 
 
+
+
+<!--诊疗与医技明细弹窗开始-->
+<div class="modal fade bs-example-modal-sm in" tabindex="-1" role="dialog" aria-hidden="true" id="jcJyItemModal"
+     style="top:20%;">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content" style="width: 780px;">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                </button>
+                <h4 class="modal-title modal-title-thmz">提示</h4>
+            </div>
+            <div class="modal-body">
+                <form class="form-horizontal form-label-left" novalidate>
+                    <table id="jcJyItemTable"></table>
+                   <!-- 用来查看已经保存到 处方区域的项目明细-->
+                    <input type="hidden" id="itemCodeSearch"/>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
+<!--诊疗与医技明细弹窗结尾-->