代码校验

This commit is contained in:
zhangheng 2024-03-06 13:12:11 +08:00
parent 91fda18892
commit 73e53d1df7
15 changed files with 313 additions and 114 deletions

View File

@ -89,7 +89,7 @@ public class AgencyController extends BaseController {
@Log(title = "机构信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Agency agency) {
return toAjax(agencyService.insertAgency(agency));
return agencyService.insertAgency(agency);
}
/**

View File

@ -108,7 +108,7 @@ public class DepartmentController extends BaseController {
@Log(title = "科室信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(departmentService.deleteDepartmentByIds(ids));
return departmentService.deleteDepartmentByIds(ids);
}
/**

View File

@ -88,4 +88,12 @@ public class DepartmentDiseaseTypeController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(departmentDiseaseTypeService.deleteDepartmentDiseaseTypeByIds(ids));
}
/**
* 科室病种数量
*/
@GetMapping("/selectDiseaseCount")
public AjaxResult selectDiseaseTypeCount(String departmentName) {
return departmentDiseaseTypeService.selectDiseaseTypeCount(departmentName);
}
}

View File

@ -70,6 +70,14 @@ public interface AgencyMapper {
*/
int updateAgency(Agency agency);
/**
* 修改机构信息
*
* @param agency 机构信息
* @return 结果
*/
int updateAgencyById(Agency agency);
/**
* 删除机构信息
*
@ -101,4 +109,7 @@ public interface AgencyMapper {
* @return int
**/
int insertAgencyImportList(List<Agency> agencyList);
int selectAgencyNameByAgencyNameInt(String agencyName);
}

View File

@ -56,6 +56,15 @@ public interface DepartmentMapper {
*/
int updateDepartment(Department department);
/**
* 修改科室信息
*
* @param department 科室信息
* @return 结果
*/
int updateDepartmentById(Department department);
/**
* 删除科室信息
*
@ -123,8 +132,17 @@ public interface DepartmentMapper {
/**
* 查询科室信息列表及包含服务包数量
*
* @param departmentDto
* @return
*/
List<DepartmentVO> selectListServicePackageNum(DepartmentDTO departmentDto);
/**
* 查询下级机构信息
*
* @param id 机构信息主键
* @return 机构信息
*/
List<Department> selectDepartmentByParentId(Long[] id);
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.departmentdiseasetype;
import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType;
import com.xinelu.manage.vo.department.DepartmentVO;
import java.util.List;
@ -59,4 +60,12 @@ public interface DepartmentDiseaseTypeMapper {
* @return 结果
*/
int deleteDepartmentDiseaseTypeByIds(Long[] ids);
/**
* 科室病种数量
*
* @param departmentName 科室名称
* @return DepartmentVO
*/
List<DepartmentVO> selectDiseaseTypeCount(String departmentName);
}

View File

@ -53,7 +53,7 @@ public interface IAgencyService {
* @param agency 机构信息
* @return 结果
*/
int insertAgency(Agency agency);
AjaxResult insertAgency(Agency agency);
/**
* 修改机构信息

View File

@ -109,10 +109,14 @@ public class AgencyServiceImpl implements IAgencyService {
* @return 结果
*/
@Override
public int insertAgency(Agency agency) {
public AjaxResult insertAgency(Agency agency) {
int i = agencyMapper.selectAgencyNameByAgencyNameInt(agency.getAgencyName());
if (i > 0) {
return AjaxResult.error("该名称" + agency.getAgencyName() + "以重复!");
}
agency.setCreateTime(DateUtils.getNowDate());
agency.setCreateBy(SecurityUtils.getUsername());
return agencyMapper.insertAgency(agency);
return AjaxResult.success(agencyMapper.insertAgency(agency));
}
/**
@ -125,7 +129,7 @@ public class AgencyServiceImpl implements IAgencyService {
public int updateAgency(Agency agency) {
agency.setUpdateTime(DateUtils.getNowDate());
agency.setUpdateBy(SecurityUtils.getUsername());
return agencyMapper.updateAgency(agency);
return agencyMapper.updateAgencyById(agency);
}
/**

View File

@ -62,7 +62,7 @@ public interface IDepartmentService {
* @param ids 需要删除的科室信息主键集合
* @return 结果
*/
int deleteDepartmentByIds(Long[] ids);
AjaxResult deleteDepartmentByIds(Long[] ids);
/**
* 删除科室信息信息

View File

@ -99,8 +99,9 @@ public class DepartmentServiceImpl implements IDepartmentService {
*/
@Override
public int updateDepartment(Department department) {
department.setUpdateBy(SecurityUtils.getUsername());
department.setUpdateTime(DateUtils.getNowDate());
return departmentMapper.updateDepartment(department);
return departmentMapper.updateDepartmentById(department);
}
/**
@ -110,8 +111,12 @@ public class DepartmentServiceImpl implements IDepartmentService {
* @return 结果
*/
@Override
public int deleteDepartmentByIds(Long[] ids) {
return departmentMapper.deleteDepartmentByIds(ids);
public AjaxResult deleteDepartmentByIds(Long[] ids) {
int size = departmentMapper.selectDepartmentByParentId(ids).size();
if (size > 0) {
return AjaxResult.error("该科室存在下级科室,请先删除其下级科室!");
}
return AjaxResult.success(departmentMapper.deleteDepartmentByIds(ids));
}
/**

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.departmentdiseasetype;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType;
import java.util.List;
@ -59,4 +60,12 @@ public interface IDepartmentDiseaseTypeService {
* @return 结果
*/
int deleteDepartmentDiseaseTypeById(Long id);
/**
* 科室病种信息信息
*
* @param departmentName 科室信息
* @return 结果
*/
AjaxResult selectDiseaseTypeCount(String departmentName);
}

View File

@ -1,12 +1,16 @@
package com.xinelu.manage.service.departmentdiseasetype.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType;
import com.xinelu.manage.mapper.departmentdiseasetype.DepartmentDiseaseTypeMapper;
import com.xinelu.manage.service.departmentdiseasetype.IDepartmentDiseaseTypeService;
import com.xinelu.manage.vo.department.DepartmentVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@ -88,4 +92,26 @@ public class DepartmentDiseaseTypeServiceImpl implements IDepartmentDiseaseTypeS
public int deleteDepartmentDiseaseTypeById(Long id) {
return departmentDiseaseTypeMapper.deleteDepartmentDiseaseTypeById(id);
}
/**
* 科室病种数量
*
* @param departmentName 科室名称
* @return DepartmentVO
*/
@Override
public AjaxResult selectDiseaseTypeCount(String departmentName) {
DepartmentVO departmentVO = new DepartmentVO();
List<DepartmentVO> department = new ArrayList<>();
departmentVO.setDepartmentName("全部");
departmentVO.setCountNum(0);
List<DepartmentVO> departmentVOS = departmentDiseaseTypeMapper.selectDiseaseTypeCount(departmentName);
if (CollectionUtils.isNotEmpty(departmentVOS)) {
Integer result = departmentVOS.stream().mapToInt(DepartmentVO::getCountNum).sum();
departmentVO.setCountNum(result);
department.add(departmentVO);
department.addAll(departmentVOS);
}
return AjaxResult.success(department);
}
}

View File

@ -317,6 +317,36 @@
where id = #{id}
</update>
<update id="updateAgencyById" parameterType="Agency">
update agency
<trim prefix="SET" suffixOverrides=",">
parent_id = #{parentId},
agency_category_id = #{agencyCategoryId},
agency_category_name = #{agencyCategoryName},
area_code = #{areaCode},
area_name = #{areaName},
<if test="agencyName != null">agency_name = #{agencyName},</if>
agency_code = #{agencyCode},
agency_abbreviation = #{agencyAbbreviation},
agency_status = #{agencyStatus},
node_type = #{nodeType},
org_agency_code = #{orgAgencyCode},
agency_category_manage_level = #{agencyCategoryManageLevel},
agency_contacts = #{agencyContacts},
agency_phone = #{agencyPhone},
agency_address = #{agencyAddress},
agency_remark = #{agencyRemark},
agency_sort = #{agencySort},
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAgencyById" parameterType="Long">
delete
from agency
@ -410,4 +440,10 @@
)
</foreach>
</insert>
<select id="selectAgencyNameByAgencyNameInt" resultType="java.lang.Integer">
select count(1)
from agency
where agency_name = #{agencyName}
</select>
</mapper>

View File

@ -541,6 +541,43 @@
where id = #{id}
</update>
<update id="updateDepartmentById" parameterType="Department">
update department
<trim prefix="SET" suffixOverrides=",">
parent_department_id = #{parentDepartmentId},
agency_id = #{agencyId},
agency_name = #{agencyName},
<if test="departmentName != null">department_name = #{departmentName},</if>
department_code =#{departmentCode},
department_type =#{departmentType},
department_abbreviation =#{departmentAbbreviation},
department_person_id =#{departmentPersonId},
department_person_name =#{departmentPersonName},
node_type =#{nodeType},
provide_service_category =#{provideServiceCategory},
subdivision_category_id =#{subdivisionCategoryId},
subdivision_category_name =#{subdivisionCategoryName},
norm_department_compare_id =#{normDepartmentCompareId},
norm_department_compare_name =#{normDepartmentCompareName},
prepare_beds_count =#{prepareBedsCount},
department_phone = #{departmentPhone},
department_mail = #{departmentMail},
<if test="establishDate != null">establish_date =
#{establishDate},
</if>
<if test="revokeDate != null">revoke_date =
#{revokeDate},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDepartmentById" parameterType="Long">
delete
from department
@ -553,4 +590,12 @@
#{id}
</foreach>
</delete>
<select id="selectDepartmentByParentId" resultType="com.xinelu.manage.domain.department.Department">
<include refid="selectDepartmentVo"/>
where parent_department_id =
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -5,141 +5,155 @@
<mapper namespace="com.xinelu.manage.mapper.departmentdiseasetype.DepartmentDiseaseTypeMapper">
<resultMap type="DepartmentDiseaseType" id="DepartmentDiseaseTypeResult">
<result property="id" column="id"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="diseaseTypeName" column="disease_type_name"/>
<result property="diseaseTypeCode" column="disease_type_code"/>
<result property="diagnosisInfo" column="diagnosis_info"/>
<result property="diseaseTypeRemark" column="disease_type_remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="id" column="id"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="diseaseTypeName" column="disease_type_name"/>
<result property="diseaseTypeCode" column="disease_type_code"/>
<result property="diagnosisInfo" column="diagnosis_info"/>
<result property="diseaseTypeRemark" column="disease_type_remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectDepartmentDiseaseTypeVo">
select id, department_id, department_name, disease_type_name, disease_type_code, diagnosis_info, disease_type_remark, create_by, create_time, update_by, update_time from department_disease_type
select id,
department_id,
department_name,
disease_type_name,
disease_type_code,
diagnosis_info,
disease_type_remark,
create_by,
create_time,
update_by,
update_time
from department_disease_type
</sql>
<select id="selectDepartmentDiseaseTypeList" parameterType="DepartmentDiseaseType" resultMap="DepartmentDiseaseTypeResult">
<select id="selectDepartmentDiseaseTypeList" parameterType="DepartmentDiseaseType"
resultMap="DepartmentDiseaseTypeResult">
<include refid="selectDepartmentDiseaseTypeVo"/>
<where>
<if test="departmentId != null ">
and department_id = #{departmentId}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name like concat('%', #{departmentName}, '%')
</if>
<if test="diseaseTypeName != null and diseaseTypeName != ''">
and disease_type_name like concat('%', #{diseaseTypeName}, '%')
</if>
<if test="diseaseTypeCode != null and diseaseTypeCode != ''">
and disease_type_code = #{diseaseTypeCode}
</if>
<if test="diagnosisInfo != null and diagnosisInfo != ''">
and diagnosis_info = #{diagnosisInfo}
</if>
<if test="diseaseTypeRemark != null and diseaseTypeRemark != ''">
and disease_type_remark = #{diseaseTypeRemark}
</if>
<if test="departmentId != null ">
and department_id = #{departmentId}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name like concat('%', #{departmentName}, '%')
</if>
<if test="diseaseTypeName != null and diseaseTypeName != ''">
and disease_type_name like concat('%', #{diseaseTypeName}, '%')
</if>
<if test="diseaseTypeCode != null and diseaseTypeCode != ''">
and disease_type_code = #{diseaseTypeCode}
</if>
<if test="diagnosisInfo != null and diagnosisInfo != ''">
and diagnosis_info = #{diagnosisInfo}
</if>
<if test="diseaseTypeRemark != null and diseaseTypeRemark != ''">
and disease_type_remark = #{diseaseTypeRemark}
</if>
</where>
</select>
<select id="selectDepartmentDiseaseTypeById" parameterType="Long"
resultMap="DepartmentDiseaseTypeResult">
<include refid="selectDepartmentDiseaseTypeVo"/>
where id = #{id}
<include refid="selectDepartmentDiseaseTypeVo"/>
where id = #{id}
</select>
<insert id="insertDepartmentDiseaseType" parameterType="DepartmentDiseaseType" useGeneratedKeys="true"
keyProperty="id">
insert into department_disease_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="departmentId != null">department_id,
</if>
<if test="departmentName != null">department_name,
</if>
<if test="diseaseTypeName != null">disease_type_name,
</if>
<if test="diseaseTypeCode != null">disease_type_code,
</if>
<if test="diagnosisInfo != null">diagnosis_info,
</if>
<if test="diseaseTypeRemark != null">disease_type_remark,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="departmentId != null">department_id,
</if>
<if test="departmentName != null">department_name,
</if>
<if test="diseaseTypeName != null">disease_type_name,
</if>
<if test="diseaseTypeCode != null">disease_type_code,
</if>
<if test="diagnosisInfo != null">diagnosis_info,
</if>
<if test="diseaseTypeRemark != null">disease_type_remark,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departmentId != null">#{departmentId},
</if>
<if test="departmentName != null">#{departmentName},
</if>
<if test="diseaseTypeName != null">#{diseaseTypeName},
</if>
<if test="diseaseTypeCode != null">#{diseaseTypeCode},
</if>
<if test="diagnosisInfo != null">#{diagnosisInfo},
</if>
<if test="diseaseTypeRemark != null">#{diseaseTypeRemark},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="departmentId != null">#{departmentId},
</if>
<if test="departmentName != null">#{departmentName},
</if>
<if test="diseaseTypeName != null">#{diseaseTypeName},
</if>
<if test="diseaseTypeCode != null">#{diseaseTypeCode},
</if>
<if test="diagnosisInfo != null">#{diagnosisInfo},
</if>
<if test="diseaseTypeRemark != null">#{diseaseTypeRemark},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateDepartmentDiseaseType" parameterType="DepartmentDiseaseType">
update department_disease_type
<trim prefix="SET" suffixOverrides=",">
<if test="departmentId != null">department_id =
#{departmentId},
</if>
<if test="departmentName != null">department_name =
#{departmentName},
</if>
<if test="diseaseTypeName != null">disease_type_name =
#{diseaseTypeName},
</if>
<if test="diseaseTypeCode != null">disease_type_code =
#{diseaseTypeCode},
</if>
<if test="diagnosisInfo != null">diagnosis_info =
#{diagnosisInfo},
</if>
<if test="diseaseTypeRemark != null">disease_type_remark =
#{diseaseTypeRemark},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="departmentId != null">department_id =
#{departmentId},
</if>
<if test="departmentName != null">department_name =
#{departmentName},
</if>
<if test="diseaseTypeName != null">disease_type_name =
#{diseaseTypeName},
</if>
<if test="diseaseTypeCode != null">disease_type_code =
#{diseaseTypeCode},
</if>
<if test="diagnosisInfo != null">diagnosis_info =
#{diagnosisInfo},
</if>
<if test="diseaseTypeRemark != null">disease_type_remark =
#{diseaseTypeRemark},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDepartmentDiseaseTypeById" parameterType="Long">
delete from department_disease_type where id = #{id}
delete
from department_disease_type
where id = #{id}
</delete>
<delete id="deleteDepartmentDiseaseTypeByIds" parameterType="String">
@ -148,4 +162,18 @@
#{id}
</foreach>
</delete>
<select id="selectDiseaseTypeCount" resultType="com.xinelu.manage.vo.department.DepartmentVO">
select dt.id,
dt.department_name,
dt.department_code,
count(ddt.id) AS countNum
from department dt left join department_disease_type ddt on dt.id = ddt.department_id
<where>
<if test="departmentName != null and departmentName != ''">
dt.department_name like concat('%',#{departmentName},'%')
</if>
</where>
GROUP BY dt.id
</select>
</mapper>