瀏覽代碼

医技预约排班开发

hurugang 5 年之前
父節點
當前提交
cd3ae871ca

+ 66 - 0
src/main/java/cn/hnthyy/thmz/Utils/DateUtil.java

@@ -1,7 +1,9 @@
 package cn.hnthyy.thmz.Utils;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 
+import java.sql.Timestamp;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -212,6 +214,33 @@ public class DateUtil {
         return result;
     }
 
+
+    /**
+     * 获取两个日期之间的所有日期集合 字符串类型
+     * @param start
+     * @param end
+     * @return
+     */
+    public static List<String> getBetweenDatesDesc(Date start, Date end) {
+        List<String> result = new ArrayList<>();
+        Calendar tempStart = Calendar.getInstance();
+        tempStart.setTime(start);
+        tempStart.add(Calendar.DAY_OF_YEAR, 1);
+
+        Calendar tempEnd = Calendar.getInstance();
+        tempEnd.setTime(end);
+        result.add(DateFormatUtils.format(start, "yyyy-MM-dd"));
+        while (tempStart.before(tempEnd)) {
+            result.add(DateFormatUtils.format(tempStart.getTime(), "yyyy-MM-dd"));
+            tempStart.add(Calendar.DAY_OF_YEAR, 1);
+        }
+        String endStr = DateFormatUtils.format(end, "yyyy-MM-dd");
+        if(!result.contains(endStr)){
+            result.add(endStr);
+        }
+        return result;
+    }
+
     /**
      * 判断是否是中午
      * @param currentTime
@@ -220,4 +249,41 @@ public class DateUtil {
     public static int IsAfternoon(int currentTime) {
         return currentTime - 12;
     }
+
+
+
+
+
+    /**
+     * 判断日期数组中是否有重复的日期
+     * @param periodStart
+     * @param periodend
+     * @return
+     */
+    public static boolean isOverlap(List<Timestamp> periodStart,List<Timestamp> periodend){
+        /**
+         * 两两循环比较
+         */
+        for (int i = 0; i < periodStart.size()-1; i++) {
+            Timestamp start0 = periodStart.get(i);
+            Timestamp end0 = periodend.get(i);
+            for (int j = i+1; j < periodStart.size(); j++) {
+                Timestamp start = periodStart.get(j);
+                Timestamp end = periodend.get(j);
+                if(start0.compareTo(end)>=0 || end0.compareTo(start)<=0){
+                    /**
+                     * 说明不重复。
+                     * 思路:该时间段的开始时间如何大于另个一个时间段的结束时间,那么这个两个时间段不会有重叠;
+                     * 如果该时间段的结束时间小于另一个时间段的时间,那么这个两个时间段也不会有重叠。
+                     */
+                    continue;
+                }else{
+                    //说明该时间段重复
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 }

+ 234 - 0
src/main/java/cn/hnthyy/thmz/controller/ScheduleOfMedicalController.java

@@ -0,0 +1,234 @@
+package cn.hnthyy.thmz.controller;
+
+import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.thmz.ScheduleOfMedical;
+import cn.hnthyy.thmz.entity.thmz.User;
+import cn.hnthyy.thmz.service.his.ZdUnitCodeService;
+import cn.hnthyy.thmz.service.thmz.ScheduleOfMedicalService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Slf4j
+@RestController
+public class ScheduleOfMedicalController {
+    @Autowired
+    private ScheduleOfMedicalService scheduleOfMedicalService;
+    @Autowired
+    private ZdUnitCodeService zdUnitCodeService;
+    /**
+     * 保存医技排班
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveScheduleOfMedical", method = {RequestMethod.POST})
+    public Map<String, Object> saveScheduleOfMedical(@RequestBody ScheduleOfMedical scheduleOfMedical, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (scheduleOfMedical == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,参数为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(scheduleOfMedical.getRecordDate())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,日期为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(scheduleOfMedical.getDepNo())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,科室为空");
+                return resultMap;
+            }
+            if(scheduleOfMedical.getRoomNum()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,诊室为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(scheduleOfMedical.getBeginTime())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,开始时间为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(scheduleOfMedical.getEndTime())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存医技排班失败,结束时间为空");
+                return resultMap;
+            }
+            ScheduleOfMedical scheduleOfMedicalParmas = new ScheduleOfMedical();
+            scheduleOfMedicalParmas.setRecordDate(scheduleOfMedical.getRecordDate());
+            scheduleOfMedicalParmas.setDepNo(scheduleOfMedical.getDepNo());
+            scheduleOfMedicalParmas.setRoomNum(scheduleOfMedical.getRoomNum());
+            List<ScheduleOfMedical> scheduleOfMedicals=scheduleOfMedicalService.queryByCommonParams(scheduleOfMedicalParmas);
+            if(scheduleOfMedicals!=null && scheduleOfMedicals.size()>0){
+                List<Timestamp> periodStart = new ArrayList<>();
+                List<Timestamp> periodend = new ArrayList<>();
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                StringBuffer sbf = new StringBuffer();
+                for (ScheduleOfMedical sc:scheduleOfMedicals){
+                    sbf.append(sc.getRecordDate()).append(" ").append(sc.getBeginTime()).append(":00");
+                    periodStart.add(new Timestamp(sdf.parse(sbf.toString()).getTime()));
+                    sbf.setLength(0);
+                    sbf.append(sc.getRecordDate()).append(" ").append(sc.getEndTime()).append(":00");
+                    periodend.add(new Timestamp(sdf.parse(sbf.toString()).getTime()));
+                    sbf.setLength(0);
+                }
+                sbf.append(scheduleOfMedical.getRecordDate()).append(" ").append(scheduleOfMedical.getBeginTime()).append(":00");
+                periodStart.add(new Timestamp(sdf.parse(sbf.toString()).getTime()));
+                sbf.setLength(0);
+                sbf.append(scheduleOfMedical.getRecordDate()).append(" ").append(scheduleOfMedical.getEndTime()).append(":00");
+                periodend.add(new Timestamp(sdf.parse(sbf.toString()).getTime()));
+                sbf.setLength(0);
+                boolean isOverlap= DateUtil.isOverlap(periodStart,periodend);
+                if(isOverlap){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "保存医技排班数据失败,当前新增的排班时间范围与该科室已存在档期有重叠,请调整后重试!");
+                    return resultMap;
+                }
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            resultMap.put("code", 0);
+            resultMap.put("message", "保存医技排班数据成功");
+            scheduleOfMedicalService.saveScheduleOfMedical(scheduleOfMedical,tokenUser.getId());
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("保存医技排班数据失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "保存医技排班数据失败");
+            return resultMap;
+        }
+    }
+
+
+    /**
+     * 根据id查询医技预约排班
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getScheduleOfMedicalById", method = {RequestMethod.GET})
+    public Map<String, Object> getScheduleOfMedicalById(@RequestParam("id") Long id) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (id == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询医技预约排班失败,参数为空");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "根查询医技预约排班成功");
+            ScheduleOfMedical scheduleOfMedical=scheduleOfMedicalService.queryScheduleOfMedicalById(id);
+            resultMap.put("data", scheduleOfMedical);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("根据id查询医技预约排班失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "根据id查询医技预约排班失败");
+            return resultMap;
+        }
+    }
+
+
+
+    /**
+     * 删除id查询医技预约排班
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/removeScheduleOfMedicalById", method = {RequestMethod.GET})
+    public Map<String, Object> removeScheduleOfMedicalById(@RequestParam("id") Long id) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (id == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "删除id查询医技预约排班失败,参数为空");
+                return resultMap;
+            }
+
+            int num =scheduleOfMedicalService.removeScheduleOfMedical(id);
+            if(num==1){
+                resultMap.put("code", 0);
+                resultMap.put("message", "删除医技预约排班成功");
+                return resultMap;
+            }
+            resultMap.put("code", -1);
+            resultMap.put("message", "删除医技预约排班失败");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("删除医技预约排班失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "删除医技预约排班失败");
+            return resultMap;
+        }
+    }
+
+
+
+    /**
+     * 查询医技预约排班
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getScheduleOfMedical", method = {RequestMethod.POST})
+    public Map<String, Object> getScheduleOfMedical(@RequestBody ScheduleOfMedical scheduleOfMedical) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (scheduleOfMedical == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询医技预约排班失败,参数为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(scheduleOfMedical.getDepNo())){
+                scheduleOfMedical.setDepNo(null);
+            }
+            if(scheduleOfMedical.getBeginDateParams()!=null && scheduleOfMedical.getEndDateParams()!=null ){
+                List<String> dates= DateUtil.getBetweenDatesDesc(scheduleOfMedical.getBeginDateParams(),scheduleOfMedical.getEndDateParams());
+                if(dates!=null && dates.size()>0){
+                    scheduleOfMedical.setRecordDates(dates);
+                }
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "根查询医技预约排班成功");
+            Integer count=scheduleOfMedicalService.queryCountScheduleOfMedical(scheduleOfMedical);
+            List<ScheduleOfMedical> scheduleOfMedicals = scheduleOfMedicalService.queryScheduleOfMedicalWithPage(scheduleOfMedical);
+            fitScheduleOfMedical(scheduleOfMedicals);
+            resultMap.put("data", scheduleOfMedicals);
+            resultMap.put("count", count);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询医技预约排班失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询医技预约排班失败");
+            return resultMap;
+        }
+    }
+
+
+    private void fitScheduleOfMedical(List<ScheduleOfMedical> scheduleOfMedicals) {
+        scheduleOfMedicals.stream().forEach(m -> {
+            if (StringUtils.isNotBlank(m.getDepNo())) {
+                String unitName = zdUnitCodeService.queryDeptNameByIdInCache(m.getDepNo());
+                if (StringUtils.isNotBlank(unitName)) {
+                    m.setDeptName(unitName);
+                }
+            }
+        });
+    }
+
+
+}

+ 23 - 2
src/main/java/cn/hnthyy/thmz/entity/thmz/ScheduleOfMedical.java

@@ -1,14 +1,18 @@
 package cn.hnthyy.thmz.entity.thmz;
 
+import cn.hnthyy.thmz.vo.PageParams;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 医技科室档期排班表
  */
 @Data
-public class ScheduleOfMedical {
+public class ScheduleOfMedical extends PageParams {
     //主键
     private Long id;
     //科室编码
@@ -20,7 +24,9 @@ public class ScheduleOfMedical {
     //开始时间
     private String beginTime;
     //结束时间
-    private Long endTime;
+    private String endTime;
+    //状态  0 空闲  1 占用
+    private Integer  status;
     //创建人
     private Long createId;
     //创建时间
@@ -29,4 +35,19 @@ public class ScheduleOfMedical {
     private Long updateId;
     //修改时间
     private Date updateDate;
+
+
+
+    // 查询参数 开始时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date beginDateParams;
+    //查询参数 结束时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date endDateParams;
+    //日期集合
+    private List<String> recordDates;
+    //科室名称
+    private String deptName;
 }

+ 73 - 3
src/main/java/cn/hnthyy/thmz/mapper/thmz/ScheduleOfMedicalMapper.java

@@ -12,9 +12,9 @@ public interface ScheduleOfMedicalMapper {
      * @param scheduleOfMedical
      * @return
      */
-    @Insert("INSERT INTO t_schedule_of_medical(dep_no, room_num,record_date,begin_time,end_time,create_id, create_date,update_id,update_date) VALUES " +
+    @Insert("INSERT INTO t_schedule_of_medical(dep_no, room_num,record_date,begin_time,end_time,status,create_id, create_date,update_id,update_date) VALUES " +
             "(#{depNo,jdbcType=VARCHAR}, #{roomNum,jdbcType=INTEGER},#{recordDate,jdbcType=VARCHAR},#{beginTime,jdbcType=VARCHAR},#{endTime,jdbcType=VARCHAR}," +
-            "#{createId,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP},#{updateId,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP})")
+            "#{status,jdbcType=INTEGER}, #{createId,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP},#{updateId,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insertScheduleOfMedical(ScheduleOfMedical scheduleOfMedical);
 
@@ -24,7 +24,7 @@ public interface ScheduleOfMedicalMapper {
      * @return
      */
     @Select({"<script>",
-            "select id,dep_no, room_num,record_date,begin_time,end_time,create_id, create_date,update_id,update_date from t_schedule_of_medical where 1=1 " ,
+            "select id,dep_no, room_num,record_date,begin_time,end_time,status,create_id, create_date,update_id,update_date from t_schedule_of_medical where 1=1 " ,
             "<when test='depNo!=null'>",
             " and dep_no=#{depNo,jdbcType=VARCHAR}",
             "</when>",
@@ -38,6 +38,65 @@ public interface ScheduleOfMedicalMapper {
     List<ScheduleOfMedical> selectByCommonParams(ScheduleOfMedical scheduleOfMedical);
 
 
+    /**
+     * 分页查询排班档期
+     *
+     *
+     * @param scheduleOfMedical
+     * @return
+     */
+    @Select({"<script>" +
+            "select a.* " +
+            " from t_schedule_of_medical a join  ("+
+            "select id from t_schedule_of_medical where 1=1"+
+            "<when test='depNo!=null'>",
+            " and dep_no=#{depNo,jdbcType=VARCHAR}",
+            "</when>",
+            "<when test='roomNum!=null'>",
+            "  and room_num=#{roomNum,jdbcType=INTEGER}",
+            "</when>",
+            "<when test='recordDate!=null'>",
+            "  and record_date=#{recordDate,jdbcType=VARCHAR}",
+            "</when>",
+            "<when test='recordDates!=null'>" +
+                    " and record_date in" +
+                    "<foreach item='item' index='index' collection='recordDates' open='(' separator=',' close=')'>" +
+                    "#{item}" +
+                    "</foreach>" +
+             "</when>"+
+            " order by id limit #{offset},#{pageSize} )b on a.id=b.id"
+            + "</script>"})
+    List<ScheduleOfMedical> selectScheduleOfMedicalWithPage(ScheduleOfMedical scheduleOfMedical);
+
+
+    /**
+     * 查询排班档期总数
+     *
+     *
+     * @param scheduleOfMedical
+     * @return
+     */
+    @Select({"<script>" +
+            "select count(id) from t_schedule_of_medical where 1=1"+
+            "<when test='depNo!=null'>",
+            " and dep_no=#{depNo,jdbcType=VARCHAR}",
+            "</when>",
+            "<when test='roomNum!=null'>",
+            "  and room_num=#{roomNum,jdbcType=INTEGER}",
+            "</when>",
+            "<when test='recordDate!=null'>",
+            "  and record_date=#{recordDate,jdbcType=VARCHAR}",
+            "</when>",
+            "<when test='recordDates!=null'>" +
+                    " and record_date in" +
+                    "<foreach item='item' index='index' collection='recordDates' open='(' separator=',' close=')'>" +
+                    "#{item}" +
+                    "</foreach>" +
+                    "</when>"
+                    + "</script>"})
+    Integer selectCountScheduleOfMedical(ScheduleOfMedical scheduleOfMedical);
+
+
     /**
      * 更新排班档期
      * @param scheduleOfMedical
@@ -58,6 +117,9 @@ public interface ScheduleOfMedicalMapper {
             "<when test='beginTime!=null'>",
             ",begin_time=#{beginTime,jdbcType=VARCHAR}",
             "</when>",
+            "<when test='status!=null'>",
+            ",status=#{status,jdbcType=INTEGER}",
+            "</when>",
             "<when test='endTime!=null'>",
             ",end_time=#{endTime,jdbcType=VARCHAR}",
             "</when>",
@@ -80,4 +142,12 @@ public interface ScheduleOfMedicalMapper {
     int deleteScheduleOfMedical(@Param("id") Long id);
 
 
+
+    /**
+     * 按照id查询档期
+     * @param id
+     * @return
+     */
+    @Select("select * from t_schedule_of_medical where id=#{id,jdbcType=BIGINT}")
+    ScheduleOfMedical selectScheduleOfMedicalById(@Param("id") Long id);
 }

+ 3 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -82,7 +82,8 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     private OrderStatusChangeService orderStatusChangeService;
     //驾驶员id集合
     private List<String> patientIds = Arrays.asList(new String [] {"422429-4","400758-4","399163-4","400429-4","377323-4","309261-4","134402-4","209695-4"});
-    private String jsyChargeType= "27";
+    //不做重复挂号控制的号别
+    private List<String> jsyChargeTypes= Arrays.asList(new String [] {"26","27"});
     @Override
     @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
     public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException {
@@ -116,7 +117,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         mzVisitTableMapper.insertMzVisitTable(newMzVisitTable);
         fomartReqrec(mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now, mzyRequest);
         //不需要做重复挂号的校验id集合 ,只有入库的时候需要该参数
-        mzyReqrec.setCanRepeatedly(( jsyChargeType.equals(mzyReqrec.getChargeType()) && patientIds.contains(mzyReqrec.getPatientId()) )?YesNoEnum.YES.code:YesNoEnum.NO.code);
+        mzyReqrec.setCanRepeatedly(( jsyChargeTypes.contains(mzyReqrec.getChargeType()) && patientIds.contains(mzyReqrec.getPatientId()) )?YesNoEnum.YES.code:YesNoEnum.NO.code);
         int num=mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
         if(num<=0){
             throw new MzException("当前病人已经挂号成功,请不要重复挂号!");

+ 26 - 3
src/main/java/cn/hnthyy/thmz/service/impl/thmz/ScheduleOfMedicalServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.impl.thmz;
 
 import cn.hnthyy.thmz.entity.thmz.ScheduleOfMedical;
+import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.thmz.ScheduleOfMedicalMapper;
 import cn.hnthyy.thmz.service.thmz.ScheduleOfMedicalService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,9 +15,16 @@ public class ScheduleOfMedicalServiceImpl implements ScheduleOfMedicalService {
     @Autowired
     private ScheduleOfMedicalMapper scheduleOfMedicalMapper;
     @Override
-    public int saveScheduleOfMedical(ScheduleOfMedical scheduleOfMedical) {
-        scheduleOfMedical.setCreateDate(new Date());
-        return scheduleOfMedicalMapper.insertScheduleOfMedical(scheduleOfMedical);
+    public int saveScheduleOfMedical(ScheduleOfMedical scheduleOfMedical,Long userId) {
+        scheduleOfMedical.setUpdateDate(new Date());
+        scheduleOfMedical.setUpdateId(userId);
+        if(scheduleOfMedical.getId()==null){
+            scheduleOfMedical.setCreateDate(scheduleOfMedical.getUpdateDate());
+            scheduleOfMedical.setCreateId(userId);
+            scheduleOfMedical.setStatus(YesNoEnum.NO.code);
+            return  scheduleOfMedicalMapper.insertScheduleOfMedical(scheduleOfMedical);
+        }
+        return scheduleOfMedicalMapper.updateScheduleOfMedical(scheduleOfMedical);
     }
 
     @Override
@@ -34,4 +42,19 @@ public class ScheduleOfMedicalServiceImpl implements ScheduleOfMedicalService {
     public int removeScheduleOfMedical(Long id) {
         return scheduleOfMedicalMapper.deleteScheduleOfMedical(id);
     }
+
+    @Override
+    public List<ScheduleOfMedical> queryScheduleOfMedicalWithPage(ScheduleOfMedical scheduleOfMedical) {
+        return scheduleOfMedicalMapper.selectScheduleOfMedicalWithPage(scheduleOfMedical);
+    }
+
+    @Override
+    public Integer queryCountScheduleOfMedical(ScheduleOfMedical scheduleOfMedical) {
+        return scheduleOfMedicalMapper.selectCountScheduleOfMedical(scheduleOfMedical);
+    }
+
+    @Override
+    public ScheduleOfMedical queryScheduleOfMedicalById(Long id) {
+        return scheduleOfMedicalMapper.selectScheduleOfMedicalById(id);
+    }
 }

+ 29 - 1
src/main/java/cn/hnthyy/thmz/service/thmz/ScheduleOfMedicalService.java

@@ -11,7 +11,7 @@ public interface ScheduleOfMedicalService {
      * @param scheduleOfMedical
      * @return
      */
-    int saveScheduleOfMedical(ScheduleOfMedical scheduleOfMedical);
+    int saveScheduleOfMedical(ScheduleOfMedical scheduleOfMedical,Long userId);
 
     /**
      * 根据通用参数查询排班
@@ -36,4 +36,32 @@ public interface ScheduleOfMedicalService {
     int removeScheduleOfMedical(Long id);
 
 
+    /**
+     * 分页查询排班档期
+     *
+     *
+     * @param scheduleOfMedical
+     * @return
+     */
+    List<ScheduleOfMedical> queryScheduleOfMedicalWithPage(ScheduleOfMedical scheduleOfMedical);
+
+
+    /**
+     * 查询排班档期总数
+     *
+     *
+     * @param scheduleOfMedical
+     * @return
+     */
+    Integer queryCountScheduleOfMedical(ScheduleOfMedical scheduleOfMedical);
+
+
+    /**
+     * 按照id查询档期
+     * @param id
+     * @return
+     */
+    ScheduleOfMedical queryScheduleOfMedicalById(Long id);
+
+
 }

+ 14 - 0
src/main/java/cn/hnthyy/thmz/vo/PageParams.java

@@ -0,0 +1,14 @@
+package cn.hnthyy.thmz.vo;
+
+import lombok.Data;
+
+/**
+ * 分页查询参数
+ */
+@Data
+public class PageParams {
+    //每页显示的数据
+    protected Integer pageSize;
+    //页面当前位置
+    protected Integer offset;
+}

+ 1 - 5
src/main/java/cn/hnthyy/thmz/vo/ThmzmxsrParamsVo.java

@@ -13,7 +13,7 @@ import java.util.List;
  * 门诊收入明细
  */
 @Data
-public class ThmzmxsrParamsVo {
+public class ThmzmxsrParamsVo extends PageParams{
     //通用参数 姓名,卡号,id
     private String commonParams;
     //费用参照基数   0 日结时间  1 收费时间
@@ -46,10 +46,6 @@ public class ThmzmxsrParamsVo {
     private String firstTableName;
     //第二个表名
     private String secondTableName;
-    //每页显示的数据
-    private Integer pageSize;
-    //页面当前位置
-    private Integer offset;
     //上一次查询到的总额
     private BigDecimal amount;
     //上一次查询到的总数

+ 5 - 0
src/main/resources/static/js/registration.js

@@ -171,6 +171,7 @@ $(function () {
      * 保存挂号信息
      */
     $("#saveConfirmFee").on("click", function (t) {
+        $("#saveConfirmFee").attr("disabled",true);
         var cash=$("#cash").val();
         if(cash==null || cash ==""){
             new PNotify({
@@ -180,11 +181,13 @@ $(function () {
                 hide: false,
                 styling: 'bootstrap3'
             });
+            $("#saveConfirmFee").attr("disabled",false);
             return;
         }
         var realMoney = parseFloat($("#realMoney").val());
         realMoney = realMoney.toFixed(2);
         if (parseFloat(cash) < realMoney) {
+            $("#saveConfirmFee").attr("disabled",false);
             return;
         }
         var patientId = $("#patientId").val();
@@ -1369,6 +1372,7 @@ function savePatient(flag) {
                     successMesage(res);
                 }
             } else {
+                $("#saveConfirmFee").attr("disabled",false);
                 errorMesage(res);
             }
         }
@@ -1504,6 +1508,7 @@ function saveMzyReqrec() {
                     styling: 'bootstrap3'
                 });
             }
+            $("#saveConfirmFee").attr("disabled",false);
         }
     });
 }

+ 111 - 350
src/main/resources/static/js/schedule-of-medical.js

@@ -1,36 +1,17 @@
 //@ sourceURL=schedule-of-medical.js
 $(function () {
-    daterangepickerWithIdAndCallBack('sourceRange', initSourceList);
-    // initDaterangepickerWithId('sourceRange');
-    // initDaterangepickerWithId('newRange');
-    initSourceList();
+    daterangepickerWithIdAndCallBack('sourceRange', initList);
+    //initList();
     //  initFeeTable();
     //重置查询参数
     $('#btn_clean').click(function () {
         cleanParams();
     });
 
-    // $("#btn_query").click(function (t) {
-    //     initSourceList();
-    // });
 
     $(".selectpicker").selectpicker({
         dropuAuto: false
     });
-    $("#btn_creat").click(function (t) {
-        initSourceList();
-        $("#btn_creat").removeClass('in').addClass('hide');
-        $("#btn_cancel").removeClass('hide').addClass('in');
-        $("#tb_table_1").css("display", "block");
-        $("#tb_table_2").css("display", "block");
-    });
-    $("#btn_cancel").click(function (t) {
-        initSourceList();
-        $("#btn_cancel").removeClass('in').addClass('hide');
-        $("#btn_creat").removeClass('hide').addClass('in');
-        $("#tb_table_1").css("display", "none");
-        $("#tb_table_2").css("display", "none");
-    });
 
     $("#btn_add").click(function (t) {
         $("#editModal").modal();
@@ -38,21 +19,9 @@ $(function () {
         clearInput();
     });
 
-    $("#btn_save").click(function (t) {
-        if (showTwoTable) {
-            //保存临时生成的新号表数据
-            saveRequest();
-        }
-    });
 
     $("#saveEdit").click(function (t) {
-        if (showTwoTable) {
-            //保存临时生成的新号表数据
-            saveTempRequest();
-        } else {
-            //单独添加一个排班,直接保存
-            saveRequest();
-        }
+        saveScheduleOfMedical();
     });
 
 
@@ -108,24 +77,42 @@ $(function () {
         }
     });
     initDeptSelect();
+
+
+
+    $("#beginTime").change(function (e) {
+        var beginTime = $("#beginTime").val();
+        if (beginTime.length == 2 && beginTime.indexOf(":") <= 0) {
+            beginTime+=":";
+        }else if (beginTime.length == 2 && beginTime.indexOf(":") > 0) {
+            beginTime="0"+beginTime;
+        }
+        $("#beginTime").val(beginTime);
+    });
+
+
+    $("#endTime").change(function (e) {
+        var endTime = $("#endTime").val();
+        if (endTime.length == 2 && endTime.indexOf(":") <= 0) {
+            endTime+=":";
+        }else if (beginTime.length == 2 && beginTime.indexOf(":") > 0) {
+            endTime="0"+endTime;
+        }
+        $("#endTime").val(endTime);
+    });
+
 });
 
 /**
  * 清空输入框
  */
 function clearInput() {
-    $("#requestId").val(null);
     $("#editDay").val(null);
-    $('#ampm').selectpicker('val', null);
-    $('#ampm').selectpicker('refresh');
     $('#deptNo').selectpicker('val', null);
     $('#deptNo').selectpicker('refresh');
-    $('#doctorParam').selectpicker('val', null);
-    $('#doctorParam').selectpicker('refresh');
-    $('#chargeType').selectpicker('val', null);
-    $('#chargeType').selectpicker('refresh');
-    $("#checkFee").val(null);
-    $("#totalNum").val(null);
+    $("#roomNum").val(null);
+    $("#beginTime").val(null);
+    $("#endTime").val(null);
 }
 
 
@@ -134,12 +121,12 @@ function clearInput() {
 
 
 /**
- * 查询源号表信息
+ * 查询排班信息
  */
-function initSourceList() {
+function initList() {
     $('#tb_table').bootstrapTable("destroy");
     $('#tb_table').bootstrapTable({
-        url: '/thmz/getRequestByTimes',         //请求后台的URL(*)
+        url: '/thmz/getScheduleOfMedical',         //请求后台的URL(*)
         method: 'post',                      //请求方式(*)
         toolbar: '#toolbar',                //工具按钮用哪个容器
         striped: true,                      //是否显示行间隔色
@@ -148,7 +135,7 @@ function initSourceList() {
         sortable: true,                     //是否启用排序
         sortOrder: "asc",                   //排序方式
         queryParams: queryParams,           //传递参数(*)
-        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
         pageNumber: 1,                       //初始化加载第一页,默认第一页
         pageSize: 15,                       //每页的记录行数(*)
         pageList: [10, 15, 25, 50, 100],        //可供选择的每页的行数(*)
@@ -177,12 +164,13 @@ function initSourceList() {
                 valign: 'middle',
                 formatter: function (value, row, index) {
                     var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="updateRequest(' + row.id + ')">编辑</button>';
+                    str += '<button type="button" class="btn btn-primary  btn-sm" onclick="removeRequest(' + row.id + ')">删除</button>';
                     return [str].join('');
                 }
             },
             {
-                field: 'depNo',
-                title: '科室编码',
+                field: 'deptName',
+                title: '科室名称',
                 align: "center",
                 valign: 'middle'
             }, {
@@ -208,6 +196,14 @@ function initSourceList() {
                 title: '结束时间',
                 align: "center",
                 valign: 'middle'
+            }, {
+                field: 'status',
+                title: '状态',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    return value==0?"空闲":"占用";
+                }
             }
         ],
         onLoadSuccess: function () {
@@ -235,7 +231,7 @@ function initSourceList() {
                 };
             }
             return {
-                "total": ress.data.length,//总页数
+                "total": ress.count,//总页数
                 "rows": ress.data   //数据
             };
         },
@@ -251,10 +247,11 @@ function initSourceList() {
 function queryParams(params) {
     var rePortRangeArr = getSourceRangeArr();
     var temp = {
-        beginDate: rePortRangeArr[0],
-        endDate: rePortRangeArr[1],
-        unitCode: $("#unitCode").val(),
-        ampm: $("#ampmParams").val()
+        beginDateParams: rePortRangeArr[0],
+        endDateParams: rePortRangeArr[1],
+        depNo: $("#unitCode").val(),
+        pageSize: params.limit,
+        offset:params.offset,
     };
     return temp;
 };
@@ -262,201 +259,6 @@ function queryParams(params) {
 
 
 
-/**
- * 生成新号表的通用方法
- * @param url
- * @param newParams
- */
-function initNewListCommon(url, newParams) {
-    $('#tb_table_2').bootstrapTable("destroy");
-    $('#tb_table_2').bootstrapTable({
-        url: url,                            //请求后台的URL(*)
-        method: 'post',                      //请求方式(*)
-        toolbar: '#toolbar',                //工具按钮用哪个容器
-        striped: true,                      //是否显示行间隔色
-        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
-        pagination: true,                   //是否显示分页(*)
-        sortable: true,                     //是否启用排序
-        sortOrder: "asc",                   //排序方式
-        queryParams: newParams,           //传递参数(*)
-        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
-        pageNumber: 1,                       //初始化加载第一页,默认第一页
-        pageSize: 15,                       //每页的记录行数(*)
-        pageList: [10, 15, 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',
-                formatter: function (value, row, index) {
-                    var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="updateRequestByIndex(' + index + ')">编辑</button>';
-                    return [str].join('');
-                }
-            },
-            {
-                field: 'requestDay',
-                title: '日期',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return format(value, "yyyy-MM-dd");
-                }
-            }, {
-                field: 'ampm',
-                title: '号段',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    var text = '上午';
-                    if (value == 'p') {
-                        text = '下午';
-                    } else if (value == 'd') {
-                        text = '全天';
-                    }
-                    return text;
-                }
-            }, {
-                field: 'unitName',
-                title: '科室',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'doctorName',
-                title: '医生',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'chargeTypeName',
-                title: '号别',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'checkFee',
-                title: '检查费',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return value.toFixed(2);
-                }
-            }, {
-                field: 'totalNum',
-                title: '总号数',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'leftNum',
-                title: '剩余号数',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'bespeakNo',
-                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": {}   //数据
-                // };
-            }
-            //临时保存新号表数据
-            tempData = ress.data;
-            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 newListQueryParams(params) {
-    var newRangeArr = getNewRangeArr();
-    if (baseList) {
-        var temp = {
-            beginDate: "2012-02-13 00:00:00",
-            endDate: "2012-02-19 23:59:59",
-            newBeginDate: newRangeArr[0],
-            newEndDate: newRangeArr[1],
-        };
-        return temp;
-    }
-    var rePortRangeArr = getSourceRangeArr();
-    var temp = {
-        beginDate: rePortRangeArr[0],
-        endDate: rePortRangeArr[1],
-        newBeginDate: newRangeArr[0],
-        newEndDate: newRangeArr[1],
-    };
-    return temp;
-};
-
-
-/**
- * 设置病人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);
-                }
-            }
-        }
-    });
-}
 
 
 /**
@@ -488,77 +290,42 @@ function cleanParams() {
 }
 
 
-/**
- * 保存临时生成的新号表数据
- */
-function saveTempRequest() {
-    var index = $("#requestId").val();
-    var realParams = JSON.parse('{"mzyRequests":""}');
-    var tempJson = JSON.parse('{"requestDay":"","ampm":"","unitCode":"","doctorCode":"","chargeType":"","totalNum":"","leftNum":"","bespeakNo":"1","checkFee":""}');
-    tempJson.requestDay = $("#editDay").val();
-    tempJson.ampm = $("#ampm").val();
-    tempJson.unitCode = $("#deptNo").val();
-    tempJson.doctorCode = $("#doctorParam").val();
-    tempJson.chargeType = $("#chargeType").val();
-    tempJson.totalNum = $("#totalNum").val();
-    tempJson.leftNum = $("#totalNum").val();
-    tempJson.checkFee = $("#checkFee").val();
-    if (index == null || index == "") {
-        tempData[tempData.length] = tempJson;
-    } else {
-        tempData[index] = tempJson;
-    }
-    realParams.mzyRequests = tempData;
-    $("#editModal").modal("hide");
-    initNewListCommon("/thmz/formatRequest", realParams);
 
-}
 
 
 /**
- * 保存号表数据
+ * 保存
  */
-function saveRequest() {
-    var data = null;
-    if (showTwoTable) {
-        var realParams = JSON.parse('{"mzyRequests":[]}');
-        for (var i = 0; i < tempData.length; i++) {
-            var thisData = tempData[i];
-            var tempJson = JSON.parse('{"requestDay":"","ampm":"","unitCode":"","doctorCode":"","chargeType":"","totalNum":"","leftNum":"","bespeakNo":"1","checkFee":""}');
-            tempJson.requestDay = thisData.requestDay;
-            tempJson.ampm = thisData.ampm;
-            tempJson.unitCode = thisData.unitCode;
-            tempJson.doctorCode = thisData.doctorCode;
-            tempJson.chargeType = thisData.chargeType;
-            tempJson.totalNum = thisData.totalNum;
-            tempJson.leftNum = thisData.leftNum;
-            tempJson.checkFee = thisData.checkFee;
-            realParams.mzyRequests[i] = tempJson;
-        }
-        data = JSON.stringify(realParams);
-    } else {
-        data = JSON.stringify({
-            mzyRequests: [{
-                id: $("#requestId").val(),
-                requestDay: $("#editDay").val(),
-                ampm: $("#ampm").val(),
-                unitCode: $("#deptNo").val(),
-                doctorCode: $("#doctorParam").val(),
-                chargeType: $("#chargeType").val(),
-                totalNum: $("#totalNum").val(),
-                leftNum: $("#totalNum").val(),
-                bespeakNo: 1,
-                checkFee: $("#checkFee").val()
-            }]
+function saveScheduleOfMedical() {
+    var beginTime = $("#beginTime").val();
+    var endTime = $("#endTime").val();
+    if(beginTime==null || beginTime.length<5){
+        new PNotify({
+            title: '错误提示',
+            text: "开始时间格式错误!",
+            type: 'error',
+            hide: false,
+            styling: 'bootstrap3'
+        });
+        return;
+    }
+    if(endTime==null || endTime.length<5){
+        new PNotify({
+            title: '错误提示',
+            text: "结束时间格式错误!",
+            type: 'error',
+            hide: false,
+            styling: 'bootstrap3'
         });
+        return;
     }
     $.ajax({
         type: "POST",
-        url: '/thmz/saveRequest',
+        url: '/thmz/saveScheduleOfMedical',
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
-        data: data,
+        data: JSON.stringify({"id":$("#requestId").val(),"recordDate":$("#editDay").val(),"depNo":$("#deptNo").val(),"roomNum":$("#roomNum").val(),"beginTime":$("#beginTime").val(),"endTime":$("#endTime").val()}),
         success: function (res) {
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
@@ -567,16 +334,8 @@ function saveRequest() {
             if (res.code == 0) {
                 $("#editModal").modal("hide");
                 clearInput();
-                if(showTwoTable){
-                    initSourceList();
-                }else {
-                    $('#tb_table').bootstrapTable('refresh');
-                }
+                $('#tb_table').bootstrapTable('refresh');
                 successMesage(res);
-                if (showTwoTable) {
-                    $('#sourceRange span').html($('#newRange span').html());
-                    $("#btn_cancel").click();
-                }
             } else {
                 errorMesage(res);
             }
@@ -624,14 +383,14 @@ function initDeptSelect() {
 
 
 /**
- * 修改号表信息
+ * 修改信息
  * @param id
  */
 function updateRequest(id) {
     $("#requestId").val(id);
     $.ajax({
         type: "GET",
-        url: '/thmz/getRequestById?id=' + id,
+        url: '/thmz/getScheduleOfMedicalById?id=' + id,
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (res) {
@@ -641,45 +400,47 @@ function updateRequest(id) {
             }
             if (res.code == 0) {
                 $("#classTitle").text("修改");
-                $("#editDay").val(format(res.data.requestDay, "yyyy-MM-dd"));
-                $('#ampm').selectpicker('val', res.data.ampm);
-                $('#ampm').selectpicker('refresh');
-                $('#deptNo').selectpicker('val', res.data.unitCode);
+                $("#editDay").val(res.data.recordDate);
+                $('#deptNo').selectpicker('val', res.data.depNo);
                 $('#deptNo').selectpicker('refresh');
-                //initDoctorSelect();
-                $('#doctorParam').selectpicker('val', res.data.doctorCode);
-                $('#doctorParam').selectpicker('refresh');
-                $('#chargeType').selectpicker('val', res.data.chargeType);
-                $('#chargeType').selectpicker('refresh');
-                $("#totalNum").val(res.data.totalNum);
-                $("#totalNum").val(res.data.leftNum);
-                $("#checkFee").val(res.data.checkFee);
+                $("#roomNum").val(res.data.roomNum);
+                $("#beginTime").val(res.data.beginTime);
+                $("#endTime").val(res.data.endTime);
                 $("#editModal").modal();
             }
         }
     });
 }
 
+
+
+
+
 /**
- * 临时新号表修改
- * @param index
+ * 删除信息
+ * @param id
  */
-function updateRequestByIndex(index) {
-    $("#requestId").val(index);
-    var data = tempData[index];
-    $("#classTitle").text("修改");
-    $("#editDay").val(format(data.requestDay, "yyyy-MM-dd"));
-    $('#ampm').selectpicker('val', data.ampm);
-    $('#ampm').selectpicker('refresh');
-    $('#deptNo').selectpicker('val', data.unitCode);
-    $('#deptNo').selectpicker('refresh');
-    $('#doctorParam').selectpicker('val', data.doctorCode);
-    $('#doctorParam').selectpicker('refresh');
-    $('#chargeType').selectpicker('val', data.chargeType);
-    $('#chargeType').selectpicker('refresh');
-    $("#totalNum").val(data.totalNum);
-    $("#totalNum").val(data.leftNum);
-    $("#checkFee").val(data.checkFee);
-    $("#editModal").modal();
+function removeRequest(id) {
+    if (!confirm("确认要删除当前操作的排版信息吗?")) {
+        return;
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/removeScheduleOfMedicalById?id=' + id,
+        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) {
+                initList();
+                successMesage(res);
+            }else {
+                errorMesage(res);
+            }
+        }
+    });
 }
 

+ 3 - 0
src/main/resources/static/js/toll_administration.js

@@ -1201,7 +1201,9 @@ function initTallyDetailTable() {
  * 提交缴费申请
  */
 function saveConfirmFee() {
+    $("#saveConfirmFee").attr("disabled",true);
     if (!checkFee(true)) {
+        $("#saveConfirmFee").attr("disabled",false);
         return;
     }
     var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');
@@ -1263,6 +1265,7 @@ function saveConfirmFee() {
                     styling: 'bootstrap3'
                 });
             }
+            $("#saveConfirmFee").attr("disabled",false);
         }
     });
 }

+ 25 - 58
src/main/resources/templates/schedule-of-medical.html

@@ -10,52 +10,38 @@
         <div class="x_panel">
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off">
-                    <div class="form-group col-md-5 col-sm-5 col-xs-12"></div>
-                    <div class="form-group col-md-7 col-sm-7 col-xs-12">
+                    <div class="form-group col-md-2 col-sm-2 col-xs-12"></div>
+                    <div class="form-group col-md-8 col-sm-8 col-xs-12">
                         <div class="col-md-4 col-sm-4 col-xs-12 item">
                             <label class="control-label col-md-4 col-sm-4 col-xs-12" for="unitCode">科室
                             </label>
                             <div class="col-md-8 col-sm-8 col-xs-12">
                                 <select class="form-control selectpicker show-tick" data-live-search="true" required="required"
-                                        title="请选择" onchange="initSourceList()"
+                                        title="请选择" onchange="initList()"
                                         id="unitCode">
                                 </select>
                             </div>
                         </div>
-                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="sourceRange"> 日期
+                        <div class="col-md-8 col-sm-8 col-xs-12 item">
+                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="sourceRange"> 日期
                         </label>
-                        <div class="col-md-7 col-sm-7 col-xs-12">
+                        <div class="col-md-10 col-sm-10 col-xs-12">
                             <div id="sourceRange" 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>
-                    <div class="form-group col-md-5 col-sm-5 col-xs-12"></div>
-                    <div class="form-group col-md-7 col-sm-7 col-xs-12">
-                        <div class="btn-group col-md-4 col-sm-4 col-xs-12"></div>
-                        <div class="col-md-8 col-sm-8 col-xs-12" style="text-align:right;    padding-left: 50px;">
-                            <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_add" class="btn btn-primary"
-                                    title="新增排班"><i class="fa fa-plus"></i>
-                            </button>
-                            <button type="button" style="margin-left:3px" id="btn_creat" class="btn btn-primary"
-                                    title="生成新号表">生成新号表
-                            </button>
-                            <button type="button" style="margin-left:3px" id="btn_cancel" class="btn btn-primary hide"
-                                    title="取消生成新号表">取消生成新号表
-                            </button>
-                            <button type="button" style="margin-left:3px" id="btn_save" class="btn btn-primary"
-                                    title="保存号表信息"><i class="fa fa-check"></i>
-                            </button>
                         </div>
                     </div>
+                    <div class="col-md-2 col-sm-2 col-xs-12" style="text-align:right;">
+                        <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_add" class="btn btn-primary"
+                                title="新增排班"><i class="fa fa-plus"></i>
+                        </button>
+                    </div>
                 </form>
             </div>
 
@@ -77,7 +63,7 @@
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
                 </button>
-                <h4 class="modal-title">号表排班【<span id="classTitle">新增</span>】</h4>
+                <h4 class="modal-title">医技排班【<span id="classTitle">新增</span>】</h4>
             </div>
             <div class="modal-body">
                 <form class="form-horizontal form-label-left" novalidate id="editUserForm" autocomplete="off">
@@ -95,16 +81,6 @@
                         </div>
                     </div>
 
-                    <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="ampm">号段 <span
-                                class="required">*</span>
-                        </label>
-                        <div class="col-md-6 col-sm-6 col-xs-12">
-                            <select class="form-control selectpicker show-tick" required="required" title="请选择"
-                                    id="ampm">
-                            </select>
-                        </div>
-                    </div>
                     <div class="item form-group thmz_alert">
                         <label class="control-label col-md-4 col-sm-4 col-xs-12" for="deptNo">科室 <span
                                 class="required">*</span>
@@ -116,41 +92,32 @@
                         </div>
                     </div>
                     <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="doctorParam">医生
-                        </label>
-                        <div class="col-md-6 col-sm-6 col-xs-12">
-                            <select class="form-control selectpicker show-tick" data-live-search="true" title="请选择"
-                                    id="doctorParam">
-                            </select>
-                        </div>
-                    </div>
-                    <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="chargeType">号别 <span
+                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="roomNum">诊室号 <span
                                 class="required">*</span>
                         </label>
                         <div class="col-md-6 col-sm-6 col-xs-12">
-                            <select class="form-control selectpicker show-tick" required="required" title="请选择"
-                                    id="chargeType">
-                            </select>
+                            <input id="roomNum" class="form-control optional" type="number"
+                                   data-validate-length-range="0,10"
+                                   placeholder="请输入">
                         </div>
                     </div>
                     <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="checkFee">检查费 <span
+                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="beginTime">开始时间 <span
                                 class="required">*</span>
                         </label>
                         <div class="col-md-6 col-sm-6 col-xs-12">
-                            <input id="checkFee" class="form-control optional" type="number"
-                                   data-validate-length-range="0,10"
+                            <input id="beginTime" class="form-control optional" type="text"
+                                   maxlength="5"
                                    placeholder="请输入">
                         </div>
                     </div>
                     <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="totalNum">总号数 <span
+                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="endTime">结束时间 <span
                                 class="required">*</span>
                         </label>
                         <div class="col-md-6 col-sm-6 col-xs-12">
-                            <input id="totalNum" class="form-control optional" type="number"
-                                   data-validate-length-range="0,10"
+                            <input id="endTime" class="form-control optional" type="text"
+                                   maxlength="5"
                                    placeholder="请输入">
                         </div>
                     </div>

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

@@ -209,7 +209,7 @@
                 <!--<input type="checkbox"/>&nbsp;&nbsp;打印-->
                 <!--</div>-->
                 <!--<input type="hidden" id="benYuanJiZhangTimes"/>-->
-                <button type="button" class="btn btn-primary" onclick="saveConfirmFee()">确定</button>
+                <button type="button" class="btn btn-primary" onclick="saveConfirmFee()" id="saveConfirmFee">确定</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
             </div>
         </div>

+ 79 - 0
src/test/java/cn/hnthyy/thmz/PeriodTimeIsOverlap.java

@@ -0,0 +1,79 @@
+package cn.hnthyy.thmz;
+ 
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+ 
+/**
+ * 
+ * @Describtion:时间段是否重叠
+ * @author: weiRB
+ * 2020年1月8日下午5:39:43
+ */
+public class PeriodTimeIsOverlap {
+	
+	public static void main(String[] args) {
+		try {
+			boolean b = isOverlap();
+			System.out.println("是否重复(true:重复,false:不重复):"+b);
+		} catch (ParseException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+
+	public static boolean isOverlap() throws ParseException{
+		//造3个时间段数据
+		List<Timestamp> periodStart = new ArrayList<Timestamp>();
+		List<Timestamp> periodend = new ArrayList<Timestamp>();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		//第一个时间段
+		Date start1 = sdf.parse("2020-1-1 00:00:00");
+		Date end1 = sdf.parse("2020-1-6 00:00:00");
+		//第二个时间段
+		Date start2 = sdf.parse("2020-1-5 00:00:00");
+		Date end2 = sdf.parse("2020-1-6 00:00:00");
+		//第三个时间段
+		Date start3 = sdf.parse("2020-1-9 00:00:00");
+		Date end3 = sdf.parse("2020-1-10 00:00:00");
+
+		//开始时间放到一个数组
+		periodStart.add(new Timestamp(start1.getTime()));
+		periodStart.add(new Timestamp(start2.getTime()));
+		periodStart.add(new Timestamp(start3.getTime()));
+		//结束时间放到一个数组
+		periodend.add(new Timestamp(end1.getTime()));
+		periodend.add(new Timestamp(end2.getTime()));
+		periodend.add(new Timestamp(end3.getTime()));
+		/**
+		 * 两两循环比较
+		 * 这里的3代表有三组数据,先写死
+		 */
+		for (int i = 0; i < periodStart.size()-1; i++) {
+			Timestamp start0 = periodStart.get(i);
+			Timestamp end0 = periodend.get(i);
+			for (int j = i+1; j < periodStart.size(); j++) {
+				Timestamp start = periodStart.get(j);
+				Timestamp end = periodend.get(j);
+				if(start0.compareTo(end)>=0 || end0.compareTo(start)<=0){
+					/**
+					 * 说明不重复。
+					 * 思路:该时间段的开始时间如何大于另个一个时间段的结束时间,那么这个两个时间段不会有重叠;
+					 * 如果该时间段的结束时间小于另一个时间段的时间,那么这个两个时间段也不会有重叠。
+					 */
+					continue;
+				}else{
+					//说明该时间段重复
+					return true;
+				}
+			}
+		}
+
+		return false;
+	}
+ 
+}