Merge remote-tracking branch 'lis8.0/master'
This commit is contained in:
commit
140bcc5a35
@ -0,0 +1,107 @@
|
|||||||
|
package com.czlis.transitPF.controller.dict;
|
||||||
|
|
||||||
|
import com.czlis.common.annotation.Log;
|
||||||
|
import com.czlis.common.core.controller.BaseController;
|
||||||
|
import com.czlis.common.core.domain.AjaxResult;
|
||||||
|
import com.czlis.common.core.page.TableDataInfo;
|
||||||
|
import com.czlis.common.enums.BusinessType;
|
||||||
|
import com.czlis.common.utils.poi.ExcelUtil;
|
||||||
|
import com.czlis.transitPF.pojo.RegHospital;
|
||||||
|
import com.czlis.transitPF.service.RegHospitalService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Api(tags = "区域检验中心-医疗机构字典管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/transitdict/hospital")
|
||||||
|
@Slf4j
|
||||||
|
public class HospitalController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private RegHospitalService sysHospitalService;
|
||||||
|
/**
|
||||||
|
* 获取医疗机构列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取医疗机构列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(RegHospital post) {
|
||||||
|
startPage();
|
||||||
|
List<RegHospital> list = sysHospitalService.selectHospitalList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
@ApiOperation("医疗机构导出")
|
||||||
|
@Log(title = "医疗机构导出", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, RegHospital post) {
|
||||||
|
List<RegHospital> list = sysHospitalService.selectHospitalList(post);
|
||||||
|
ExcelUtil<RegHospital> util = new ExcelUtil<>(RegHospital.class);
|
||||||
|
util.exportExcel(response, list, "医疗机构数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据医疗机构编号获取详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取详细信息")
|
||||||
|
@GetMapping(value = "/{hospitalId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long hospitalId) {
|
||||||
|
return success(sysHospitalService.selectHospitalById(hospitalId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增医疗机构
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增医疗机构")
|
||||||
|
@Log(title = "医疗机构管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody RegHospital post) {
|
||||||
|
if (!sysHospitalService.checkHospitalNameUnique(post)) {
|
||||||
|
return error("新增医疗机构'" + post.getHospitalName() + "'失败,医疗机构名称已存在");
|
||||||
|
} else if (!sysHospitalService.checkHospitalCodeUnique(post)) {
|
||||||
|
return error("新增医疗机构'" + post.getHospitalName() + "'失败,医疗机构编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(getUsername());
|
||||||
|
return toAjax(sysHospitalService.insertHospital(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改医疗机构
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改医疗机构")
|
||||||
|
@Log(title = "医疗机构管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody RegHospital post) {
|
||||||
|
if (!sysHospitalService.checkHospitalNameUnique(post)) {
|
||||||
|
return error("修改医疗机构'" + post.getHospitalName() + "'失败,医疗机构名称已存在");
|
||||||
|
} else if (!sysHospitalService.checkHospitalCodeUnique(post)) {
|
||||||
|
return error("修改医疗机构'" + post.getHospitalName() + "'失败,医疗机构编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(getUsername());
|
||||||
|
return toAjax(sysHospitalService.updateHospital(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除医疗机构
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除医疗机构")
|
||||||
|
@Log(title = "医疗机构管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{hospitalIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] hospitalIds) {
|
||||||
|
return toAjax(sysHospitalService.deleteHospitalByIds(hospitalIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取医疗机构选择框列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取医疗机构选择框列表")
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect() {
|
||||||
|
List<RegHospital> posts = sysHospitalService.selectHospitalAll();
|
||||||
|
return success(posts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.czlis.transitPF.mapper;
|
||||||
|
|
||||||
|
import com.czlis.transitPF.pojo.RegHospital;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RegHospitalMapper {
|
||||||
|
/**
|
||||||
|
* 查询医疗机构数据集合
|
||||||
|
*
|
||||||
|
* @param hospital 医疗机构信息
|
||||||
|
* @return 医疗机构数据集合
|
||||||
|
*/
|
||||||
|
public List<RegHospital> selectHospitalList(RegHospital hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有医疗机构
|
||||||
|
*
|
||||||
|
* @return 医疗机构列表
|
||||||
|
*/
|
||||||
|
public List<RegHospital> selectHospitalAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过医疗机构ID查询医疗机构信息
|
||||||
|
*
|
||||||
|
* @param hospitalId 医疗机构ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
public RegHospital selectHospitalById(Long hospitalId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取医疗机构选择框列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 选中医疗机构ID列表
|
||||||
|
*/
|
||||||
|
// public List<Long> selectHospitalListByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户所属医疗机构组
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
// public List<SysHospital> selectHospitalsByUserName(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param hospitalId 医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHospitalById(Long hospitalId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param hospitalIds 需要删除的医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHospitalByIds(Long[] hospitalIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改医疗机构信息
|
||||||
|
*
|
||||||
|
* @param hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHospital(RegHospital hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增医疗机构信息
|
||||||
|
*
|
||||||
|
* @param hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHospital(RegHospital hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构名称
|
||||||
|
*
|
||||||
|
* @param hospitalName 医疗机构名称
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public RegHospital checkHospitalNameUnique(String hospitalName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构编码
|
||||||
|
*
|
||||||
|
* @param hospitalCode 医疗机构编码
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public RegHospital checkHospitalCodeUnique(String hospitalCode);
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.czlis.transitPF.pojo;
|
||||||
|
|
||||||
|
import com.czlis.common.annotation.Excel;
|
||||||
|
import com.czlis.common.core.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class RegHospital extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 医疗机构序号
|
||||||
|
*/
|
||||||
|
@Excel(name = "医疗机构序号", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
private Long hospitalId;
|
||||||
|
/**
|
||||||
|
* 医疗机构编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "医疗机构编码")
|
||||||
|
private String hospitalCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医疗机构名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "医疗机构名称")
|
||||||
|
private String hospitalName;
|
||||||
|
/**
|
||||||
|
* 医疗机构排序
|
||||||
|
*/
|
||||||
|
@Excel(name = "接口平台密钥")
|
||||||
|
private String hospitalUserinfo;
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.czlis.transitPF.service;
|
||||||
|
|
||||||
|
import com.czlis.transitPF.pojo.RegHospital;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface RegHospitalService {
|
||||||
|
/**
|
||||||
|
* 查询医疗机构信息集合
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 医疗机构列表
|
||||||
|
*/
|
||||||
|
public List<RegHospital> selectHospitalList(RegHospital Hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有医疗机构
|
||||||
|
*
|
||||||
|
* @return 医疗机构列表
|
||||||
|
*/
|
||||||
|
public List<RegHospital> selectHospitalAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过医疗机构ID查询医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
public RegHospital selectHospitalById(Long HospitalId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取医疗机构选择框列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 选中医疗机构ID列表
|
||||||
|
*/
|
||||||
|
public List<Long> selectHospitalListByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构名称
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public boolean checkHospitalNameUnique(RegHospital Hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构编码
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public boolean checkHospitalCodeUnique(RegHospital Hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过医疗机构ID查询医疗机构使用数量
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int countUserHospitalById(Long HospitalId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHospitalById(Long HospitalId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalIds 需要删除的医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHospitalByIds(Long[] HospitalIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存医疗机构信息
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHospital(RegHospital Hospital);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存医疗机构信息
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHospital(RegHospital Hospital);
|
||||||
|
}
|
||||||
@ -0,0 +1,156 @@
|
|||||||
|
package com.czlis.transitPF.service.impl;
|
||||||
|
|
||||||
|
import com.czlis.common.constant.UserConstants;
|
||||||
|
import com.czlis.common.exception.ServiceException;
|
||||||
|
import com.czlis.common.utils.StringUtils;
|
||||||
|
import com.czlis.transitPF.mapper.RegHospitalMapper;
|
||||||
|
import com.czlis.transitPF.pojo.RegHospital;
|
||||||
|
import com.czlis.transitPF.service.RegHospitalService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class RegHospitalServiceImpl implements RegHospitalService {
|
||||||
|
@Autowired
|
||||||
|
RegHospitalMapper hospitalMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询医疗机构信息集合
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 医疗机构信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegHospital> selectHospitalList(RegHospital Hospital) {
|
||||||
|
return hospitalMapper.selectHospitalList(Hospital);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有医疗机构
|
||||||
|
*
|
||||||
|
* @return 医疗机构列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RegHospital> selectHospitalAll() {
|
||||||
|
return hospitalMapper.selectHospitalAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过医疗机构ID查询医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 角色对象信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RegHospital selectHospitalById(Long HospitalId) {
|
||||||
|
return hospitalMapper.selectHospitalById(HospitalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取医疗机构选择框列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 选中医疗机构ID列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Long> selectHospitalListByUserId(Long userId) {
|
||||||
|
return null;//hospitalMapper.selectHospitalListByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构名称是否唯一
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkHospitalNameUnique(RegHospital Hospital) {
|
||||||
|
Long HospitalId = StringUtils.isNull(Hospital.getHospitalId()) ? -1L : Hospital.getHospitalId();
|
||||||
|
RegHospital info = hospitalMapper.checkHospitalNameUnique(Hospital.getHospitalName());
|
||||||
|
if (StringUtils.isNotNull(info) && info.getHospitalId().longValue() != HospitalId.longValue()) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验医疗机构编码是否唯一
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkHospitalCodeUnique(RegHospital Hospital) {
|
||||||
|
Long HospitalId = StringUtils.isNull(Hospital.getHospitalId()) ? -1L : Hospital.getHospitalId();
|
||||||
|
RegHospital info = hospitalMapper.checkHospitalCodeUnique(Hospital.getHospitalCode());
|
||||||
|
if (StringUtils.isNotNull(info) && info.getHospitalId().longValue() != HospitalId.longValue()) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过医疗机构ID查询医疗机构使用数量
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int countUserHospitalById(Long HospitalId) {
|
||||||
|
return 0;//hospitalMapper.countUserHospitalById(HospitalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalId 医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteHospitalById(Long HospitalId) {
|
||||||
|
return hospitalMapper.deleteHospitalById(HospitalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除医疗机构信息
|
||||||
|
*
|
||||||
|
* @param HospitalIds 需要删除的医疗机构ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteHospitalByIds(Long[] HospitalIds) {
|
||||||
|
for (Long HospitalId : HospitalIds) {
|
||||||
|
RegHospital Hospital = selectHospitalById(HospitalId);
|
||||||
|
if (countUserHospitalById(HospitalId) > 0) {
|
||||||
|
throw new ServiceException(String.format("%1$s已分配,不能删除", Hospital.getHospitalName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hospitalMapper.deleteHospitalByIds(HospitalIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存医疗机构信息
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertHospital(RegHospital Hospital) {
|
||||||
|
return hospitalMapper.insertHospital(Hospital);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存医疗机构信息
|
||||||
|
*
|
||||||
|
* @param Hospital 医疗机构信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateHospital(RegHospital Hospital) {
|
||||||
|
return hospitalMapper.updateHospital(Hospital);
|
||||||
|
}
|
||||||
|
}
|
||||||
110
transitPF/src/main/resources/mapper/SysHospitalMapper.xml
Normal file
110
transitPF/src/main/resources/mapper/SysHospitalMapper.xml
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czlis.transitPF.mapper.RegHospitalMapper">
|
||||||
|
<resultMap type="RegHospital" id="RegHospitalResult">
|
||||||
|
<id property="hospitalId" column="hospital_id" />
|
||||||
|
<result property="hospitalCode" column="hospital_code" />
|
||||||
|
<result property="hospitalName" column="hospital_name" />
|
||||||
|
<result property="hospitalUserinfo" column="hospital_userinfo" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<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="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selecthospitalVo">
|
||||||
|
select hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
||||||
|
from Reg_hospital
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectHospitalList" parameterType="RegHospital" resultMap="RegHospitalResult">
|
||||||
|
<include refid="selecthospitalVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="hospitalCode != null and hospitalCode != ''">
|
||||||
|
AND hospital_code like '%'+#{hospitalCode}+'%'
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="hospitalName != null and hospitalName != ''">
|
||||||
|
AND hospital_name like '%'+#{hospitalName}+'%'
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHospitalAll" resultMap="RegHospitalResult">
|
||||||
|
<include refid="selecthospitalVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHospitalById" parameterType="Long" resultMap="RegHospitalResult">
|
||||||
|
<include refid="selecthospitalVo"/>
|
||||||
|
where hospital_id = #{hospitalId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="checkHospitalNameUnique" parameterType="String" resultMap="RegHospitalResult">
|
||||||
|
select top 1 hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
||||||
|
from Reg_hospital
|
||||||
|
where hospital_name=#{hospitalName}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkHospitalCodeUnique" parameterType="String" resultMap="RegHospitalResult">
|
||||||
|
select top 1 hospital_id, hospital_code, hospital_name, hospital_userinfo, status, create_by, create_time, remark
|
||||||
|
from Reg_hospital
|
||||||
|
where hospital_code=#{hospitalCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateHospital" parameterType="RegHospital">
|
||||||
|
update Reg_hospital
|
||||||
|
<set>
|
||||||
|
<if test="hospitalCode != null and hospitalCode != ''">hospital_code = #{hospitalCode},</if>
|
||||||
|
<if test="hospitalName != null and hospitalName != ''">hospital_name = #{hospitalName},</if>
|
||||||
|
<if test="hospitalUserinfo != null">hospital_userinfo = #{hospitalUserinfo},</if>
|
||||||
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = getdate()
|
||||||
|
</set>
|
||||||
|
where hospital_id = #{hospitalId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertHospital" parameterType="RegHospital" useGeneratedKeys="true" keyProperty="hospitalId">
|
||||||
|
insert into Reg_hospital(
|
||||||
|
<if test="hospitalId != null and hospitalId != 0">hospital_id,</if>
|
||||||
|
<if test="hospitalCode != null and hospitalCode != ''">hospital_code,</if>
|
||||||
|
<if test="hospitalName != null and hospitalName != ''">hospital_name,</if>
|
||||||
|
<if test="hospitalUserinfo != null">hospital_userinfo,</if>
|
||||||
|
<if test="status != null and status != ''">status,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="hospitalId != null and hospitalId != 0">#{hospitalId},</if>
|
||||||
|
<if test="hospitalCode != null and hospitalCode != ''">#{hospitalCode},</if>
|
||||||
|
<if test="hospitalName != null and hospitalName != ''">#{hospitalName},</if>
|
||||||
|
<if test="hospitalUserinfo != null">#{hospitalUserinfo},</if>
|
||||||
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
getdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteHospitalById" parameterType="Long">
|
||||||
|
delete from Reg_hospital where hospital_id = #{hospitalId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteHospitalByIds" parameterType="Long">
|
||||||
|
delete from Reg_hospital where hospital_id in
|
||||||
|
<foreach collection="array" item="hospitalId" open="(" separator="," close=")">
|
||||||
|
#{hospitalId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user