修改就诊记录日期查询及添加患者手机号唯一校验

master
chenfei 2 years ago
parent 97624a399a
commit 73fb025a5f

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.api; package com.ruoyi.web.controller.api;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
@ -173,6 +174,9 @@ public class AppController extends BaseController
{ {
TPatient tPatient = new TPatient(); TPatient tPatient = new TPatient();
BeanUtils.copyProperties(appPatientReq, tPatient); BeanUtils.copyProperties(appPatientReq, tPatient);
if(UserConstants.NOT_UNIQUE.equals(tPatientService.checkPhoneUnique(tPatient.getPhone()))){
return AjaxResult.error("手机号已注册");
}
tPatientService.insertTPatient(tPatient); tPatientService.insertTPatient(tPatient);
Long identifier = 10000000L + tPatient.getId(); Long identifier = 10000000L + tPatient.getId();
tPatient.setIdentifier(String.valueOf(identifier)); tPatient.setIdentifier(String.valueOf(identifier));

@ -43,10 +43,10 @@ public class TRecordResultReq
@ApiModelProperty("待诊日期开始时间") @ApiModelProperty("待诊日期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private String startTime;
@ApiModelProperty("待诊日期结束时间") @ApiModelProperty("待诊日期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime; private String endTime;
public String getName() public String getName()
{ {
@ -149,22 +149,22 @@ public class TRecordResultReq
this.createTime = createTime; this.createTime = createTime;
} }
public Date getStartTime() public String getStartTime()
{ {
return startTime; return startTime;
} }
public void setStartTime(Date startTime) public void setStartTime(String startTime)
{ {
this.startTime = startTime; this.startTime = startTime;
} }
public Date getEndTime() public String getEndTime()
{ {
return endTime; return endTime;
} }
public void setEndTime(Date endTime) public void setEndTime(String endTime)
{ {
this.endTime = endTime; this.endTime = endTime;
} }

@ -8,7 +8,7 @@ import tk.mybatis.mapper.common.Mapper;
/** /**
* Mapper * Mapper
* *
* @author ruoyi * @author ruoyi
* @date 2022-08-03 * @date 2022-08-03
*/ */
@ -16,7 +16,7 @@ public interface TPatientMapper
{ {
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -24,7 +24,7 @@ public interface TPatientMapper
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -32,7 +32,7 @@ public interface TPatientMapper
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -40,7 +40,7 @@ public interface TPatientMapper
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -48,7 +48,7 @@ public interface TPatientMapper
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -56,7 +56,7 @@ public interface TPatientMapper
/** /**
* *
* *
* @param ids * @param ids
* @return * @return
*/ */
@ -65,4 +65,6 @@ public interface TPatientMapper
public TPatient queryTPatient(TPatient tPatient); public TPatient queryTPatient(TPatient tPatient);
List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq); List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq);
int checkPhoneUnique(String phone);
} }

@ -62,4 +62,6 @@ public interface ITPatientService
public int deleteTPatientById(Long id); public int deleteTPatientById(Long id);
List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq); List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq);
String checkPhoneUnique(String phone);
} }

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq; import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq;
import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp; import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp;
@ -12,19 +14,19 @@ import com.ruoyi.system.service.ITPatientService;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2022-08-03 * @date 2022-08-03
*/ */
@Service @Service
public class TPatientServiceImpl implements ITPatientService public class TPatientServiceImpl implements ITPatientService
{ {
@Autowired @Autowired
private TPatientMapper tPatientMapper; private TPatientMapper tPatientMapper;
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -36,7 +38,7 @@ public class TPatientServiceImpl implements ITPatientService
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -48,7 +50,7 @@ public class TPatientServiceImpl implements ITPatientService
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -61,7 +63,7 @@ public class TPatientServiceImpl implements ITPatientService
/** /**
* *
* *
* @param tPatient * @param tPatient
* @return * @return
*/ */
@ -74,7 +76,7 @@ public class TPatientServiceImpl implements ITPatientService
/** /**
* *
* *
* @param ids * @param ids
* @return * @return
*/ */
@ -86,7 +88,7 @@ public class TPatientServiceImpl implements ITPatientService
/** /**
* *
* *
* @param id * @param id
* @return * @return
*/ */
@ -100,4 +102,15 @@ public class TPatientServiceImpl implements ITPatientService
public List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) { public List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) {
return tPatientMapper.queryByPage(pcTPatintQueryByPageReq); return tPatientMapper.queryByPage(pcTPatintQueryByPageReq);
} }
@Override
public String checkPhoneUnique(String phone)
{
int count = tPatientMapper.checkPhoneUnique(phone);
if (count > 0)
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
} }

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.TPatientMapper"> <mapper namespace="com.ruoyi.system.mapper.TPatientMapper">
<resultMap type="TPatient" id="TPatientResult"> <resultMap type="TPatient" id="TPatientResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="openId" column="open_id" /> <result property="openId" column="open_id" />
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTPatientList" parameterType="TPatient" resultMap="TPatientResult"> <select id="selectTPatientList" parameterType="TPatient" resultMap="TPatientResult">
<include refid="selectTPatientVo"/> <include refid="selectTPatientVo"/>
<where> <where>
<if test="openId != null and openId != ''"> and open_id = #{openId}</if> <if test="openId != null and openId != ''"> and open_id = #{openId}</if>
<if test="identifier != null and identifier != ''"> and identifier = #{identifier}</if> <if test="identifier != null and identifier != ''"> and identifier = #{identifier}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
@ -40,12 +40,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="disease != null and disease != ''"> and disease = #{disease}</if> <if test="disease != null and disease != ''"> and disease = #{disease}</if>
</where> </where>
</select> </select>
<select id="selectTPatientById" parameterType="Long" resultMap="TPatientResult"> <select id="selectTPatientById" parameterType="Long" resultMap="TPatientResult">
<include refid="selectTPatientVo"/> <include refid="selectTPatientVo"/>
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertTPatient" parameterType="TPatient" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTPatient" parameterType="TPatient" useGeneratedKeys="true" keyProperty="id">
insert into t_patient insert into t_patient
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTPatientByIds" parameterType="String"> <delete id="deleteTPatientByIds" parameterType="String">
delete from t_patient where id in delete from t_patient where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -152,4 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>
</mapper>
<select id="checkPhoneUnique" parameterType="String" resultType="int">
select count(1) from t_patient where phone = #{phone} limit 1
</select>
</mapper>

@ -202,10 +202,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null"> <if test="createTime != null">
and DATE_FORMAT(tp.create_time,'%Y-%m') = DATE_FORMAT(#{createTime},'%Y-%m') and DATE_FORMAT(tp.create_time,'%Y-%m') = DATE_FORMAT(#{createTime},'%Y-%m')
</if> </if>
<if test="startTime != null and endTime != null"> <if test="startTime != null and startTime != '' and endTime == null "> and tr.create_time &gt;= #{startTime}</if>
AND tr.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s') <if test="startTime == null and endTime != '' and endTime != null "> and tr.create_time &lt;= #{endTime}</if>
</if> <if test="startTime != null and endTime != null "> and tr.create_time between #{startTime} and #{endTime}</if>
<if test="startTime != null and endTime != null"></if>
<if test="doctorOder !=null and firstVisitOder!=null" >order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}</if> <if test="doctorOder !=null and firstVisitOder!=null" >order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}</if>
</where> </where>
</select> </select>

Loading…
Cancel
Save