|  | @@ -1,10 +1,7 @@
 | 
	
		
			
				|  |  |  package cn.hnthyy.thmz.mapper.his;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.MzyRequest;
 | 
	
		
			
				|  |  | -import org.apache.ibatis.annotations.Insert;
 | 
	
		
			
				|  |  | -import org.apache.ibatis.annotations.Param;
 | 
	
		
			
				|  |  | -import org.apache.ibatis.annotations.Select;
 | 
	
		
			
				|  |  | -import org.apache.ibatis.annotations.Update;
 | 
	
		
			
				|  |  | +import org.apache.ibatis.annotations.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.Date;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
	
		
			
				|  | @@ -90,14 +87,6 @@ public interface MzyRequestMapper {
 | 
	
		
			
				|  |  |      int synchronizationRequest();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//    /**
 | 
	
		
			
				|  |  | -//     * 查询最新的排班信息
 | 
	
		
			
				|  |  | -//     * @return
 | 
	
		
			
				|  |  | -//     */
 | 
	
		
			
				|  |  | -//    @Select("select request_day,ampm,unit_code,group_code,doctor_code,charge_type,op_id,total_num,left_num,bespeak_no,check_fee,sys_date,del_flag " +
 | 
	
		
			
				|  |  | -//            " from mzy_request where request_day >=(select top 1 request_day from mzy_request_new order by request_day desc ) and request_day <> '7019-10-27 00:00:00.000' order by request_day asc")
 | 
	
		
			
				|  |  | -//    List<MzyRequest> selectNewRequest();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询当天最新的排班信息
 | 
	
	
		
			
				|  | @@ -122,20 +111,12 @@ public interface MzyRequestMapper {
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @Insert("insert into mzy_request_new(request_day,ampm,unit_code,group_code,doctor_code,charge_type,op_id,total_num,left_num,bespeak_no,check_fee,sys_date,del_flag) " +
 | 
	
		
			
				|  |  | +    @Insert("if not exists (select id  from mzy_request_new where request_day=#{requestDay,jdbcType=DATE} and ampm = #{ampm,jdbcType=CHAR} and unit_code=#{unitCode} and group_code=#{groupCode} and charge_type=#{chargeType} and doctor_code=#{doctorCode} ) "+
 | 
	
		
			
				|  |  | +            "insert into mzy_request_new(request_day,ampm,unit_code,group_code,doctor_code,charge_type,op_id,total_num,left_num,bespeak_no,check_fee,sys_date,del_flag) " +
 | 
	
		
			
				|  |  |              "values(#{requestDay,jdbcType=DATE},#{ampm},#{unitCode},#{groupCode},#{doctorCode},#{chargeType},#{opId},#{totalNum},#{leftNum},#{bespeakNo},#{checkFee},#{sysDate,jdbcType=DATE},#{delFlag})")
 | 
	
		
			
				|  |  |      int insertRequest(MzyRequest mzyRequest);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 保存老系统排班表
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  | -     * @return
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    @Insert("insert into mzy_request(request_day,ampm,unit_code,group_code,doctor_code,charge_type,op_id,total_num,left_num,bespeak_no,check_fee,sys_date,del_flag,total_req,left_req,web_no) " +
 | 
	
		
			
				|  |  | -            "values(#{requestDay,jdbcType=DATE},#{ampm},#{unitCode},#{groupCode},#{doctorCode},#{chargeType},#{opId},#{totalNum},#{leftNum},#{bespeakNo},#{checkFee},#{sysDate,jdbcType=DATE},#{delFlag},0,0,0)")
 | 
	
		
			
				|  |  | -    int insertOldRequest(MzyRequest mzyRequest);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 按日期和时间区间以及部门编码以及收费类型查询老排班表中的最新数据
 | 
	
	
		
			
				|  | @@ -193,18 +174,11 @@ public interface MzyRequestMapper {
 | 
	
		
			
				|  |  |       * @param mzyRequest
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @Update("update mzy_request_new set request_day=#{requestDay,jdbcType=DATE},ampm=#{ampm},unit_code=#{unitCode},doctor_code=#{doctorCode},charge_type=#{chargeType},total_num=#{totalNum},left_num=#{leftNum,jdbcType=INTEGER}, bespeak_no=#{bespeakNo,jdbcType=SMALLINT},check_fee=#{checkFee} where id = #{id,jdbcType=BIGINT}")
 | 
	
		
			
				|  |  | +    @Update("if not exists (select id  from mzy_request_new where request_day=#{requestDay,jdbcType=DATE} and ampm = #{ampm,jdbcType=CHAR} and unit_code=#{unitCode} and group_code=#{groupCode} and charge_type=#{chargeType} and doctor_code=#{doctorCode} and id <> #{id,jdbcType=BIGINT} ) "+
 | 
	
		
			
				|  |  | +            "update mzy_request_new set request_day=#{requestDay,jdbcType=DATE},ampm=#{ampm},unit_code=#{unitCode},doctor_code=#{doctorCode},charge_type=#{chargeType},total_num=#{totalNum},left_num=#{leftNum,jdbcType=INTEGER}, bespeak_no=#{bespeakNo,jdbcType=SMALLINT},check_fee=#{checkFee} where id = #{id,jdbcType=BIGINT}")
 | 
	
		
			
				|  |  |      int updateMzyRequestNew(MzyRequest mzyRequest);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 更新老号表
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  | -     * @param mzyRequest
 | 
	
		
			
				|  |  | -     * @return
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    @Update("update mzy_request set request_day=#{requestDay,jdbcType=DATE},ampm=#{ampm},unit_code=#{unitCode},doctor_code=#{doctorCode},charge_type=#{chargeType},total_num=#{totalNum},left_num=#{leftNum,jdbcType=INTEGER}, bespeak_no=#{bespeakNo,jdbcType=SMALLINT},check_fee=#{checkFee} where request_day=#{requestDayOld,jdbcType=DATE} and ampm=#{ampmOld} and unit_code=#{unitCodeOld}  and doctor_code=#{doctorCodeOld} and charge_type=#{chargeTypeOld} ")
 | 
	
		
			
				|  |  | -    int updateMzyRequestOld(MzyRequest mzyRequest);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 科室号源统计
 | 
	
	
		
			
				|  | @@ -258,4 +232,14 @@ public interface MzyRequestMapper {
 | 
	
		
			
				|  |  |              "</when>",
 | 
	
		
			
				|  |  |              "</script>"})
 | 
	
		
			
				|  |  |      List<Map<String,Object>> selectRequestByDateAndDeptAndDoctor(@Param("requestDay") Date requestDay, @Param("ampms") List<String> ampms, @Param("unitCode") String unitCode, @Param("doctorCode") String doctorCode);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 删除号表数据
 | 
	
		
			
				|  |  | +     * @param id
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Delete("delete from mzy_request_new where id=#{id,jdbcType=BIGINT}")
 | 
	
		
			
				|  |  | +    int  deleteMzyRequestById(@Param("id") Long id);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |