瀏覽代碼

Merge branch 'dev-1.1.4' of https://172.16.32.165/hurugang/thmz_system into dev-1.1.4

hurugang 2 年之前
父節點
當前提交
c8ad151952

+ 3 - 0
src/main/java/cn/hnthyy/thmz/controller/yf/YfWardPrescriptionController.java

@@ -302,6 +302,9 @@ public class YfWardPrescriptionController {
                 for (Date date : dates) {
                     int h = Integer.parseInt(DateUtil.pase(date, "yyyy-MM-dd HH:mm").toString().substring(11, 13));
                     Date d = DateUtil.pase(date, "yyyy-MM-dd");
+                    if(null == yfWardVo.getPerformanceTime()){
+                        continue;
+                    }
                     Date performanceDate = DateUtil.pase(yfWardVo.getPerformanceTime(), "yyyy-MM-dd");
                     if (h >= 12) {
                         if (h >= 13) {

+ 3 - 3
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpOutDetlYf.java

@@ -74,15 +74,15 @@ public class YpOutDetlYf {
 	 */
   private String outType;
 	/**
-	 * null
+	 * 记帐标志;1:结账
 	 */
   private String acctType;
 	/**
-	 * null
+	 * 结帐人
 	 */
   private String acctId;
 	/**
-	 * null
+	 * 结帐日期
 	 */
   private Date acctDate;
 	/**

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

@@ -114,7 +114,7 @@ public interface YpBaseYfMapper {
      * @return
      */
     @Select({"<script>",
-            "select charge_code,serial,stock_amount,stock_value,group_no,location,visible_flag_mz,visible_flag_zy," +
+            "select charge_code,serial,stock_amount,stock_value,group_no,location,visible_flag_mz,visible_flag_zy,max_stock,mini_stock,isnull(split_percent,0)split_percent,retprice,pack_retprice," +
                     "       visible_flag_stop,stock_amount_virtual,stock_amount_virtual2,(case when open_virtual2='' then 0 else isnull(open_virtual2,0) end) as open_virtual2 " +
                     "from yp_base_yf WITH(NOLOCK) where charge_code=#{chargeCode} and serial=#{serial} and group_no=#{groupNo} ",
             "<when test='visibleFlagMz!=null'>",

+ 9 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpZdGroupNameMapper.java

@@ -18,6 +18,15 @@ public interface YpZdGroupNameMapper {
     @Select("select group_no,dept_code,py_code,d_code wb_code,group_name,mz_flag,yf_flag from yp_zd_group_name WITH(NOLOCK) where group_no=#{groupNo}")
     YpZdGroupName selectByGroupNo(@Param("groupNo") String groupNo);
 
+    /**
+     * 根据科室编码查询药房
+     *
+     * @param deptCode
+     * @return
+     */
+    @Select("select group_no,dept_code,py_code,d_code wb_code,group_name,mz_flag,yf_flag from yp_zd_group_name WITH(NOLOCK) where dept_code=#{deptCode}")
+    YpZdGroupName selectByDeptCode(@Param("deptCode") String deptCode);
+
     /**
      * 分页查询药房库字典列表
      *

+ 34 - 7
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YpOutDetlYfServiceImpl.java

@@ -4,11 +4,9 @@ import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
 import cn.hnthyy.thmz.entity.his.yp.YpOutDetlYf;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
+import cn.hnthyy.thmz.entity.his.yp.YpZdGroupName;
 import cn.hnthyy.thmz.mapper.his.mz.EmployeeMapper;
-import cn.hnthyy.thmz.mapper.his.yp.YpBaseYfMapper;
-import cn.hnthyy.thmz.mapper.his.yp.YpOutDetlYfMapper;
-import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
-import cn.hnthyy.thmz.mapper.his.yp.YpZdManufactoryMapper;
+import cn.hnthyy.thmz.mapper.his.yp.*;
 import cn.hnthyy.thmz.mapper.his.zd.ZdUnitCodeMapper;
 import cn.hnthyy.thmz.service.his.yf.YpOutDetlYfService;
 import cn.hnthyy.thmz.service.his.yp.YpConfigService;
@@ -55,6 +53,9 @@ public class YpOutDetlYfServiceImpl implements YpOutDetlYfService {
     @SuppressWarnings("all")
     @Autowired
     private YpZdManufactoryMapper ypZdManufactoryMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpZdGroupNameMapper ypZdGroupNameMapper;
 
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
@@ -98,6 +99,10 @@ public class YpOutDetlYfServiceImpl implements YpOutDetlYfService {
             ypOutDetlYf.setInputId(userId);
             ypOutDetlYf.setKeeper(userId);
             ypOutDetlYf.setConfirmFlag("0");
+            YpZdGroupName ypZdGroupName = ypZdGroupNameMapper.selectByDeptCode(ypOutDetlYf.getDeptCode());
+            if(null != ypZdGroupName){
+                ypOutDetlYf.setGroupNoOut(ypZdGroupName.getGroupNo());
+            }
             ypOutDetlYfMapper.insertYpOutDetlYf(ypOutDetlYf);
         }
         return 0;
@@ -137,11 +142,33 @@ public class YpOutDetlYfServiceImpl implements YpOutDetlYfService {
         List<YpOutDetlYf> ypOutDetlYfs = ypOutDetlYfMapper.selectYpOutDetlYfDetl(drawNo);
         for (int i = 0; i < ypOutDetlYfs.size(); i++) {
             YpOutDetlYf ypOutDetlYf = ypOutDetlYfs.get(i);
-            if(1 == ypBaseYfMapper.updateStockAmount(ypOutDetlYf.getChargeCode(),ypOutDetlYf.getSerial(),
-                    ypOutDetlYf.getGroupNo(),-ypOutDetlYf.getOutAmt(), BigDecimal.valueOf(-ypOutDetlYf.getOutAmt()).multiply(ypOutDetlYf.getPackRetprice()))){
+            String chargeCode = ypOutDetlYf.getChargeCode();
+            String serial = ypOutDetlYf.getSerial();
+            double outAmt = ypOutDetlYf.getOutAmt();
+            BigDecimal multiply = BigDecimal.valueOf(ypOutDetlYf.getOutAmt()).multiply(ypOutDetlYf.getPackRetprice());
+
+            if(1 == ypBaseYfMapper.updateStockAmount(chargeCode,serial,
+                    ypOutDetlYf.getGroupNo(),-outAmt, multiply.negate())){
                 log.info("药房出库药品成功[单号:{},编码:{},规格:{},数量:{}]", drawNo,ypOutDetlYf.getChargeCode(),ypOutDetlYf.getSerial(),-ypOutDetlYf.getOutAmt());
             }else{
-                new MzException("药房出库药品审核失败,单号:"+drawNo);
+                new MzException("药房出库药品审核失败,药房扣库异常,单号:"+drawNo);
+            }
+            if(StringUtils.isNotBlank(ypOutDetlYf.getGroupNoOut())){
+                YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(chargeCode, serial, ypOutDetlYf.getGroupNoOut(), null);
+                if(null == ypBaseYf){
+                    YpBaseYf ypBase = ypBaseYfMapper.selectYpBaseYf(chargeCode, serial, ypOutDetlYf.getGroupNo(), null);
+                    ypBase.setVisibleFlagMz("0");
+                    ypBase.setVisibleFlagStop("0");
+                    ypBase.setVisibleFlagZy("0");
+                    ypBase.setStockAmount(outAmt);
+                    ypBase.setStockValue(multiply);
+                    ypBase.setStockAmountVirtual(outAmt);
+                    ypBase.setGroupNo(ypOutDetlYf.getGroupNoOut());
+                    ypBaseYfMapper.insertYpBaseYf(ypBase);
+                }else{
+                    ypBaseYfMapper.updateStockAmount(chargeCode,serial,ypOutDetlYf.getGroupNoOut(),outAmt, multiply);
+                }
+                log.info("药房药品接收成功");
             }
             YpOutDetlYf yp = new YpOutDetlYf();
             yp.setConfirmId(userId);

+ 1 - 1
src/main/resources/static/js/yf/drug_delivery_dept.js

@@ -58,7 +58,7 @@ $(function () {
     $('#reportrange span').html(moment().subtract(29, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
     $(".selectpicker").selectpicker();
     if (groupNo == null) {
-        return errorMesageSimaple('药参数未设置,请在药品管理参数设置中设置');
+        return errorMesageSimaple('药参数未设置,请在药品管理参数设置中设置');
     }
     $("input").each(function () {
         this.onkeydown = function (e) { // 监听键盘事件

+ 12 - 7
src/main/resources/static/js/yf/ward_prescription.js

@@ -1124,13 +1124,6 @@ function cleanParams() {
 function printXyCount(flag) {
     let html = '';
     let totalMoney = 0;
-    let title = (pageClass == "T" || pageClass == "HT") ? '病房退药单' : '病房汇总领药单(' + $("#pageClassSearch").find("option:selected").text() + ')';
-    $(".title").text(flag == 0 ? title + "(重打)" : title);
-    $(".groupName").text(groupNo == 71 ? '门诊西药房' : '住院药房');
-    let w_code = $("#wardCode").find("option:selected").text();
-    $(".wardName").text(w_code.substring(0, w_code.lastIndexOf("(")));
-    $(".pageNo").text($("#pageNoSearch").val() == '' ? pageNos : $("#pageNoSearch").val());
-    $(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
     $('.sjh').remove();
     let datas = getJQAllData("tb_summarizing_table");
     for (var i = 0; i < datas.length; i++) {
@@ -1167,6 +1160,18 @@ function printXyCount(flag) {
     html += '<td colspan="3" style="text-align: left;font-weight: 700;border: transparent !important;">领药人:</td>';
     html += '</tr>';
     $("#hzdy_table").append(html);
+    let pageClassSearch = $("#pageClassSearch").find("option:selected").text();
+    if(isEmpty(pageClassSearch)){
+        errorMesageSimaple("打印表头参数为空,请联系管理员");
+        return;
+    }
+    let title = (pageClass == "T" || pageClass == "HT") ? '病房退药单' : '病房汇总领药单(' + pageClassSearch + ')';
+    $(".title").text(flag == 0 ? title + "(重打)" : title);
+    $(".groupName").text(groupNo == 71 ? '门诊西药房' : '住院药房');
+    let w_code = $("#wardCode").find("option:selected").text();
+    $(".wardName").text(w_code.substring(0, w_code.lastIndexOf("(")));
+    $(".pageNo").text($("#pageNoSearch").val() == '' ? pageNos : $("#pageNoSearch").val());
+    $(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
     print("hzdy_table_div");
 }
 

+ 1 - 1
src/main/resources/templates/fy_config.html

@@ -34,7 +34,7 @@
                                 <option value="91">医材药房</option>
                             </select>
                         </div>
-                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="groupYk">当前库房
+                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="groupYk">当前库房<span style="color: red">(药房请保证当前库房为空)</span>
                         </label>
                         <div class="col-md-2 col-sm-2 col-xs-12">
                             <select class="form-control selectpicker show-tick" data-live-search="true"