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

20191025 添加删除医生的接口

上级 44b1028a
流水线 #16310 已失败 于阶段
in 2 second
......@@ -72,8 +72,10 @@ public class DoctorController extends AccountBaseController {
}
// public PicaResponse deleteDoctor(){
//
// }
@ApiOperation("客服系统删除医生信息")
@GetMapping(value = "/delete/{id}")
public PicaResponse deleteDoctor(@PathVariable("id") Integer id) {
doctorService.deleteDoctorInfo(id);
return PicaResponse.toResponse();
}
}
......@@ -49,4 +49,5 @@ public interface AccountInfoDetailMapper {
int insertSelective(AccountInfoEntity record);
void updateDeleteByPrimaryKey(Integer acctId);
}
......@@ -73,6 +73,8 @@ public interface DoctorMapper {
PICAPDoctor queryDoctor(long doctorId);
void updateDeleteByPrimaryKey(Integer id);
/**
* 通过手机号获取用户id
* @param mobile
......
......@@ -24,6 +24,13 @@ public interface DoctorService {
*/
void modifyDoctorInfo(Doctor doctor);
/**
* 修改医生信息
*
* @param id 待修改数据
*/
void deleteDoctorInfo(Integer id);
/**
* 客服系统新增医生用户
*
......
......@@ -35,6 +35,7 @@ public class AccountServiceImpl implements AccountService {
@Autowired
private AccountMapper accountMapper;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
......
......@@ -41,15 +41,15 @@ public class DoctorServiceImpl implements DoctorService {
@Override
public void modifyDoctorInfo(Doctor doctor) {
Integer id = doctor.getId();
if (id==null){
if (id == null) {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
Doctor entity = doctorMapper.selectByPrimaryKey(id);
if (entity==null){
if (entity == null) {
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
}
String mobilePhone = doctor.getMobilePhone();
if (!StringUtils.isBlank(mobilePhone)){
if (!StringUtils.isBlank(mobilePhone)) {
AccountUtils.checkMobilePhone(doctor.getMobilePhone());
}
doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone));
......@@ -57,6 +57,16 @@ public class DoctorServiceImpl implements DoctorService {
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)当前医生信息是否存在,如果已经存在直接抛出异常;
......
......@@ -43,6 +43,11 @@
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
</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"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
......
......@@ -92,10 +92,11 @@
<!--通过手机号码查询医生信息-->
<select id="getDoctorInfoByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM p_doctor
where mobile_phone = #{phone}
and delete_flag = 1
SELECT
<include refid="Base_Column_List"/>
FROM p_doctor
where mobile_phone = #{phone}
and delete_flag = 1
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
......@@ -105,36 +106,41 @@
where id = #{id,jdbcType=INTEGER}
</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"-->
<!--parameterType="java.lang.String">-->
<!--SELECT aa.id, aa.sex, aa.unionid, aa.name, aa.mobile_phone, aa.status, aa.type, aa.hospital_id, aa.department_id,-->
<!--aa.title_id, ifnull(bb.name,aa.hospital) as hospital,-->
<!--ifnull(pde.name,aa.department) as department, ifnull(pt.name,aa.title) as title, aa.cert_image_url,-->
<!--aa.avatar_image_url, aa.auth_time, aa.invite_start_time, aa.honor, aa.skills, aa.thumb_up_num, aa.email,-->
<!--aa.qrcode, aa.nickname, aa.personal_sign, aa.delete_flag, aa.creat_id, aa.creat_time, aa.modify_id,-->
<!--aa.modify_time, aa.praise_num, aa.password, aa.info, aa.rank, aa.province, aa.city, aa.county,-->
<!--aa.province_name, aa.city_name, aa.county_name,-->
<!--aa.invite_code, aa.gaoxueya_password, aa.sms_send_num, aa.total_sms_send_num, aa.entire_flag, aa.doctor_project_type,-->
<!--aa.administer_title_id, aa.administer_title,-->
<!--pded.school_name, pded.major_id, pded.major_name, pded.education_id, pded.education_name, pded.year-->
<!--FROM-->
<!--p_doctor aa-->
<!--left join-->
<!--p_hospital bb-->
<!--on aa.hospital_id = bb.id and bb.delete_flag=1-->
<!--left join-->
<!--p_title pt-->
<!--on aa.title_id = pt.title_id-->
<!--left join-->
<!--p_department pde-->
<!--on aa.department_id = pde.id-->
<!--left join-->
<!--p_doctor_education pded-->
<!--on pded.doctor_id = aa.id-->
<!--where aa.mobile_phone = #{mobile}-->
<!--and aa.delete_flag = 1-->
<!--limit 0,1-->
<!--parameterType="java.lang.String">-->
<!--SELECT aa.id, aa.sex, aa.unionid, aa.name, aa.mobile_phone, aa.status, aa.type, aa.hospital_id, aa.department_id,-->
<!--aa.title_id, ifnull(bb.name,aa.hospital) as hospital,-->
<!--ifnull(pde.name,aa.department) as department, ifnull(pt.name,aa.title) as title, aa.cert_image_url,-->
<!--aa.avatar_image_url, aa.auth_time, aa.invite_start_time, aa.honor, aa.skills, aa.thumb_up_num, aa.email,-->
<!--aa.qrcode, aa.nickname, aa.personal_sign, aa.delete_flag, aa.creat_id, aa.creat_time, aa.modify_id,-->
<!--aa.modify_time, aa.praise_num, aa.password, aa.info, aa.rank, aa.province, aa.city, aa.county,-->
<!--aa.province_name, aa.city_name, aa.county_name,-->
<!--aa.invite_code, aa.gaoxueya_password, aa.sms_send_num, aa.total_sms_send_num, aa.entire_flag, aa.doctor_project_type,-->
<!--aa.administer_title_id, aa.administer_title,-->
<!--pded.school_name, pded.major_id, pded.major_name, pded.education_id, pded.education_name, pded.year-->
<!--FROM-->
<!--p_doctor aa-->
<!--left join-->
<!--p_hospital bb-->
<!--on aa.hospital_id = bb.id and bb.delete_flag=1-->
<!--left join-->
<!--p_title pt-->
<!--on aa.title_id = pt.title_id-->
<!--left join-->
<!--p_department pde-->
<!--on aa.department_id = pde.id-->
<!--left join-->
<!--p_doctor_education pded-->
<!--on pded.doctor_id = aa.id-->
<!--where aa.mobile_phone = #{mobile}-->
<!--and aa.delete_flag = 1-->
<!--limit 0,1-->
<!--</select>-->
<!--通过账户id更新用户信息-->
......@@ -323,7 +329,6 @@
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from p_doctor
where id = #{id,jdbcType=INTEGER}
......@@ -372,7 +377,8 @@
#{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}
)
</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
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -926,7 +932,6 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.Doctor">
update p_doctor
set sex = #{sex,jdbcType=INTEGER},
......@@ -1003,7 +1008,8 @@
where acct_id = #{acctId}
</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,
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,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册