瀏覽代碼

医生取消退药功能开发

hurugang 4 年之前
父節點
當前提交
eecaa0426a

+ 15 - 0
src/main/java/cn/hnthyy/thmz/controller/NavigationController.java

@@ -294,6 +294,21 @@ public class NavigationController {
     }
 
 
+    /**
+     * 取消退药
+     *
+     * @return
+     */
+    @RequestMapping("/repeal-refund-medicine")
+    public String repealRefundMedicine(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/repeal-refund-medicine")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/repeal_refund_medicine";
+    }
+
+
     /**
      * 门诊收入明细
      *

+ 133 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/YpMzFytjController.java

@@ -32,7 +32,7 @@ public class YpMzFytjController {
      */
     @UserLoginToken
     @RequestMapping(value = "/getYfyjl", method = {RequestMethod.POST})
-    public Map<String, Object> getYfyjl(@RequestBody ChargeFeeParamsVo chargeFeeParamsVo) {
+    public Map<String, Object> getYfyjl(@RequestBody ChargeFeeParamsVo chargeFeeParamsVo, HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if (chargeFeeParamsVo == null) {
@@ -54,6 +54,8 @@ public class YpMzFytjController {
                 chargeFeeParamsVo.setPatientId(null);
             }
             chargeFeeParamsVo.setConfirmFlag(ConfirmFlagEnum.CONFIRM.code);
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            chargeFeeParamsVo.setOpId(tokenUser.getUserIdCode());
             List<YpMzFytj> ypMzFytjList = ypMzFytjService.queryYpMzFytj(chargeFeeParamsVo);
             if(ypMzFytjList!=null && ypMzFytjList.size()>0){
                 for (YpMzFytj ypMzFytj:ypMzFytjList){
@@ -181,4 +183,134 @@ public class YpMzFytjController {
     }
 
 
+
+    /**
+     * 查询已经申请退药的记录明细
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getRefundMedicineDetail", method = {RequestMethod.POST})
+    public Map<String, Object> getRefundMedicineDetail(@RequestBody ChargeFeeParamsVo chargeFeeParamsVo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (chargeFeeParamsVo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询已经申请退药的记录明细失败,参数为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getPatientId())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "门诊就诊号不能为空");
+            }
+            if(chargeFeeParamsVo.getTimes()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "门诊就诊次数不能为空");
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getOrderNo())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "处方号不能为空");
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getReceiptNo())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "门诊缴费次数不能为空");
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getGroupNoOut())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "药房编码不能为空");
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询已经申请退药的记录明细成功");
+            List<Map<String,Object>> ypMzFytjList = ypMzFytjService.queryRefundMedicineDetail(chargeFeeParamsVo);
+            resultMap.put("data", ypMzFytjList);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询已经申请退药的记录明细失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询已经申请退药的记录明细失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 查询退药申请
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getRepealRefund", method = {RequestMethod.POST})
+    public Map<String, Object> getRepealRefund(@RequestBody ChargeFeeParamsVo chargeFeeParamsVo, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (chargeFeeParamsVo == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询退药申请失败,参数为空");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询退药申请成功");
+            if(StringUtils.isBlank(chargeFeeParamsVo.getName())){
+                chargeFeeParamsVo.setName(null);
+            }else {
+                chargeFeeParamsVo.setName("%"+chargeFeeParamsVo.getName()+"%");
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getSerialNo())){
+                chargeFeeParamsVo.setSerialNo(null);
+            }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getPatientId())){
+                chargeFeeParamsVo.setPatientId(null);
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            chargeFeeParamsVo.setOpId(tokenUser.getUserIdCode());
+            List<YpMzFytj> ypMzFytjList = ypMzFytjService.queryRepealRefund(chargeFeeParamsVo);
+            if(ypMzFytjList!=null && ypMzFytjList.size()>0){
+                for (YpMzFytj ypMzFytj:ypMzFytjList){
+                    if(ypMzFytj==null || StringUtils.isBlank(ypMzFytj.getGroupNo())){
+                        continue;
+                    }
+                    YpZdGroupName ypZdGroupName=ypZdGroupNameService.queryByGroupNo(ypMzFytj.getGroupNo());
+                    if(ypZdGroupName==null){
+                        ypMzFytj.setGroupNoOut(ypMzFytj.getGroupNo());
+                        continue;
+                    }
+                    ypMzFytj.setGroupNoOut(ypZdGroupName.getGroupName());
+                }
+            }
+            resultMap.put("data", ypMzFytjList);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询退药申请失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询退药申请失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 取消退药申请
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/repealRefund", method = {RequestMethod.POST})
+    public Map<String, Object> repealRefund(@RequestBody YpMzFytj ypMzFytj) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            resultMap.put("code", 0);
+            resultMap.put("message", "取消退药申请成功");
+            ypMzFytjService.repealRefund(ypMzFytj);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("取消退药申请失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "取消退药申请失败");
+            return resultMap;
+        }
+    }
+
 }

+ 4 - 1
src/main/java/cn/hnthyy/thmz/entity/his/YpMzFytj.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.entity.his;
 
+import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -65,7 +66,9 @@ public class YpMzFytj implements Serializable {
     private String doctorId;
     //1:医生处方
     private String doctorName;
-    //标识:1确认发药 医技确认 2.打印药品清单 3.配药确认 5.
+    /**
+     * 标识:1确认发药 医技确认 2.打印药品清单 3.配药确认 5.  {@link ConfirmFlagEnum}
+     */
     private Integer confirmFlag;
     //草药副数
     private Integer cyFy;

+ 110 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/YpMzFytjMapper.java

@@ -98,6 +98,9 @@ public interface YpMzFytjMapper {
             "<when test='patientId!=null'>",
             " and patient_id = #{patientId}",
             "</when>",
+            "<when test='opId!=null'>",
+            " and doctor_id = #{opId}",
+            "</when>",
             "<when test='serialNo!=null'>",
             " and serial_no = #{serialNo}",
             "</when>",
@@ -174,6 +177,94 @@ public interface YpMzFytjMapper {
             "ORDER BY yp_mz_fytj.item_no ASC ",
             "</script>"})
     List<Map<String,Object>> selectYpMx(ChargeFeeParamsVo chargeFeeParamsVo);
+
+
+    /**
+     * 通用查询退药申请
+     *
+     * @return
+     */
+    @Select({"<script>",
+            "select DISTINCT rtrim(patient_id) patient_id,times,receipt_no,order_no,rtrim(name) name,input_time,rtrim(group_no) group_no,confirm_time,rtrim(doctor_id) doctor_id,rtrim(doctor_name) doctor_name,real_no from yp_mz_fytj where receipt_no <![CDATA[<]]> 0 and confirm_flag =2 ",
+            "<when test='name!=null'>",
+            " and name like #{name}",
+            "</when>",
+            "<when test='patientId!=null'>",
+            " and patient_id = #{patientId}",
+            "</when>",
+            "<when test='opId!=null'>",
+            " and doctor_id = #{opId}",
+            "</when>",
+            "<when test='serialNo!=null'>",
+            " and serial_no = -#{serialNo}",
+            "</when>",
+            "<when test='groupNoOut!=null'>",
+            " and group_no_out = #{groupNoOut}",
+            "</when>",
+            "<when test='beginDate!=null'>",
+            " and input_time <![CDATA[>=]]> #{beginDate}",
+            "</when>",
+            "<when test='endDate!=null'>",
+            " and input_time <![CDATA[<=]]> #{endDate}",
+            "</when>",
+            "</script>"})
+    List<YpMzFytj> selectRepealRefund(ChargeFeeParamsVo chargeFeeParamsVo);
+
+
+    /**
+     * 查询已经申请退药的记录明细
+     * @param chargeFeeParamsVo
+     * @return
+     */
+    @Select({"<script>" +
+            "SELECT DISTINCT yp_mz_fytj.serial_no,   " +
+            "         yp_mz_fytj.order_no,   " +
+            "         yp_mz_fytj.patient_id,   " +
+            "         yp_mz_fytj.times,   " +
+            "         yp_mz_fytj.receipt_no,   " +
+            "         drugname=c.name+'('+isnull(d.abbr_name,isnull(d.name,''))+')',   " +
+            "         specification=c.specification,   " +
+            "         quantity= case yp_mz_fytj.group_no when 81 then yp_mz_fytj.quantity * cy_fy else yp_mz_fytj.quantity  end,   " +
+            "         yp_mz_fytj.unit_price,   " +
+            "         yp_mz_fytj.item_no,   " +
+            "         yp_mz_fytj.drug_flag,   " +
+            "         yp_mz_fytj.charge_item_code,   " +
+            "         yp_mz_fytj.serial,   " +
+            "         yp_mz_fytj.confirm_time,   " +
+            "         yp_mz_fytj.group_no,   " +
+            "         yp_mz_fytj.bill_item_code,   " +
+            "         yp_mz_fytj.pay_mark,   " +
+            "         yp_mz_fytj.charge_item_type,   " +
+            "         yp_mz_fytj.name,   " +
+            "         yp_mz_fytj.charge_date,   " +
+            "         '',   " +
+            "         yp_mz_fytj.cy_fy,   " +
+            "         yp_mz_fytj.specification,   " +
+            "         yp_mz_fytj.drugname,   " +
+            "         yp_mz_fytj.doctor_name,   " +
+            "         yp_mz_fytj.doctor_id,   " +
+            "         dec_amount=case yp_mz_fytj.group_no when 81 then yp_mz_fytj.quantity * cy_fy else yp_mz_fytj.quantity  end,       " +
+            "         warn_dept=yp_mz_fytj.warn_dept,   " +
+            "         yp_mz_fytj.country_flag,   " +
+            "         yp_mz_fytj.confirm_flag,   " +
+            "         yp_mz_fytj.self_flag,   " +
+            "         yp_mz_fytj.response_type,   " +
+            "         yp_mz_fytj.warn_dept  ," +
+            "         real_no=yp_mz_fytj.real_no," +
+            "         win_no = yp_mz_fytj.win_no " +
+            "    FROM  (select * from yp_mz_fytj where patient_id = #{patientId} and times = #{times} and receipt_no = #{receiptNo} and quantity  <![CDATA[>]]> 0 ) yp_mz_fytj, " +
+            "         yp_zd_dict c, " +
+            "         yp_zd_manufactory d " +
+            "   WHERE  yp_mz_fytj.order_no = #{orderNo}  AND  " +
+            "         yp_mz_fytj.group_no_out = #{groupNoOut} AND  " +
+            "          yp_mz_fytj.charge_item_code = c.code  and  " +
+            "          yp_mz_fytj.serial = c.serial  and  " +
+            "         yp_mz_fytj.confirm_flag = '2'   and " +
+            "         yp_mz_fytj.serial_no <![CDATA[<]]> 0 and " +
+            "         c.manu_code *= d.code " +
+            "ORDER BY yp_mz_fytj.item_no ASC ",
+            "</script>"})
+    List<Map<String,Object>> selectRefundMedicineDetail(ChargeFeeParamsVo chargeFeeParamsVo);
     /**
      * 修改本院记账的发药统计的流水号为新收款的流水号
      * @param ypMzFytj
@@ -222,4 +313,23 @@ public interface YpMzFytjMapper {
      */
     @Select("select isnull(sum(quantity),0) from yp_mz_fytj where group_no_out = #{groupNo} and confirm_flag = 1 and serial = #{serial} and charge_item_code = #{code} and DATEDIFF( day, confirm_time,getdate())<${day} and DATEPART(w,  confirm_time) <DATEPART(w, getdate())")
     int selectDrugUsageStatistics(@Param("code") String code,@Param("serial") String serial, @Param("groupNo") String groupNo,@Param("day")int day);
+
+
+    /**
+     * 删除发药申请
+     * @param ypMzFytj
+     * @return
+     */
+    @Delete("delete from yp_mz_fytj where patient_id =#{patientId} and  times = #{times} and receipt_no =#{receiptNo}")
+    int deleteYpMzFytj(YpMzFytj ypMzFytj);
+
+
+    /**
+     * 撤销退药申请
+     *
+     * @param ypMzFytj
+     * @return
+     */
+    @Update("update yp_mz_fytj set real_no=-real_no,serial_no=-serial_no where patient_id = #{patientId} and times = #{times}")
+    int repealRefund(YpMzFytj ypMzFytj);
 }

+ 22 - 0
src/main/java/cn/hnthyy/thmz/service/his/YpMzFytjService.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.service.his;
 
+import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.YpMzFytj;
 import cn.hnthyy.thmz.vo.ChargeFeeParamsVo;
 
@@ -18,6 +19,13 @@ public interface YpMzFytjService {
     List<YpMzFytj> queryYpMzFytj(ChargeFeeParamsVo chargeFeeParamsVo);
 
 
+    /**
+     * 通用查询退药申请
+     *
+     * @return
+     */
+    List<YpMzFytj> queryRepealRefund(ChargeFeeParamsVo chargeFeeParamsVo);
+
     /**
      * 查询已经确认的药品记录明细
      * @param chargeFeeParamsVo
@@ -25,6 +33,13 @@ public interface YpMzFytjService {
      */
     List<Map<String,Object>> queryYpMx(ChargeFeeParamsVo chargeFeeParamsVo);
 
+    /**
+     * 查询已经申请退药的记录明细
+     * @param chargeFeeParamsVo
+     * @return
+     */
+    List<Map<String,Object>> queryRefundMedicineDetail(ChargeFeeParamsVo chargeFeeParamsVo);
+
     /**
      * 退药申请
       * @param chargeFeeParamsVo
@@ -51,4 +66,11 @@ public interface YpMzFytjService {
      * @return
      */
     int queryDrugUsageStatistics(String code,String serial,String groupNo,int day);
+
+    /**
+     * 取消退药申请
+     * @param ypMzFytj
+     * @return
+     */
+    int repealRefund(YpMzFytj ypMzFytj) throws MzException;
 }

+ 51 - 18
src/main/java/cn/hnthyy/thmz/service/impl/his/YpMzFytjServiceImpl.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.service.impl.his;
 
 import cn.hnthyy.thmz.Utils.CloneUtil;
 import cn.hnthyy.thmz.common.Constants;
+import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.YpMzFytj;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import cn.hnthyy.thmz.mapper.his.YpMzFytjMapper;
@@ -25,49 +26,60 @@ public class YpMzFytjServiceImpl implements YpMzFytjService {
     @SuppressWarnings("all")
     @Autowired
     private YpMzFytjMapper ypMzFytjMapper;
+
     @Override
     public List<YpMzFytj> queryYpMzFytj(ChargeFeeParamsVo chargeFeeParamsVo) {
         return ypMzFytjMapper.selectYpMzFytj(chargeFeeParamsVo);
     }
 
+    @Override
+    public List<YpMzFytj> queryRepealRefund(ChargeFeeParamsVo chargeFeeParamsVo) {
+        return ypMzFytjMapper.selectRepealRefund(chargeFeeParamsVo);
+    }
+
     @Override
     public List<Map<String, Object>> queryYpMx(ChargeFeeParamsVo chargeFeeParamsVo) {
         return ypMzFytjMapper.selectYpMx(chargeFeeParamsVo);
     }
 
+    @Override
+    public List<Map<String, Object>> queryRefundMedicineDetail(ChargeFeeParamsVo chargeFeeParamsVo) {
+        return ypMzFytjMapper.selectRefundMedicineDetail(chargeFeeParamsVo);
+    }
+
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
     public int refundMedicine(ChargeFeeParamsVo chargeFeeParamsVo) {
-        List<String> chargeItemCodeAndDecAmounts=chargeFeeParamsVo.getChargeItemCodeAndDecAmounts();
-        if(chargeItemCodeAndDecAmounts==null || chargeItemCodeAndDecAmounts.size()==0){
+        List<String> chargeItemCodeAndDecAmounts = chargeFeeParamsVo.getChargeItemCodeAndDecAmounts();
+        if (chargeItemCodeAndDecAmounts == null || chargeItemCodeAndDecAmounts.size() == 0) {
             return 0;
         }
-        Map<String,String> chargeItemCodeAndDecAmountMap = new HashMap<>();
-        for (String str:chargeItemCodeAndDecAmounts){
-            String [] arr=str.split(",");
-            chargeItemCodeAndDecAmountMap.put(arr[0].trim(),arr[1].trim());
+        Map<String, String> chargeItemCodeAndDecAmountMap = new HashMap<>();
+        for (String str : chargeItemCodeAndDecAmounts) {
+            String[] arr = str.split(",");
+            chargeItemCodeAndDecAmountMap.put(arr[0].trim(), arr[1].trim());
         }
-        List<YpMzFytj> ypMzFytjList=ypMzFytjMapper.selectConfirdYpMzFytjBySerialNoAndGroupNo(chargeFeeParamsVo.getSerialNo(),chargeFeeParamsVo.getGroupNoOut(),chargeFeeParamsVo.getOrderNo());
-        if(ypMzFytjList==null || ypMzFytjList.size()==0){
+        List<YpMzFytj> ypMzFytjList = ypMzFytjMapper.selectConfirdYpMzFytjBySerialNoAndGroupNo(chargeFeeParamsVo.getSerialNo(), chargeFeeParamsVo.getGroupNoOut(), chargeFeeParamsVo.getOrderNo());
+        if (ypMzFytjList == null || ypMzFytjList.size() == 0) {
             return 0;
         }
         Date now = new Date();
-        for(YpMzFytj ypMzFytj:ypMzFytjList){
-            if(ypMzFytj!=null){
+        for (YpMzFytj ypMzFytj : ypMzFytjList) {
+            if (ypMzFytj != null) {
                 YpMzFytj newYpMzFytj = CloneUtil.clone(ypMzFytj);
                 ypMzFytj.setSerialNo(-ypMzFytj.getSerialNo());
                 ypMzFytj.setRealNo(-ypMzFytj.getRealNo());
                 ypMzFytjMapper.updateYpMzFytj(ypMzFytj);
-                String decAmount=chargeItemCodeAndDecAmountMap.get(ypMzFytj.getChargeItemCode().trim());
-                if(StringUtils.isNotBlank(decAmount)){
-                    decAmount=decAmount.replace("<br>","");
+                String decAmount = chargeItemCodeAndDecAmountMap.get(ypMzFytj.getChargeItemCode().trim());
+                if (StringUtils.isNotBlank(decAmount)) {
+                    decAmount = decAmount.replace("<br>", "");
                 }
-                if(StringUtils.isBlank(decAmount)){
+                if (StringUtils.isBlank(decAmount)) {
                     newYpMzFytj.setQuantity(0D);
-                }else {
-                    if(Constants.CYF.equals(newYpMzFytj.getBillItemCode().trim())){
+                } else {
+                    if (Constants.CYF.equals(newYpMzFytj.getBillItemCode().trim())) {
                         newYpMzFytj.setQuantity(BigDecimal.valueOf(Double.valueOf(decAmount)).divide(BigDecimal.valueOf(newYpMzFytj.getCyFy())).doubleValue());
-                    }else {
+                    } else {
                         newYpMzFytj.setQuantity(Double.valueOf(decAmount));
                     }
 
@@ -85,11 +97,32 @@ public class YpMzFytjServiceImpl implements YpMzFytjService {
 
     @Override
     public YpMzFytj querylastItem(String groupNo, Date beginDate, Date endDate) {
-        return ypMzFytjMapper.selectlastItem(groupNo,beginDate,endDate);
+        return ypMzFytjMapper.selectlastItem(groupNo, beginDate, endDate);
     }
 
     @Override
     public int queryDrugUsageStatistics(String code, String serial, String groupNo, int day) {
         return ypMzFytjMapper.selectDrugUsageStatistics(code, serial, groupNo, day);
     }
+
+    @Override
+    public int repealRefund(YpMzFytj ypMzFytj) throws MzException {
+        if (ypMzFytj == null) {
+            throw new MzException("退药申请参数为空!");
+        }
+        if (StringUtils.isBlank(ypMzFytj.getPatientId())) {
+            throw new MzException("病人id为空!");
+        }
+        if (ypMzFytj.getTimes() == null) {
+            throw new MzException("病人就诊次数为空!");
+        }
+        if (ypMzFytj.getReceiptNo() == null) {
+            throw new MzException("病人缴费次数为空!");
+        }
+        if (ypMzFytj.getRealNo() == null) {
+            throw new MzException("退药流水号为空!");
+        }
+        ypMzFytjMapper.deleteYpMzFytj(ypMzFytj);
+        return ypMzFytjMapper.repealRefund(ypMzFytj);
+    }
 }

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

@@ -767,7 +767,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             throw new MzException("诊断和初步诊断不能同时为空!");
         }
         setFullMzPrescriptionVo(mzPrescriptionVo, true);
-        if (dbClinic != null && dbClinic.getId() != null && StringUtils.isNotBlank(dbClinic.getPatientId()) && dbClinic.getTimes() != null) {
+        if (dbClinic != null && dbClinic.getId() != null && StringUtils.isNotBlank(dbClinic.getPatientId()) && dbClinic.getTimes() != null && ClinicStatusEnum.HAD_CLINIC.code.equals(dbClinic.getClinicStatus())) {
             List<MzChargeDetail> dbMzChargeDetailList = mzChargeDetailMapper.selectNotPayMzChargeDetailByPatientId(mzPrescriptionVo.getPatientId(), dbClinic.getTimes());
             if (dbMzChargeDetailList != null && dbMzChargeDetailList.size() > 0) {
                 for (MzChargeDetail mzChargeDetail : dbMzChargeDetailList) {

+ 4 - 14
src/main/resources/static/js/mz/refund_medicine.js

@@ -124,13 +124,7 @@ function initChargeListByPatient() {
             var ress = eval(res);
             if (ress.code == -1) {
                 if (ress.message != null && ress.message != '') {
-                    new PNotify({
-                        title: '错误提示',
-                        text: ress.message,
-                        type: 'error',
-                        hide: true,
-                        styling: 'bootstrap3'
-                    });
+               errorMesage(res);
                 }
                 return {
                     "total": 0,//总页数
@@ -186,6 +180,8 @@ function setPatientId() {
                 } else {
                     $("#patientId").val(patientId_or_cardNo);
                 }
+            }else {
+                $("#patientId").val(null);
             }
         }
     });
@@ -325,13 +321,7 @@ function fitfymx(patientId,times,receiptNo,orderNo,groupNoOut) {
             var ress = eval(res);
             if (ress.code == -1) {
                 if (ress.message != null && ress.message != '') {
-                    new PNotify({
-                        title: '错误提示',
-                        text: ress.message,
-                        type: 'error',
-                        hide: true,
-                        styling: 'bootstrap3'
-                    });
+                    errorMesage(res);
                 }
                 return {
                     "total": 0,//总页数

+ 1 - 1
src/main/resources/static/js/mz/registration.js

@@ -1670,7 +1670,7 @@ function prn1Print(patientId, times) {
                 LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
                 LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
                 LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
-                LODOP.ADD_PRINT_TEXT("6mm", "0mm", "50mm", "3mm", "湖南泰和医院管理有限公司");
+                LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
                 LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
                 LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
                 LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);

+ 1 - 1
src/main/resources/static/js/mz/registration_list.js

@@ -2166,7 +2166,7 @@ function prn1Print(patientId, times) {
                 LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
                 LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
                 LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
-                LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");
+                LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
                 LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
                 LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
                 LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);

+ 348 - 0
src/main/resources/static/js/mz/repeal_refund_medicine.js

@@ -0,0 +1,348 @@
+//@ sourceURL=repeal_refund_medicine.js
+$(function () {
+    init_daterangepicker();
+    initRepealRefundListByPatient();
+    //  initFeeTable();
+    //重置查询参数
+    $('#btn_clean').click(function () {
+        cleanParams();
+    });
+
+    $("#btn_query").click(function (t) {
+        initRepealRefundListByPatient();
+    });
+
+    $(".selectpicker").selectpicker({
+        dropuAuto: false
+    });
+});
+
+
+/**
+ * 查询退药申请记录
+ */
+function initRepealRefundListByPatient() {
+    $('#tb_table').bootstrapTable("destroy");
+    $('#tb_table').bootstrapTable({
+        url: '/thmz/getRepealRefund',         //请求后台的URL(*)
+        method: 'post',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: queryParams,           //传递参数(*)
+        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 10,                       //每页的记录行数(*)
+        pageList: [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) {
+                    return '<button type="button" class="registration-no-color-foot-button" title="取消退药申请" onclick="repealRefund(\'' + row.patientId + '\','+row.times+','+row.receiptNo+','+row.realNo+')"><i class="fa fa-reply"></i></button>' ;
+                }
+            }
+            ,{
+                field: 'patientId',
+                title: '门诊号',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'name',
+                title: '姓名',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'groupNoOut',
+                title: '药房',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'inputTime',
+                title: '退药时间',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if (value != null && value != "") {
+                        return format(value, "yyyy-MM-dd HH:mm:ss");
+                    }
+                    return "";
+                }
+            }, {
+                field: 'doctorName',
+                title: '医生',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'realNo',
+                title: '流水号',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if (value != null && value != "") {
+                        return Math.abs(value);
+                    }
+                    return "";
+                }
+            }
+        ],
+        onClickRow: function (row) {
+            fitfymx(row.patientId, row.times, row.receiptNo,row.orderNo,row.groupNo);
+        },
+        responseHandler: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var ress = eval(res);
+            if (ress.code == -1) {
+                if (ress.message != null && ress.message != '') {
+                    errorMesage(res);
+                }
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+            return {
+                "total": ress.data.length,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+    });
+}
+
+
+/**
+ * 构建列表查询参数
+ * @param params
+ * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
+ */
+function queryParams(params) {
+    var rePortRangeArr = getRePortRangeArr();
+    var temp = {
+        beginDate: rePortRangeArr[0],
+        endDate: rePortRangeArr[1],
+        name: $("#name").val(),
+        patientId: $("#patientId").val(),
+        serialNo: $("#serialNo").val()
+    };
+    return temp;
+};
+
+
+/**
+ * 撤销退药申请
+ * @param patientId
+ * @param times
+ * @param receiptNo
+ * @param realNo
+ */
+function repealRefund(patientId,times,receiptNo,realNo) {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/repealRefund',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo,"realNo":realNo}),
+        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) {
+              successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+
+
+/**
+ * 设置病人id
+ */
+function setPatientId() {
+    var patientId_or_cardNo = $("#patientId_or_cardNo").val();
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
+        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) {
+                    $("#patientId").val(res.data.patientId);
+                } else {
+                    $("#patientId").val(patientId_or_cardNo);
+                }
+            }else {
+                $("#patientId").val(null);
+            }
+        }
+    });
+}
+
+
+/**
+ * 获取时间选择器的时间数组
+ * @returns {string[]}
+ */
+function getRePortRangeArr() {
+    var rePortRange = $('#reportrange span').html();
+    var rePortRangeArr = rePortRange.split(" - ");
+    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
+    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
+    return rePortRangeArr;
+}
+
+
+
+
+/**
+ * 清空查询条件
+ */
+function cleanParams() {
+    $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
+    $("#name").val(null),
+        $("#patientId").val(null),
+        $("#serialNo").val(null),
+        $("#patientId_or_cardNo").val(null)
+}
+
+
+/**
+ * 设置病人药品明细
+ */
+var $table;
+function fitfymx(patientId,times,receiptNo,orderNo,groupNoOut) {
+    var temp = {
+        patientId: patientId,
+        times: times,
+        receiptNo:receiptNo,
+        orderNo:orderNo,
+        groupNoOut:groupNoOut
+    };
+
+    $('#tb_table_right').bootstrapTable("destroy");
+    $table= $('#tb_table_right').bootstrapTable({
+        url: '/thmz/getRefundMedicineDetail',         //请求后台的URL(*)
+        method: 'post',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: temp,           //传递参数(*)
+        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 10,                       //每页的记录行数(*)
+        pageList: [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: [
+            {
+                field: 'drugname',
+                title: '品名',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if (value != null && value != "") {
+                        return value.replace("()","");
+                    }
+                    return "";
+                }
+            }, {
+                field: 'specification',
+                title: '规格',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'quantity',
+                title: '退药量',
+                align: "center",
+                valign: 'middle',
+            }, {
+                field: 'unit_price',
+                title: '单价',
+                align: "center",
+                valign: 'middle',
+            }
+        ],
+        responseHandler: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var ress = eval(res);
+            if (ress.code == -1) {
+                if (ress.message != null && ress.message != '') {
+                    new PNotify({
+                        title: '错误提示',
+                        text: ress.message,
+                        type: 'error',
+                        hide: true,
+                        styling: 'bootstrap3'
+                    });
+                }
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+            return {
+                "total": ress.data.length,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+    });
+
+}
+
+

+ 1 - 1
src/main/resources/static/js/mz/toll_administration.js

@@ -1508,7 +1508,7 @@ function printCommon(url, patientId, times, chargeFeeFlag) {
                     LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
                     LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
                     LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
-                    LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");
+                    LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
                     LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "机制号:");
                     LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
                     LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);

+ 79 - 0
src/main/resources/templates/mz/repeal_refund_medicine.html

@@ -0,0 +1,79 @@
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/bootstrap-select.css"/>
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/daterangepicker.css"/>
+<link rel="stylesheet" href="/thmz/css/custom.min.css">
+<script src="/thmz/js/dependent/bootstrap-select.js"></script>
+<script src="/thmz/js/dependent/daterangepicker.js"></script>
+<script src="/thmz/js/mz/repeal_refund_medicine.js"></script>
+<title>取消退药</title>
+<div class="row" style="height: calc(100% - 60px);overflow-y: auto;">
+    <div class="col-md-12 col-sm-12 col-xs-12">
+        <div class="x_panel">
+            <div class="panel-body">
+                <form id="formSearch" class="form-horizontal" autocomplete="off">
+                    <div class="form-group col-md-12 col-sm-12 col-xs-12">
+                        <div class="col-md-3 col-sm-3 col-xs-12"></div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="name">姓名
+                        </label>
+                        <div class="col-md-2 col-sm-2 col-xs-12">
+                            <input id="name" class="form-control col-md-7 col-xs-12" type="text"
+                                   placeholder="姓名">
+                        </div>
+                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="patientId_or_cardNo">病人ID/就诊卡号
+                        </label>
+                        <div class="col-md-2 col-sm-2 col-xs-12">
+                            <input id="patientId_or_cardNo" class="form-control col-md-7 col-xs-12" type="text"
+                                   onchange="setPatientId()"
+                                   placeholder="病人ID/就诊卡号">
+                            <input id="patientId" type="hidden">
+                        </div>
+                        <div class="col-md-2 col-sm-2 col-xs-12"></div>
+                    </div>
+                    <div class="form-group col-md-12 col-sm-12 col-xs-12">
+                        <div class="col-md-3 col-sm-3 col-xs-12"></div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="serialNo">流水号
+                        </label>
+                        <div class="col-md-1 col-sm-1 col-xs-12">
+                            <input id="serialNo" class="form-control col-md-7 col-xs-12" type="text"
+                                   placeholder="流水号">
+                        </div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="reportrange" > 退药日期
+                        </label>
+                        <div class="col-md-3 col-sm-3 col-xs-12">
+                            <div id="reportrange" class="pull-right"
+                                 style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
+                                <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
+                                <span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
+                            </div>
+                        </div>
+                        <!--<div class="col-md-1 col-sm-1 col-xs-12" style="text-align:left;">-->
+                        <!---->
+                        <!--</div>-->
+                        <div class="col-md-3 col-sm-3 col-xs-12" style="text-align:left;">
+                            <button type="button" style="margin-left:20px" id="btn_clean" class="btn btn-primary"
+                                    title="重置"><i class="fa fa-rotate-left"></i>
+                            </button>
+                            <button type="button" style="margin-left:3px" id="btn_query" class="btn btn-primary"
+                                    title="查询"><i class="fa fa-search"></i>
+                            </button>
+                            <!--<button type="button" style="margin-left:3px" id="btn_save" class="btn btn-primary"-->
+                                    <!--title="退药"><i class="fa fa-check-square-o"></i>-->
+                            <!--</button>-->
+                        </div>
+                    </div>
+                </form>
+            </div>
+
+            <div class="row">
+                <div class="col-md-6 col-sm-6 col-xs-12">
+                    <table id="tb_table"></table>
+                </div>
+                <div class="col-md-6 col-sm-6 col-xs-12">
+                    <table id="tb_table_right"></table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+</div>
+
+