提交 51c3e31b 编写于 作者: rushui.chen's avatar rushui.chen

20191025 添加删除医生的接口

上级 44b1028a
流水线 #16310 已失败 于阶段
in 2 second
...@@ -72,8 +72,10 @@ public class DoctorController extends AccountBaseController { ...@@ -72,8 +72,10 @@ public class DoctorController extends AccountBaseController {
} }
@ApiOperation("客服系统删除医生信息")
// public PicaResponse deleteDoctor(){ @GetMapping(value = "/delete/{id}")
// public PicaResponse deleteDoctor(@PathVariable("id") Integer id) {
// } doctorService.deleteDoctorInfo(id);
return PicaResponse.toResponse();
}
} }
...@@ -49,4 +49,5 @@ public interface AccountInfoDetailMapper { ...@@ -49,4 +49,5 @@ public interface AccountInfoDetailMapper {
int insertSelective(AccountInfoEntity record); int insertSelective(AccountInfoEntity record);
void updateDeleteByPrimaryKey(Integer acctId);
} }
...@@ -73,6 +73,8 @@ public interface DoctorMapper { ...@@ -73,6 +73,8 @@ public interface DoctorMapper {
PICAPDoctor queryDoctor(long doctorId); PICAPDoctor queryDoctor(long doctorId);
void updateDeleteByPrimaryKey(Integer id);
/** /**
* 通过手机号获取用户id * 通过手机号获取用户id
* @param mobile * @param mobile
......
...@@ -24,6 +24,13 @@ public interface DoctorService { ...@@ -24,6 +24,13 @@ public interface DoctorService {
*/ */
void modifyDoctorInfo(Doctor doctor); void modifyDoctorInfo(Doctor doctor);
/**
* 修改医生信息
*
* @param id 待修改数据
*/
void deleteDoctorInfo(Integer id);
/** /**
* 客服系统新增医生用户 * 客服系统新增医生用户
* *
......
...@@ -35,6 +35,7 @@ public class AccountServiceImpl implements AccountService { ...@@ -35,6 +35,7 @@ public class AccountServiceImpl implements AccountService {
@Autowired @Autowired
private AccountMapper accountMapper; private AccountMapper accountMapper;
@Autowired @Autowired
private AccountInfoDetailMapper accountInfoDetailMapper; private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired @Autowired
......
...@@ -41,15 +41,15 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -41,15 +41,15 @@ public class DoctorServiceImpl implements DoctorService {
@Override @Override
public void modifyDoctorInfo(Doctor doctor) { public void modifyDoctorInfo(Doctor doctor) {
Integer id = doctor.getId(); Integer id = doctor.getId();
if (id==null){ if (id == null) {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR); throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
} }
Doctor entity = doctorMapper.selectByPrimaryKey(id); Doctor entity = doctorMapper.selectByPrimaryKey(id);
if (entity==null){ if (entity == null) {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST); throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
} }
String mobilePhone = doctor.getMobilePhone(); String mobilePhone = doctor.getMobilePhone();
if (!StringUtils.isBlank(mobilePhone)){ if (!StringUtils.isBlank(mobilePhone)) {
AccountUtils.checkMobilePhone(doctor.getMobilePhone()); AccountUtils.checkMobilePhone(doctor.getMobilePhone());
} }
doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone)); doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone));
...@@ -57,6 +57,16 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -57,6 +57,16 @@ public class DoctorServiceImpl implements DoctorService {
doctorMapper.updateByPrimaryKeySelective(doctor); doctorMapper.updateByPrimaryKeySelective(doctor);
} }
@Transactional
@Override
public void deleteDoctorInfo(Integer id) {
//p_doctor表修改记录状态
doctorMapper.updateDeleteByPrimaryKey(id);
Doctor doctor = doctorMapper.selectByPrimaryKey(id);
Integer acctId = doctor.getAcctId();
accountInfoDetailMapper.updateDeleteByPrimaryKey(acctId);
}
/** /**
* 客服管理后台添加医生 * 客服管理后台添加医生
* 1)当前医生信息是否存在,如果已经存在直接抛出异常; * 1)当前医生信息是否存在,如果已经存在直接抛出异常;
......
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId} update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
</update> </update>
<!--逻辑删除用户-->
<update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer">
update account_info set delete_flag=2,modified_time=now(), modified_id=#{acctId} where id=#{acctId}
</update>
<!--更新用户的手机号--> <!--更新用户的手机号-->
<update id="updateMobileByPrimaryKey" <update id="updateMobileByPrimaryKey"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity"> parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
......
...@@ -92,7 +92,8 @@ ...@@ -92,7 +92,8 @@
<!--通过手机号码查询医生信息--> <!--通过手机号码查询医生信息-->
<select id="getDoctorInfoByMobile" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="getDoctorInfoByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/> SELECT
<include refid="Base_Column_List"/>
FROM p_doctor FROM p_doctor
where mobile_phone = #{phone} where mobile_phone = #{phone}
and delete_flag = 1 and delete_flag = 1
...@@ -105,6 +106,11 @@ ...@@ -105,6 +106,11 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<!--删除用户-->
<update id="updateDeleteByPrimaryKey" parameterType="java.lang.Integer">
update p_doctor set delete_flag=2,modify_time=now(), modify_id=#{id} where id=#{id} limit 1
</update>
<!--根据手机号获取数据--> <!--根据手机号获取数据-->
<!--<select id="getDoctorInfoByMobile" resultType="com.pica.cloud.account.account.server.entity.DoctorEntity"--> <!--<select id="getDoctorInfoByMobile" resultType="com.pica.cloud.account.account.server.entity.DoctorEntity"-->
<!--parameterType="java.lang.String">--> <!--parameterType="java.lang.String">-->
...@@ -323,7 +329,6 @@ ...@@ -323,7 +329,6 @@
</update> </update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from p_doctor delete from p_doctor
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
...@@ -372,7 +377,8 @@ ...@@ -372,7 +377,8 @@
#{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER} #{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor"
useGeneratedKeys="true" keyProperty="id">
insert into p_doctor insert into p_doctor
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -926,7 +932,6 @@ ...@@ -926,7 +932,6 @@
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.Doctor"> <update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor update p_doctor
set sex = #{sex,jdbcType=INTEGER}, set sex = #{sex,jdbcType=INTEGER},
...@@ -1003,7 +1008,8 @@ ...@@ -1003,7 +1008,8 @@
where acct_id = #{acctId} where acct_id = #{acctId}
</update> </update>
<select id="queryDoctor" resultType="com.pica.cloud.account.account.server.entity.PICAPDoctor" parameterType="java.lang.Long"> <select id="queryDoctor" resultType="com.pica.cloud.account.account.server.entity.PICAPDoctor"
parameterType="java.lang.Long">
SELECT aa.id, aa.sex, aa.name, aa.mobile_phone, aa.status, SELECT aa.id, aa.sex, aa.name, aa.mobile_phone, aa.status,
aa.type, aa.hospital_id, aa.department_id, aa.title_id,aa.card, aa.type, aa.hospital_id, aa.department_id, aa.title_id,aa.card,
aa.hospital as hospital, aa.department, aa.title, aa.cert_image_url, aa.hospital as hospital, aa.department, aa.title, aa.cert_image_url,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册