导入删除
This commit is contained in:
parent
fe9f3d1668
commit
7916b9e835
@ -2,13 +2,16 @@ package com.xinelu.manage.controller.patientinfoimportmain;
|
||||
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimportmain.PatientInfoImportMain;
|
||||
import com.xinelu.manage.service.patientinfoimportmain.IPatientInfoImportMainService;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -29,6 +32,7 @@ public class PatientInfoImportMainController extends BaseController {
|
||||
|
||||
@Resource
|
||||
IPatientInfoImportMainService patientInfoImportMainService;
|
||||
|
||||
/**
|
||||
* 查询患者信息列表
|
||||
*/
|
||||
@ -41,5 +45,18 @@ public class PatientInfoImportMainController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询患者信息列表
|
||||
*/
|
||||
@ApiOperation("删除批次患者导入信息列表")
|
||||
@PostMapping("/updateSn")
|
||||
public AjaxResult updateSn(String sn) {
|
||||
return AjaxResult.success(patientInfoImportMainService.updateSn(sn));
|
||||
}
|
||||
|
||||
@ApiOperation("删除单个患者导入信息列表")
|
||||
@PostMapping("/updatePatientInfoImport")
|
||||
public AjaxResult updatePatientInfoImport(PatientInfoVo patientInfoVo) {
|
||||
return AjaxResult.success(patientInfoImportMainService.updatePatientInfoImport(patientInfoVo));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xinelu.manage.mapper.patientinfoimportmain;
|
||||
|
||||
import com.xinelu.manage.domain.patientinfoimportmain.PatientInfoImportMain;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -26,7 +27,6 @@ public interface PatientInfoImportMainMapper {
|
||||
List<PatientInfoImportMainVO> GetPatientInfoImport(PatientInfoImportMainVO patientInfoImport2VO);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询患者导入记录列表
|
||||
*
|
||||
@ -74,4 +74,92 @@ public interface PatientInfoImportMainMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePatientInfoImportMainImportStatus(PatientInfoImportMain patientInfoImportMain);
|
||||
|
||||
/**
|
||||
* 根据sn查询患者信息
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return Long
|
||||
*/
|
||||
List<Long> selectPatientInfoIds(String sn);
|
||||
|
||||
/**
|
||||
* 根据患者id修改患者表删除状态
|
||||
*
|
||||
* @param ids 患者id集合
|
||||
* @return int
|
||||
*/
|
||||
int updatePatientInfoByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据患者id修改患者就诊记录表信息
|
||||
*
|
||||
* @param ids 患者id集合
|
||||
* @return int
|
||||
*/
|
||||
int updatePatientVisitRecordByPatientIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据sn删除导入缓存表信息
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return int
|
||||
*/
|
||||
int deletePatientInfoImportBySn(String sn);
|
||||
|
||||
/**
|
||||
* 根据sn删除导入信息
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return int
|
||||
*/
|
||||
int deletePatientInfoImportMainBySn(String sn);
|
||||
|
||||
/**
|
||||
* 根据信息查询患者id
|
||||
*
|
||||
* @param patientInfoVo 患者信息
|
||||
* @return Long
|
||||
*/
|
||||
Long selectPatientInfoByMainVO(PatientInfoVo patientInfoVo);
|
||||
|
||||
/**
|
||||
* 根据患者id修改患者表删除状态
|
||||
*
|
||||
* @param id 患者id
|
||||
* @return int
|
||||
*/
|
||||
int updatePatientInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 根据患者id修改患者就诊记录表信息
|
||||
*
|
||||
* @param patientId 患者id
|
||||
* @return int
|
||||
*/
|
||||
int updatePatientVisitRecordByPatientId(Long patientId);
|
||||
|
||||
/**
|
||||
* 根据患者信息删除导入缓存表
|
||||
*
|
||||
* @param patientInfoVo 患者信息
|
||||
* @return int
|
||||
*/
|
||||
int deletePatientInfoImportByName(PatientInfoVo patientInfoVo);
|
||||
|
||||
/**
|
||||
* 根据患者信息删除导入表
|
||||
*
|
||||
* @param patientInfoVo 患者信息
|
||||
* @return int
|
||||
*/
|
||||
int deletePatientInfoImportMainByName(PatientInfoVo patientInfoVo);
|
||||
|
||||
/**
|
||||
* 根据sn 查询导入缓存表是否还有数据
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return int
|
||||
*/
|
||||
int selectPatientInfoImportCount(String sn);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xinelu.manage.service.patientinfoimportmain;
|
||||
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -9,4 +11,19 @@ public interface IPatientInfoImportMainService {
|
||||
|
||||
List<PatientInfoImportMainVO> GetPatientInfoImport(PatientInfoImportMainVO patientInfoImportMainVO);
|
||||
|
||||
/**
|
||||
* 删除批次导入信息
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult updateSn(String sn);
|
||||
|
||||
/**
|
||||
* 删除单个导入信息
|
||||
*
|
||||
* @param patientInfoVo 单个信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult updatePatientInfoImport(PatientInfoVo patientInfoVo);
|
||||
}
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
package com.xinelu.manage.service.patientinfoimportmain.impl;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
||||
import com.xinelu.manage.service.patientinfoimportmain.IPatientInfoImportMainService;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@Service
|
||||
@ -29,4 +34,50 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除批次导入信息
|
||||
*
|
||||
* @param sn 流水号
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult updateSn(String sn) {
|
||||
List<Long> list = patientInfoImportMainMapper.selectPatientInfoIds(sn);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
//修改患者表删除状态
|
||||
patientInfoImportMainMapper.updatePatientInfoByIds(list);
|
||||
//修改就诊表删除状态
|
||||
patientInfoImportMainMapper.updatePatientVisitRecordByPatientIds(list);
|
||||
}
|
||||
//删除患者导入信息表
|
||||
patientInfoImportMainMapper.deletePatientInfoImportBySn(sn);
|
||||
//删除患者导入记录表
|
||||
patientInfoImportMainMapper.deletePatientInfoImportMainBySn(sn);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个导入信息
|
||||
*
|
||||
* @param patientInfoVo 单个信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updatePatientInfoImport(PatientInfoVo patientInfoVo) {
|
||||
Long patientId = patientInfoImportMainMapper.selectPatientInfoByMainVO(patientInfoVo);
|
||||
if (Objects.nonNull(patientId)) {
|
||||
//修改患者表删除状态
|
||||
patientInfoImportMainMapper.updatePatientInfoById(patientId);
|
||||
//修改就诊表删除状态
|
||||
patientInfoImportMainMapper.updatePatientVisitRecordByPatientId(patientId);
|
||||
}
|
||||
//删除患者导入信息表
|
||||
patientInfoImportMainMapper.deletePatientInfoImportByName(patientInfoVo);
|
||||
int i = patientInfoImportMainMapper.selectPatientInfoImportCount(patientInfoVo.getSn());
|
||||
if (i == 0) {
|
||||
patientInfoImportMainMapper.deletePatientInfoImportMainBySn(patientInfoVo.getSn());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,9 @@
|
||||
</update>
|
||||
|
||||
<delete id="deletePatientInfoImportMainById" parameterType="Long">
|
||||
delete from patient_info_import_main where id = #{id}
|
||||
delete
|
||||
from patient_info_import_main
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePatientInfoImportMainByIds" parameterType="String">
|
||||
@ -211,4 +213,85 @@
|
||||
</trim>
|
||||
where sn = #{sn}
|
||||
</update>
|
||||
|
||||
<select id="selectPatientInfoIds" resultType="java.lang.Long">
|
||||
select id
|
||||
from patient_info
|
||||
where sn = #{sn}
|
||||
</select>
|
||||
|
||||
<update id="updatePatientInfoByIds">
|
||||
update patient_info set del_flag = 1 where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updatePatientVisitRecordByPatientIds">
|
||||
update patient_visit_record set del_flag = 1 where patient_id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deletePatientInfoImportBySn">
|
||||
delete
|
||||
from patient_info_import
|
||||
where sn = #{sn}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePatientInfoImportMainBySn">
|
||||
delete
|
||||
from patient_info_import_main
|
||||
where sn = #{sn}
|
||||
</delete>
|
||||
|
||||
<select id="selectPatientInfoByMainVO" resultType="java.lang.Long">
|
||||
select id from patient_info
|
||||
where sn = #{sn}
|
||||
and patient_phone = #{patientPhone}
|
||||
<if test="patientName != null">
|
||||
and patient_name = #{patientName}
|
||||
</if>
|
||||
<if test="departmentId != null ">
|
||||
and department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null ">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updatePatientInfoById">
|
||||
update patient_info
|
||||
set del_flag = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePatientVisitRecordByPatientId">
|
||||
update patient_visit_record
|
||||
set del_flag = 1
|
||||
where patient_id = #{patientId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePatientInfoImportByName">
|
||||
delete
|
||||
from patient_info_import
|
||||
where sn = #{sn}
|
||||
and patient_name = #{patientName}
|
||||
and patient_phone = #{patientPhone}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePatientInfoImportMainByName">
|
||||
delete
|
||||
from patient_info_import_main
|
||||
where sn = #{sn}
|
||||
and patient_name = #{patientName}
|
||||
and patient_phone =#{patientPhone}
|
||||
</delete>
|
||||
|
||||
<select id="selectPatientInfoImportCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from patient_info_import
|
||||
where sn = #{sn}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user