Explorar o código

退号功能开发完成

hurugang %!s(int64=6) %!d(string=hai) anos
pai
achega
46947775db

+ 128 - 8
src/main/java/cn/hnthyy/thmz/controller/MzyReqrecController.java

@@ -3,10 +3,7 @@ package cn.hnthyy.thmz.controller;
 import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
-import cn.hnthyy.thmz.entity.his.Employee;
-import cn.hnthyy.thmz.entity.his.MzPatientMi;
-import cn.hnthyy.thmz.entity.his.MzyReqrec;
-import cn.hnthyy.thmz.entity.his.ResponceType;
+import cn.hnthyy.thmz.entity.his.*;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.*;
@@ -23,10 +20,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -42,6 +36,12 @@ public class MzyReqrecController {
     private ZdUnitCodeService zdUnitCodeService;
     @Autowired
     private EmployeeService employeeService;
+    @Autowired
+    private ZdChequeTypeService zdChequeTypeService;
+    @Autowired
+    private MzZdWorkTimeService mzZdWorkTimeService;
+    @Autowired
+    private MzyZdChargeTypeService mzyZdChargeTypeService;
     /**
      * 保存挂号信息
      * @return
@@ -77,6 +77,11 @@ public class MzyReqrecController {
                 resultMap.put("message", "号别不能为空");
                 return resultMap;
             }
+            if(StringUtils.isBlank(mzyReqrec.getPaymode())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "付款方式不能为空");
+                return resultMap;
+            }
             if(StringUtils.isBlank(mzyReqrecPageDto.getResponceType())){
                 resultMap.put("code", -1);
                 resultMap.put("message", "病人性质不能为空");
@@ -247,6 +252,21 @@ public class MzyReqrecController {
         if(employees!=null){
             employeeMap= employees.stream().collect(Collectors.toMap(Employee::getEmployeeCode, Employee::getEmployeeName));
         }
+        List<ZdChequeType> chequeTypes=zdChequeTypeService.queryAllZdChequeTypeForMz();
+        Map<String, String> chequeTypeMap=null;
+        if(chequeTypes!=null){
+            chequeTypeMap=chequeTypes.stream().collect(Collectors.toMap(ZdChequeType::getCode, ZdChequeType::getName));
+        }
+        List<MzZdWorkTime> workTimes=mzZdWorkTimeService.queryAllMzZdWorkTime();
+        Map<String, String> workTimeMap=null;
+        if(workTimes!=null){
+            workTimeMap=workTimes.stream().collect(Collectors.toMap(MzZdWorkTime::getCode, MzZdWorkTime::getName));
+        }
+        List<MzyZdChargeType> mzyZdChargeTypes=mzyZdChargeTypeService.queryAllMzyZdChargeType();
+        Map<String, String> mzyZdChargeTypeMap=null;
+        if(mzyZdChargeTypes!=null){
+            mzyZdChargeTypeMap=mzyZdChargeTypes.stream().collect(Collectors.toMap(MzyZdChargeType::getCode, MzyZdChargeType::getName));
+        }
         for (MzyReqrec mzyReqrec:mzyReqrecs){
             if(mzyReqrec!=null){
                 mzyReqrec.setUnitCode(zdUnitCodeService.queryDeptNameByIdInCache(mzyReqrec.getUnitCode()));
@@ -254,6 +274,18 @@ public class MzyReqrecController {
                     String doctorCode=employeeMap.get(mzyReqrec.getDoctorCode());
                     mzyReqrec.setDoctorCode(doctorCode==null?"":doctorCode);
                 }
+                if(chequeTypeMap!=null){
+                    String paymode=chequeTypeMap.get(mzyReqrec.getPaymode());
+                    mzyReqrec.setPaymode(paymode==null?"":paymode);
+                }
+                if(workTimeMap!=null){
+                    String workTime=workTimeMap.get(mzyReqrec.getAmpm());
+                    mzyReqrec.setAmpm(workTime==null?"":workTime);
+                }
+                if(mzyZdChargeTypeMap!=null){
+                    String chargeType=mzyZdChargeTypeMap.get(mzyReqrec.getChargeType());
+                    mzyReqrec.setChargeType(chargeType==null?"":chargeType);
+                }
                 MzyReqrecVo mzyReqrecVo = new MzyReqrecVo();
                 mzyReqrecVo.setMzyReqrec(mzyReqrec);
                 if(mzPatientMiMap!=null){
@@ -302,4 +334,92 @@ public class MzyReqrecController {
     }
 
 
+    /**
+     * 根据病人id查询挂号信息
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getMzyReqrecByPatientIdAndTimes", method = {RequestMethod.POST})
+    public Map<String, Object> getMzyReqrecByPatientIdAndTimes(@RequestBody MzyReqrec mzyReqrec) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(mzyReqrec==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "挂号查询参数不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(mzyReqrec.getPatientId())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人id不能为空");
+                return resultMap;
+            }
+            if(mzyReqrec.getTimes()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人挂号次数不能为空");
+                return resultMap;
+            }
+            MzyReqrec result=mzyReqrecService.queryMzyReqrecByPatientIdAndTimes(mzyReqrec.getPatientId(),mzyReqrec.getTimes());
+            if(result!=null){
+                List<MzyReqrecVo> mzyReqrecVos=getMzyReqrecVo(Arrays.asList(result));
+                if(mzyReqrecVos!=null && mzyReqrecVos.size()>0){
+                    resultMap.put("code", 0);
+                    resultMap.put("message", "查询挂号信息成功");
+                    resultMap.put("data", mzyReqrecVos.get(0));
+                    return resultMap;
+                }
+            }
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询挂号信息失败,没有相应的挂号信息");
+            return resultMap;
+        }catch (Exception e){
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询挂号信息失败,系统出错,请联系管理员");
+            log.error("查询挂号信息失败,系统异常,错误信息{}",e.getMessage());
+            return resultMap;
+        }
+    }
+
+
+
+    /**
+     * 更新挂号信息
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/updateReqrec", method = {RequestMethod.POST})
+    public Map<String, Object> updateReqrec(@RequestBody MzyReqrec mzyReqrec) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(mzyReqrec==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新挂号信息参数不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(mzyReqrec.getPatientId())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人id不能为空");
+                return resultMap;
+            }
+            if(mzyReqrec.getTimes()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人挂号次数不能为空");
+                return resultMap;
+            }
+            int num=mzyReqrecService.modifyMzyReqrec(mzyReqrec);
+            if(num==1){
+                resultMap.put("code", 0);
+                resultMap.put("message", "更新挂号信息成功");
+                return resultMap;
+            }
+            resultMap.put("code", -1);
+            resultMap.put("message", "更新挂号信息失败");
+            return resultMap;
+        }catch (Exception e){
+            resultMap.put("code", -1);
+            resultMap.put("message", "更新挂号信息失败,系统出错,请联系管理员");
+            log.error("更新挂号信息失败,系统异常,错误信息{}",e.getMessage());
+            return resultMap;
+        }
+    }
+
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzVisitTableMapper.java

@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.entity.his.MzVisitTable;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 /**
  * 门诊就诊信息表Mapper
@@ -33,4 +34,21 @@ public interface MzVisitTableMapper {
             "#{opDay,jdbcType=TIMESTAMP},#{reqDeptCode,jdbcType=INTEGER},#{reqDoctor,jdbcType=INTEGER},#{windowsNo,jdbcType=TINYINT},#{firstOrNot,jdbcType=CHAR}," +
             "#{receiveFlag,jdbcType=CHAR},#{sickDate,jdbcType=TIMESTAMP},#{icdText,jdbcType=CHAR},#{symptom,jdbcType=VARCHAR},#{jzFlag,jdbcType=CHAR},#{responceType,jdbcType=VARCHAR},#{dwmc,jdbcType=VARCHAR},#{ghSerialNo,jdbcType=INTEGER})")
     int insertMzVisitTable(MzVisitTable mzVisitTable);
+
+
+    /**
+     * 修改门诊就诊信息
+     *
+     * @param mzVisitTable
+     * @return
+     */
+    @Update({"<script>",
+            "update mz_visit_table ",
+            "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times}' >",
+            "<when test='cancelMark!=null'>",
+            "cancel_mark =#{cancelMark,jdbcType=CHAR}",
+            "</when>",
+            "</trim>"
+            , "</script>"})
+    int updateMzVisitTable(MzVisitTable mzVisitTable);
 }

+ 57 - 36
src/main/java/cn/hnthyy/thmz/mapper/his/MzyReqrecMapper.java

@@ -25,6 +25,7 @@ public interface MzyReqrecMapper {
 
     /**
      * 根据病人编号查询最后一次挂号信息
+     *
      * @param patientId
      * @return
      */
@@ -34,47 +35,49 @@ public interface MzyReqrecMapper {
 
     /**
      * 查询符合条件的挂号数据总数
+     *
      * @param mzyReqrecPageDto
      * @return
      */
     @Select({"<script>",
             "select count(*) from mzy_reqrec  where times >0 ",
-                "<when test='mzyReqrec.unitCode!=null'>",
-                   " and unit_code =#{mzyReqrec.unitCode,jdbcType=CHAR}",
-                "</when>",
-                "<when test='mzyReqrec.doctorCode!=null'>",
-                   " and doctor_code =#{mzyReqrec.doctorCode,jdbcType=CHAR}",
-                "</when>",
-                "<when test='mzyReqrec.name!=null'>",
-                   " and name like #{mzyReqrec.name,jdbcType=CHAR}",
-                "</when>",
-                "<when test='mzyReqrec.visitedMark!=null'>",
-                   " and visited_mark =#{mzyReqrec.visitedMark,jdbcType=CHAR}",
-                "</when>",
-                "<when test='mzyReqrec.cancelMark!=null'>",
-                   " and cancel_mark =#{mzyReqrec.cancelMark,jdbcType=CHAR}",
-                "</when>",
-                "<when test='beginTime!=null'>",
-                   " and request_day &gt;=#{beginTime,jdbcType=TIMESTAMP}",
-                "</when>",
-                "<when test='endTime!=null'>",
-                   " and request_day &lt;=#{endTime,jdbcType=TIMESTAMP}",
-                "</when>",
+            "<when test='mzyReqrec.unitCode!=null'>",
+            " and unit_code =#{mzyReqrec.unitCode,jdbcType=CHAR}",
+            "</when>",
+            "<when test='mzyReqrec.doctorCode!=null'>",
+            " and doctor_code =#{mzyReqrec.doctorCode,jdbcType=CHAR}",
+            "</when>",
+            "<when test='mzyReqrec.name!=null'>",
+            " and name like #{mzyReqrec.name,jdbcType=CHAR}",
+            "</when>",
+            "<when test='mzyReqrec.visitedMark!=null'>",
+            " and visited_mark =#{mzyReqrec.visitedMark,jdbcType=CHAR}",
+            "</when>",
+            "<when test='mzyReqrec.cancelMark!=null'>",
+            " and cancel_mark =#{mzyReqrec.cancelMark,jdbcType=CHAR}",
+            "</when>",
+            "<when test='beginTime!=null'>",
+            " and request_day &gt;=#{beginTime,jdbcType=TIMESTAMP}",
+            "</when>",
+            "<when test='endTime!=null'>",
+            " and request_day &lt;=#{endTime,jdbcType=TIMESTAMP}",
+            "</when>",
             "</script>"})
     int countMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto);
 
     /**
      * 分页查询挂号信息
+     *
      * @param mzyReqrecPageDto
      * @return
      */
     @Select({"<script>",
-            "select top ${pageSize} rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code," ,
-                    "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark," ,
-                    "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date," ,
-                    "rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept," ,
-                    "visit_doctor,visit_date,paymode,psordnum,agtordnum   FROM (SELECT ROW_NUMBER() OVER (ORDER BY mzy_reqrec_page.request_day desc) AS RowNumber," ,
-                    "* from dbo.mzy_reqrec mzy_reqrec_page where times >0 ",
+            "select top ${pageSize} rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code,",
+            "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark,",
+            "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date,",
+            "rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept,",
+            "visit_doctor,visit_date,paymode,psordnum,agtordnum   FROM (SELECT ROW_NUMBER() OVER (ORDER BY mzy_reqrec_page.request_day desc) AS RowNumber,",
+            "* from dbo.mzy_reqrec mzy_reqrec_page where times >0 ",
             "<when test='mzyReqrec.unitCode!=null'>",
             " and unit_code =#{mzyReqrec.unitCode,jdbcType=CHAR}",
             "</when>",
@@ -102,29 +105,47 @@ public interface MzyReqrecMapper {
 
     /**
      * 查询所有退号信息
+     *
      * @return
      */
     @Select({"<script>",
-            "select rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code," ,
-            "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark," ,
-            "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date," ,
-            "rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept," ,
-            "visit_doctor,visit_date,paymode,psordnum,agtordnum   from dbo.mzy_reqrec where cancel_mark=1" ,
+            "select rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code,",
+            "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark,",
+            "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date,",
+            "rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept,",
+            "visit_doctor,visit_date,paymode,psordnum,agtordnum   from dbo.mzy_reqrec where cancel_mark=1",
             "</script>"})
     List<MzyReqrec> selectAllCancel();
 
     /**
      * 修改挂号信息
+     *
      * @param mzyReqrec
      * @return
      */
     @Update({"<script>",
             "update mzy_reqrec ",
             "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times}' >",
-                "<when test='cancelMark!=null'>",
-                    "cancel_mark =#{cancelMark,jdbcType=CHAR}",
-                "</when>",
+            "<when test='cancelMark!=null'>",
+            "cancel_mark =#{cancelMark,jdbcType=CHAR}",
+            "</when>",
             "</trim>"
-            ,"</script>"})
+            , "</script>"})
     int updateMzyReqrec(MzyReqrec mzyReqrec);
+
+    /**
+     * 按照病人id 和次数查询病人挂号信息
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,rtrim(name) name,rtrim(req_type) req_type,request_day,rtrim(ampm) ampm,rtrim(unit_code) unit_code,",
+            "rtrim(group_code) group_code,rtrim(doctor_code) doctor_code,rtrim(charge_type) charge_type,req_order,req_fee,oth_fee,rtrim(cancel_mark) cancel_mark,",
+            "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date,",
+            "rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept,",
+            "visit_doctor,visit_date,paymode,psordnum,agtordnum   from dbo.mzy_reqrec where patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER}",
+            "</script>"})
+    MzyReqrec selectMzyReqrecByPatientIdAndTimes(@Param("patientId") String patientId, @Param("times") Integer times);
 }

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

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.mapper.his;
 
 import cn.hnthyy.thmz.entity.his.ZdChequeType;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -19,4 +20,12 @@ public interface ZdChequeTypeMapper {
      */
     @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type where zy_flag =0")
     List<ZdChequeType> selectAllZdChequeTypeForZy();
+
+    /**
+     * 按照支付方式编码查询支付方式
+     * @param code
+     * @return
+     */
+    @Select("select rtrim(code) code,rtrim(name) name,mz_flag,zy_flag from zd_cheque_type where code =#{code}")
+    ZdChequeType selectChequeTypeByCode(@Param("code") String code);
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/his/MzZdWorkTimeService.java

@@ -6,7 +6,7 @@ import java.util.List;
 
 public interface MzZdWorkTimeService {
     /**
-     * 查询所有在使用中的时间区间
+     * 查询所有在使用中的时间区间 号段
      * @return
      */
     List<MzZdWorkTime> queryAllMzZdWorkTime();

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

@@ -40,4 +40,13 @@ public interface MzyReqrecService {
      * @return
      */
     int modifyMzyReqrec(MzyReqrec mzyReqrec);
+
+    /**
+     * 按照病人id 和次数查询病人挂号信息
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    MzyReqrec queryMzyReqrecByPatientIdAndTimes(String patientId, Integer times);
 }

+ 7 - 0
src/main/java/cn/hnthyy/thmz/service/his/ZdChequeTypeService.java

@@ -16,4 +16,11 @@ public interface ZdChequeTypeService {
      * @return
      */
     List<ZdChequeType> queryAllZdChequeTypeForZy();
+
+    /**
+     * 按照支付方式编码查询支付方式
+     * @param code
+     * @return
+     */
+    ZdChequeType queryChequeTypeByCode(String code);
 }

+ 15 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -106,7 +106,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         mzyReqrec.setDoctorCode(mzyRequest.getDoctorCode()==null?"":mzyRequest.getDoctorCode());
         mzyReqrec.setReqType("0");
         mzyReqrec.setRequestDay(now);
-        mzyReqrec.setOthFee(BigDecimal.ZERO);
+        mzyReqrec.setOthFee(mzyRequest.getCheckFee());
         mzyReqrec.setPlusMark(YesNoEnum.NO.code);
         mzyReqrec.setPrintFlag(YesNoEnum.NO.code.toString());
         mzyReqrec.setDcountNo(YesNoEnum.NO.code);
@@ -131,7 +131,21 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     }
 
     @Override
+    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
     public int modifyMzyReqrec(MzyReqrec mzyReqrec) {
+        if(YesNoEnum.YES.code.equals(mzyReqrec.getCancelMark())){
+            //此时是退号,需要把就诊信息也标记成退号
+            MzVisitTable mzVisitTable = new MzVisitTable();
+            mzVisitTable.setPatientId(mzyReqrec.getPatientId());
+            mzVisitTable.setTimes(mzyReqrec.getTimes());
+            mzVisitTable.setCancelMark(mzyReqrec.getCancelMark());
+            mzVisitTableMapper.updateMzVisitTable(mzVisitTable);
+        }
         return mzyReqrecMapper.updateMzyReqrec(mzyReqrec);
     }
+
+    @Override
+    public MzyReqrec queryMzyReqrecByPatientIdAndTimes(String patientId, Integer times) {
+        return mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(patientId,times);
+    }
 }

+ 7 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/ZdChequeTypeServiceImpl.java

@@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+
 @Service
 public class ZdChequeTypeServiceImpl implements ZdChequeTypeService {
     @SuppressWarnings("all")
     @Autowired
     private ZdChequeTypeMapper zdChequeTypeMapper;
+
     @Override
     public List<ZdChequeType> queryAllZdChequeTypeForMz() {
         return zdChequeTypeMapper.selectAllZdChequeTypeForMz();
@@ -21,4 +23,9 @@ public class ZdChequeTypeServiceImpl implements ZdChequeTypeService {
     public List<ZdChequeType> queryAllZdChequeTypeForZy() {
         return zdChequeTypeMapper.selectAllZdChequeTypeForZy();
     }
+
+    @Override
+    public ZdChequeType queryChequeTypeByCode(String code) {
+        return zdChequeTypeMapper.selectChequeTypeByCode(code);
+    }
 }

+ 3 - 3
src/main/resources/static/css/registration.css

@@ -148,8 +148,8 @@
 .patient-card-main-left div:last-child {
     color: #fff !important;
     height: calc(25% - 15px);
-    width: calc(100% - 40px);
-    margin-left: 20px;
+    width: calc(100% - 30px);
+    margin-left: 15px;
     background: rgba(0, 0, 0, .17);
     vertical-align: middle;
     text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
@@ -161,7 +161,7 @@
 }
 
 .patient-card-main-right div.el-row {
-    height: 20%;
+    height: 18%;
 }
 
 .patient-card-foot {

+ 132 - 27
src/main/resources/static/js/registration.js

@@ -21,7 +21,7 @@ var TableInit = function () {
             pagination: false,                   //是否显示分页(*)
             sortable: true,                     //是否启用排序
             sortOrder: "asc",                   //排序方式
-            queryParams: oTableInit.queryParams,//传递参数(*)
+            //queryParams: oTableInit.queryParams,//传递参数(*)
             sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
             pageNumber: 1,                       //初始化加载第一页,默认第一页
             pageSize: 10,                       //每页的记录行数(*)
@@ -50,19 +50,19 @@ var TableInit = function () {
                     title: '名称',
                     align: "center",
                     valign: 'middle',
-                    sortable: true
+                    //sortable: true
                 }, {
                     field: 'money',
                     title: '金额(元)',
                     align: "center",
                     valign: 'middle',
-                    sortable: true
+                    //sortable: true
                 }, {
                     field: 'moneyReceived',
                     title: '实收金额(元)',
                     align: "center",
                     valign: 'middle',
-                    sortable: true
+                   // sortable: true
                 }],
             responseHandler: function (res) {
                 if (res == '401' || res == 401) {
@@ -75,7 +75,7 @@ var TableInit = function () {
                         title: '错误提示',
                         text: ress.message,
                         type: 'error',
-                        hide: false,
+                        hide: true,
                         styling: 'bootstrap3'
                     });
                     return {
@@ -90,16 +90,6 @@ var TableInit = function () {
             },
         });
     };
-
-    //得到查询的参数
-    oTableInit.queryParams = function (params) {
-        var temp = {   //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
-            pageSize: params.limit,   //页面大小
-            pageIndex: params.offset / params.limit,  //页码
-            orderByCase: $("#orderByCase").val()
-        };
-        return temp;
-    };
     return oTableInit;
 };
 
@@ -305,7 +295,7 @@ function initResponceTypeSelect() {
                     title: '错误提示',
                     text: res.message,
                     type: 'error',
-                    hide: false,
+                    hide: true,
                     styling: 'bootstrap3'
                 });
             }
@@ -592,7 +582,7 @@ function editUserModal(data) {
                     title: '错误提示',
                     text: res.message,
                     type: 'error',
-                    hide: false,
+                    hide: true,
                     styling: 'bootstrap3'
                 });
             }
@@ -602,9 +592,61 @@ function editUserModal(data) {
 
 /**
  * 打开退费信息窗口
- * @param data
+ * @param patientId
+ * @param times
  */
-function backNoModal(data) {
+function backNoModal(patientId,times) {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getMzyReqrecByPatientIdAndTimes',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({"patientId": patientId,"times": times}),
+        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) {
+                    $("#backNoPatientId").val(patientId);
+                    $("#backNoTimes").val(times);
+                    $("#backNoSickName").text(res.data.mzyReqrec.name);
+                    $("#backNoPayType").text(res.data.mzyReqrec.paymode);
+                    $("#backNoPhone").text(res.data.mzPatientMi.phoneNo);
+                    $("#backNoAmpm").text(res.data.mzyReqrec.ampm);
+                    $("#backNoDeptName").text(res.data.mzyReqrec.unitCode);
+                    $("#backNoChargeType").text(res.data.mzyReqrec.chargeType);
+                    $("#backNoDoctorName").text(res.data.mzyReqrec.doctorCode);
+                    $("#backNoRegiDate").text(format(res.data.mzyReqrec.requestDay, "yyyy-MM-dd HH:mm:ss"));
+                    var index = 0;
+                    var trHtml='';
+                    if(res.data.mzyReqrec.reqFee!=null && res.data.mzyReqrec.reqFee!="" && res.data.mzyReqrec.reqFee>0){
+                        trHtml='<tr data-index="'+index+'"><td class="bs-checkbox "><label><input data-index="'+index+'" name="btSelectItem" type="checkbox"><span></span></label></td><td style="text-align: center; vertical-align: middle; ">挂号费</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.reqFee+'</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.reqFee+'</td></tr>';
+                        index++;
+                    }
+                    if(res.data.mzyReqrec.clinicFee!=null && res.data.mzyReqrec.clinicFee!="" && res.data.mzyReqrec.clinicFee>0){
+                        trHtml+='<tr data-index="'+index+'"><td class="bs-checkbox "><label><input data-index="'+index+'" name="btSelectItem" type="checkbox"><span></span></label></td><td style="text-align: center; vertical-align: middle; ">诊查费</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.clinicFee+'</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.clinicFee+'</td></tr>';
+                        index++;
+                    }
+                    if(res.data.mzyReqrec.othFee!=null && res.data.mzyReqrec.othFee!="" && res.data.mzyReqrec.othFee>0){
+                        trHtml+='<tr data-index="'+index+'"><td class="bs-checkbox "><label><input data-index="'+index+'" name="btSelectItem" type="checkbox"><span></span></label></td><td style="text-align: center; vertical-align: middle; ">检查费</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.othFee+'</td><td style="text-align: center; vertical-align: middle; ">'+res.data.mzyReqrec.othFee+'</td></tr>';
+                    }
+                    $("#tb_fee_info").find("tbody").empty();
+                    $("#tb_fee_info").find("tbody").append(trHtml);
+                }
+            } else {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
     $("#backNoModal").modal();
 }
 
@@ -715,7 +757,7 @@ function queryUserInfoByCardNo() {
                         title: '错误提示',
                         text: res.message,
                         type: 'error',
-                        hide: false,
+                        hide: true,
                         styling: 'bootstrap3'
                     });
                 }
@@ -912,6 +954,9 @@ function refeshPatinetListScrollEvent() {
  * @param patientId
  */
 function fillPatinet(patientId) {
+    if(patientId==null || patientId==""){
+        return;
+    }
     $.ajax({
         type: "GET",
         url: '/thmz/getByPatientId?patientId=' + patientId,
@@ -963,7 +1008,7 @@ function fillPatinet(patientId) {
                     title: '错误提示',
                     text: res.message,
                     type: 'error',
-                    hide: false,
+                    hide: true,
                     styling: 'bootstrap3'
                 });
             }
@@ -1225,7 +1270,8 @@ function saveMzyReqrec() {
                 "patientId": $("#patientId").val(),
                 "ampm": $("#ampm").val(),
                 "unitCode": $("#deptNo").val(),
-                "chargeType": $("#chargeType").val()
+                "chargeType": $("#chargeType").val(),
+                "paymode": $("#payType").val()
             }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -1478,9 +1524,15 @@ function loadCardList() {
                         sex = "女";
                         html += '<img src="/thmz/images/girl.png"/>';
                     }
-                    html += '</div><div class="el-row" title="' + mzyReqrecVo.mzyReqrec.name + '">' + mzyReqrecVo.mzyReqrec.name + '</div><div class="el-row">' + mzyReqrecVo.mzPatientMi.responseType + '</div></div><div class="patient-card-main-right"><div></div> <div class="el-row"><label>';
+                    html += '</div><div class="el-row" title="' + mzyReqrecVo.mzyReqrec.name + '">' + mzyReqrecVo.mzyReqrec.name + '</div>';
+                    if(mzyReqrecVo.mzPatientMi.responseType.length>2){
+                        html +='<div class="el-row" style="font-size: 1px;height: 25%;">';
+                    }else {
+                        html +='<div class="el-row" style="font-size: 1px;">';
+                    }
+                    html+=mzyReqrecVo.mzPatientMi.responseType + '</div></div><div class="patient-card-main-right"><div></div> <div class="el-row"><label>';
                     html += text;
-                    html += '</div><div class="el-row" title="' + mzyReqrecVo.mzPatientMi.phoneNo + '">' + sex + ' / ' + mzyReqrecVo.mzPatientMi.age + '岁 / ' + mzyReqrecVo.mzPatientMi.phoneNo + '</div><div class="el-row" title="' + mzyReqrecVo.mzyReqrec.doctorCode + '">' + mzyReqrecVo.mzyReqrec.unitCode + ' / ' + mzyReqrecVo.mzyReqrec.doctorCode + '</div><div class="el-row">' + format(mzyReqrecVo.mzyReqrec.requestDay, "yyyy-MM-dd HH:mm:ss") + '</div></div></div>';
+                    html += '</div><div class="el-row" title="' + mzyReqrecVo.mzPatientMi.phoneNo + '">' + sex + ' / ' + mzyReqrecVo.mzPatientMi.age + '岁 / ' + mzyReqrecVo.mzPatientMi.phoneNo + '</div><div class="el-row" title="' + mzyReqrecVo.mzyReqrec.ampm + '">' + mzyReqrecVo.mzyReqrec.ampm + ' / ' + mzyReqrecVo.mzyReqrec.chargeType + '</div><div class="el-row" title="' + mzyReqrecVo.mzyReqrec.chargeType + '">' + mzyReqrecVo.mzyReqrec.unitCode + ' / ' + mzyReqrecVo.mzyReqrec.doctorCode + '</div><div class="el-row">' + format(mzyReqrecVo.mzyReqrec.requestDay, "yyyy-MM-dd HH:mm:ss") + '</div></div></div>';
                     if (mzyReqrecVo.mzyReqrec.cancelMark == 1 || mzyReqrecVo.mzyReqrec.visitedMark == 1) {
                         html += '<div class="patient-card-foot">' +
                             '                        <div class="col-md-3 col-sm-3 col-xs-12">' +
@@ -1524,7 +1576,7 @@ function loadCardList() {
                             '                        </div>' +
                             '                        <div class="col-md-3 col-sm-3 col-xs-12">' +
                             '                            <button type="button" class="registration-no-color-foot-button"' +
-                            '                                    title="退号" onclick="backNoModal(this)">' +
+                            '                                    title="退号" onclick="backNoModal(\''+mzyReqrecVo.mzyReqrec.patientId+'\','+mzyReqrecVo.mzyReqrec.times+')">' +
                             '                                <i class="fa fa-minus-square-o"></i>' +
                             '                            </button>' +
                             '                        </div>' +
@@ -1641,12 +1693,24 @@ function loadTableList() {
                         }
                         return text;
                     }
+                }, {
+                    field: 'mzyReqrec.ampm',
+                    title: '号段',
+                    align: "center",
+                    valign: 'middle',
+                    // sortable: true
                 }, {
                     field: 'mzyReqrec.unitCode',
                     title: '挂号科室',
                     align: "center",
                     valign: 'middle',
                     // sortable: true
+                }, {
+                    field: 'mzyReqrec.chargeType',
+                    title: '号别',
+                    align: "center",
+                    valign: 'middle',
+                    // sortable: true
                 }, {
                     field: 'mzyReqrec.doctorCode',
                     title: '挂号医生',
@@ -1671,7 +1735,7 @@ function loadTableList() {
                         if (row.mzyReqrec.cancelMark == 1 || row.mzyReqrec.visitedMark == 1) {
                             return '<button type="button" class="can-not-used" title="修改挂号"><i class="fa fa-edit"></i></button><button type="button" class="registration-no-color-foot-button"title="修改患者" onclick="editUserModal(\'' + row.mzyReqrec.patientId + '\')"><i class="fa fa-user"></i></button><button type="button" class="can-not-used" title="退号"><i class="fa fa-minus-square-o"></i></button><button type="button" class="registration-no-color-foot-button" title="打印" onclick="printOrPreviewModal(this)"><i class="fa fa-print"></i></button>';
                         }else {
-                            return '<button type="button" class="registration-no-color-foot-button" title="修改挂号" onclick="editRegistration(this)"><i class="fa fa-edit"></i></button><button type="button" class="registration-no-color-foot-button"title="修改患者" onclick="editUserModal(\'' + row.mzyReqrec.patientId + '\')"><i class="fa fa-user"></i></button><button type="button" class="registration-no-color-foot-button" title="退号" onclick="backNoModal(this)"><i class="fa fa-minus-square-o"></i></button><button type="button" class="registration-no-color-foot-button" title="打印" onclick="printOrPreviewModal(this)"><i class="fa fa-print"></i></button>';
+                            return '<button type="button" class="registration-no-color-foot-button" title="修改挂号" onclick="editRegistration(this)"><i class="fa fa-edit"></i></button><button type="button" class="registration-no-color-foot-button"title="修改患者" onclick="editUserModal(\'' + row.mzyReqrec.patientId + '\')"><i class="fa fa-user"></i></button><button type="button" class="registration-no-color-foot-button" title="退号" onclick="backNoModal(\''+row.mzyReqrec.patientId+'\','+row.mzyReqrec.times+')"><i class="fa fa-minus-square-o"></i></button><button type="button" class="registration-no-color-foot-button" title="打印" onclick="printOrPreviewModal(this)"><i class="fa fa-print"></i></button>';
                         }
                     }
                 }],
@@ -1686,7 +1750,7 @@ function loadTableList() {
                         title: '错误提示',
                         text: ress.message,
                         type: 'error',
-                        hide: false,
+                        hide: true,
                         styling: 'bootstrap3'
                     });
                     return {
@@ -1825,4 +1889,45 @@ function clearParams() {
     $("#deptNoParam").selectpicker('refresh');
     $("#userNameParam").val(null);
     $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
+}
+
+
+/**
+ * 保存退号信息
+ */
+function saveBackNo() {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/updateReqrec',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({"patientId": $("#backNoPatientId").val(),"times": $("#backNoTimes").val(),"cancelMark":1}),
+        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) {
+                new PNotify({
+                    title: '操作提示',
+                    text: res.message,
+                    type: 'success',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+                loadTableCount();
+                loadRegistrationList(true);
+                $("#backNoModal").modal("hide");
+            } else {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
 }

+ 20 - 12
src/main/resources/templates/registration.html

@@ -204,7 +204,7 @@
             </div>
             <div class="item form-group thmz_alert">
                 <div class="col-md-6 col-sm-6 col-xs-12 item">
-                    <label class="control-label col-md-4 col-sm-4 col-xs-12" for="ampm">时间区间 <span
+                    <label class="control-label col-md-4 col-sm-4 col-xs-12" for="ampm">号段 <span
                             class="required">*</span>
                     </label>
                     <div class="col-md-8 col-sm-8 col-xs-12">
@@ -821,7 +821,7 @@
 <!--挂号管理【退号】弹窗开始-->
 <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="backNoModal">
     <div class="modal-dialog modal-lg">
-        <div class="modal-content" style="width: 680px;">
+        <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>
@@ -841,31 +841,39 @@
                     <div class="item form-group"
                          style="margin-left: 10px;border: 1px solid #ddd;padding-top: 20px;padding-bottom: 20px;">
                         <div class="col-md-12 col-sm-12 col-xs-12">
+                            <div class="col-md-2 col-sm-2 col-xs-12">
+                                患者:<span id="backNoSickName" style="color: #2e69eb;"></span>
+                                <input type="hidden" id="backNoPatientId"/>
+                                <input type="hidden" id="backNoTimes"/>
+                            </div>
                             <div class="col-md-3 col-sm-3 col-xs-12">
-                                患者:<span id="backNoSickName" style="color: #2e69eb;">林彦韦</span>
+                                付款方式:<span id="backNoPayType"></span>
                             </div>
                             <div class="col-md-3 col-sm-3 col-xs-12">
-                                付款方式:<span id="backNoPayType">现金</span>
+                                号段:<span id="backNoAmpm"></span>
                             </div>
-                            <div class="col-md-6 col-sm-6 col-xs-12">
-                                手机号:<span id="backNoPhone">12345678903</span>
+                            <div class="col-md-4 col-sm-4 col-xs-12">
+                                手机号:<span id="backNoPhone"></span>
                             </div>
                         </div>
                         <div class="col-md-12 col-sm-12 col-xs-12" style="margin-top: 10px;">
+                            <div class="col-md-2 col-sm-2 col-xs-12">
+                                科室:<span id="backNoDeptName"></span>
+                            </div>
                             <div class="col-md-3 col-sm-3 col-xs-12">
-                                科室:<span id="backNoDeptName">挂号室</span>
+                                号别:<span id="backNoChargeType"></span>
                             </div>
                             <div class="col-md-3 col-sm-3 col-xs-12">
-                                医生:<span id="backNoDoctorName">云医生</span>
+                                医生:<span id="backNoDoctorName"></span>
                             </div>
-                            <div class="col-md-6 col-sm-6 col-xs-12">
-                                挂号时间:<span id="backNoRegiDate">2019-07-09 09:18:27</span>
+                            <div class="col-md-4 col-sm-4 col-xs-12">
+                                挂号时间:<span id="backNoRegiDate"></span>
                             </div>
                         </div>
                     </div>
                     <div class="item form-group">
                         <div class="col-md-6 col-sm-6 col-xs-12">
-                            <button type="button" style="cursor: default;margin-bottom: 10px !important;"
+                            <button type="button" style="cursor: default;margin-top: 10px !important;"
                                     class="btn btn-primary">
                                 收费信息
                             </button>
@@ -880,7 +888,7 @@
                 <div style="float: left;margin-left: 10px;">
                     <input type="checkbox"/>&nbsp;&nbsp;打印
                 </div>
-                <button type="button" class="btn btn-primary" id="saveBackNo">保存</button>
+                <button type="button" class="btn btn-primary" id="saveBackNo" onclick="saveBackNo();">保存</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
             </div>
         </div>