Merge remote-tracking branch 'origin/jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支

# Conflicts:
#	xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java
This commit is contained in:
纪寒 2023-09-20 17:08:02 +08:00
commit 52d44b2e9a
31 changed files with 2416 additions and 74 deletions

View File

@ -0,0 +1,67 @@
package com.xinelu.common.utils;
import com.xinelu.common.exception.ServiceException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Calendar;
import java.util.GregorianCalendar;
/**
* @author ljh
* @version 1.0
* Create by 2023/2/27 11:45
*/
public class AgeUtil {
/**
* 根据出生日期计算年龄数值
*
* @param date 出生日期
* @return 年龄数值
*/
public static Long getAgeMonth(String date) {
if (StringUtils.isBlank(date)) {
throw new ServiceException("请输入正确的出生日期!");
}
String[] data = StringUtils.split(date, "-");
if (data.length < 3) {
throw new ServiceException("请输入正确的出生日期!");
}
Calendar birthday = new GregorianCalendar(Integer.parseInt(data[0]), Integer.parseInt(data[1]), Integer.parseInt(data[2]));
Calendar now = Calendar.getInstance();
int day = now.get(Calendar.DAY_OF_MONTH) - birthday.get(Calendar.DAY_OF_MONTH);
//月份从0开始计算所以需要+1
int month = now.get(Calendar.MONTH) + 1 - birthday.get(Calendar.MONTH);
BigDecimal monthFraction;
int year = now.get(Calendar.YEAR) - birthday.get(Calendar.YEAR);
//按照减法原理先day相减不够向month借然后month相减不够向year借最后year相减
if (day < 0) {
month -= 1;
//得到上一个月用来得到上个月的天数
now.add(Calendar.MONTH, -1);
}
if (month < 0) {
//当前月份加12个月
monthFraction = BigDecimal.valueOf(month).add(BigDecimal.valueOf(12)).divide(BigDecimal.valueOf(12), 1, RoundingMode.HALF_UP);
year--;
} else {
//当前月份
monthFraction = BigDecimal.valueOf(month).divide(BigDecimal.valueOf(12), 1, RoundingMode.HALF_UP);
}
BigDecimal bigDecimal = BigDecimal.ZERO;
if (year >= 0) {
bigDecimal = bigDecimal.add(BigDecimal.valueOf(year));
}
if ((monthFraction.compareTo(BigDecimal.ZERO) > 0)) {
bigDecimal = bigDecimal.add(monthFraction);
}
//今天出生
if (year == 0 && month == 0 && day == 0) {
return BigDecimal.ZERO.longValue();
}
return Math.round(bigDecimal.doubleValue());
}
}

View File

@ -0,0 +1,94 @@
package com.xinelu.manage.controller.nurseclassifyinfo;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import com.xinelu.manage.dto.nurseclassifyinfo.NurseClassifyInfoDTO;
import com.xinelu.manage.service.nurseclassifyinfo.INurseClassifyInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 护理机构和护理项目分类信息Controller
*
* @author xinyilu
* @date 2023-02-08
*/
@RestController
@RequestMapping("/classifyItem/info")
public class NurseClassifyInfoController extends BaseController {
@Resource
private INurseClassifyInfoService nurseClassifyInfoService;
/**
* 查询护理项目分类信息列表
*/
@GetMapping("/list")
public TableDataInfo list(NurseClassifyInfo nurseClassifyInfo) {
startPage();
List<NurseClassifyInfo> list = nurseClassifyInfoService.selectNurseClassifyInfoList(nurseClassifyInfo);
return getDataTable(list);
}
/**
* 导出护理项目分类信息列表
*/
@PreAuthorize("@ss.hasPermi('system:classifyItem:export')")
@Log(title = "护理机构和护理项目分类信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NurseClassifyInfo nurseClassifyInfo) {
List<NurseClassifyInfo> list = nurseClassifyInfoService.selectNurseClassifyInfoList(nurseClassifyInfo);
ExcelUtil<NurseClassifyInfo> util = new ExcelUtil<>(NurseClassifyInfo.class);
util.exportExcel(response, list, "护理机构和护理项目分类信息数据");
}
/**
* 获取护理项目分类信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:classifyItem:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(nurseClassifyInfoService.selectNurseClassifyInfoById(id));
}
/**
* 新增护理项目分类信息
*/
@PreAuthorize("@ss.hasPermi('system:classifyItem:add')")
@Log(title = "护理机构和护理项目分类信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@Validated(Insert.class) @RequestBody NurseClassifyInfoDTO nurseClassifyInfo) {
return nurseClassifyInfoService.insertNurseClassifyInfo(nurseClassifyInfo.getNurseClassifyInfoList());
}
/**
* 修改护理项目分类信息
*/
@PreAuthorize("@ss.hasPermi('system:classifyItem:edit')")
@Log(title = "护理机构和护理项目分类信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@Validated(Update.class) @RequestBody NurseClassifyInfo nurseClassifyInfo) {
return nurseClassifyInfoService.updateNurseClassifyInfo(nurseClassifyInfo);
}
/**
* 删除护理项目分类信息
*/
@PreAuthorize("@ss.hasPermi('system:classifyItem:remove')")
@Log(title = "护理机构和护理项目分类信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return nurseClassifyInfoService.deleteNurseClassifyInfoByIds(ids);
}
}

View File

@ -1,11 +1,6 @@
package com.xinelu.manage.controller.nursestation;
import com.xinelu.manage.domain.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.domain.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationVO;
import com.xinelu.manage.service.nursestation.INurseStationService;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.controller.BaseController;
@ -16,6 +11,11 @@ import com.xinelu.common.custominterface.Update;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.service.nursestation.INurseStationService;
import com.xinelu.manage.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.vo.nursestation.NurseStationVO;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@ -0,0 +1,275 @@
package com.xinelu.manage.domain.patientinfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
/**
* 被护理人基本信息对象 patient_info
*
* @author xinyilu
* @date 2022-09-02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "被护理人基本信息对象", description = "patient_info")
public class PatientInfo extends BaseDomain implements Serializable {
private static final long serialVersionUID = -9042864713058829058L;
/**
* 主键id
*/
@NotNull(message = "被护理人id不能为空", groups = {Update.class})
private Long id;
/**
* 居住小区编码
*/
@ApiModelProperty(value = "居住小区编码")
@Excel(name = "居住小区编码")
private String communityCode;
/**
* 所属区域编码
*/
@ApiModelProperty(value = "所属区域编码")
@Excel(name = "所属区域编码")
private String areaCode;
/**
* 用户编号
*/
@ApiModelProperty(value = "用户编号")
@Excel(name = "用户编号")
private String patientCode;
/**
* 用户姓名
*/
@NotBlank(message = "用户姓名不能为空", groups = {Update.class})
@ApiModelProperty(value = "用户姓名")
@Excel(name = "用户姓名")
private String patientName;
/**
* 身份证号
*/
@Length(max = 18, message = "身份证号不能超过18位", groups = {Insert.class, Update.class})
@NotBlank(message = "身份证号不能为空", groups = {Update.class})
@ApiModelProperty(value = "身份证号")
@Excel(name = "身份证号")
private String cardNo;
/**
* sys_user表id
*/
@ApiModelProperty(value = "sys_user表id")
@Excel(name = "sys_user表id")
private Long userId;
/**
* 用户微信unionid
*/
@ApiModelProperty(value = "用户微信unionid")
@Excel(name = "用户微信unionid")
private String unionid;
/**
* 用户微信openid
*/
@ApiModelProperty(value = "用户微信openid")
@Excel(name = "用户微信openid")
private String openid;
/**
* 手机号码
*/
@Length(max = 11, message = "手机号码不能超过11位", groups = {Insert.class, Update.class})
@NotBlank(message = "手机号码不能为空", groups = {Update.class})
@ApiModelProperty(value = "手机号码")
@Excel(name = "手机号码")
private String phone;
/**
* 居住地址
*/
@Length(max = 100, message = "居住地址不能超过100位", groups = {Insert.class, Update.class})
@ApiModelProperty(value = "居住地址")
@Excel(name = "居住地址")
private String address;
/**
* 紧急联系人名称
*/
@ApiModelProperty(value = "紧急联系人名称")
@Excel(name = "紧急联系人名称")
private String urgentContactName;
/**
* 紧急联系人电话
*/
@ApiModelProperty(value = "紧急联系人电话")
@Excel(name = "紧急联系人电话")
private String urgentContactPhone;
/**
* 居住小区名称
*/
@Length(max = 100, message = "居住小区名称不能超过100位", groups = {Insert.class, Update.class})
@ApiModelProperty(value = "居住小区名称")
@Excel(name = "居住小区名称")
private String communityAliasName;
/**
* 住址经度
*/
@ApiModelProperty(value = "住址经度")
@Excel(name = "住址经度")
private String homeLongitude;
/**
* 住址纬度
*/
@ApiModelProperty(value = "住址纬度")
@Excel(name = "住址纬度")
private String homeLatitude;
/**
* 个人头像地址
*/
@ApiModelProperty(value = "个人头像地址")
@Excel(name = "个人头像地址")
private String headPictureUrl;
/**
* 登录密码
*/
@Length(min = 6, max = 10, message = "密码不能超过10位", groups = {Insert.class})
@NotBlank(message = "密码", groups = {Insert.class, Update.class})
@ApiModelProperty(value = "登录密码")
@Excel(name = "登录密码")
private String password;
/**
* 会员积分
*/
@ApiModelProperty(value = "会员积分")
@Excel(name = "会员积分")
private Integer integral;
/**
* 登录标识
*/
@ApiModelProperty(value = "完善标识")
@Excel(name = "完善标识")
private Integer loginFlag;
/**
* 主账号标识0主账号1子账号
*/
private Integer primaryAccountFlag;
/**
* 所选服务id多个用逗号隔开
*/
private String serviceIds;
/**
* 所在位置名称
*/
private String locationName;
/**
* 会员完善信息来源
*/
private String source;
/**
* 邀请好友完善信息方式-邀请人id
*/
private Long invitationPatientId;
/**
* 累计签到次数
*/
private Integer totalSignInDays;
/**
* 性别
*/
private String sex;
/**
* 出生日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
/**
* 逻辑删除标识01
*/
private Integer delFlag;
/**
* 小程序个人微信二维码图片存放地址
*/
private String personalWechatCodeUrl;
/**
* 失能情况NOT_DISABLED未失能DISABLED已失能
*/
private String disablingCondition;
/**
* 失能原因
*/
private String disablingReason;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("communityCode", getCommunityCode())
.append("areaCode", getAreaCode())
.append("patientCode", getPatientCode())
.append("patientName", getPatientName())
.append("cardNo", getCardNo())
.append("userId", getUserId())
.append("unionid", getUnionid())
.append("openid", getOpenid())
.append("phone", getPhone())
.append("address", getAddress())
.append("urgentContactName", getUrgentContactName())
.append("urgentContactPhone", getUrgentContactPhone())
.append("homeLongitude", getHomeLongitude())
.append("homeLatitude", getHomeLatitude())
.append("headPictureUrl", getHeadPictureUrl())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("password", getPassword())
.append("integral", getIntegral())
.append("loginFlag", getLoginFlag())
.append("primaryAccountFlag", getPrimaryAccountFlag())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,23 @@
package com.xinelu.manage.dto.nurseclassifyinfo;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import lombok.Data;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
/**
* @author ljh
* @version 1.0
* Create by 2023/2/8 13:43
*/
@Data
public class NurseClassifyInfoDTO implements Serializable {
private static final long serialVersionUID = -8135087444417985080L;
/**
* 护理类型信息对象集合
**/
@Valid
private List<NurseClassifyInfo> nurseClassifyInfoList;
}

View File

@ -1,7 +1,7 @@
package com.xinelu.manage.domain.dto.nursestation;
package com.xinelu.manage.dto.nursestation;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO;
import com.xinelu.manage.vo.nursestation.NurseStationLabelVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.dto.nursestation;
package com.xinelu.manage.dto.nursestation;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;

View File

@ -0,0 +1,105 @@
package com.xinelu.manage.mapper.nurseclassifyinfo;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 护理机构和护理项目分类信息Mapper接口
*
* @author xinyilu
* @date 2023-02-08
*/
public interface NurseClassifyInfoMapper {
/**
* 查询护理项目分类信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 护理机构和护理项目分类信息
*/
NurseClassifyInfo selectNurseClassifyInfoById(Long id);
/**
* 查询护理项目分类信息列表
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 护理机构和护理项目分类信息集合
*/
List<NurseClassifyInfo> selectNurseClassifyInfoList(NurseClassifyInfo nurseClassifyInfo);
/**
* 新增护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
int insertNurseClassifyInfo(NurseClassifyInfo nurseClassifyInfo);
/**
* 修改护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
int updateNurseClassifyInfo(NurseClassifyInfo nurseClassifyInfo);
/**
* 删除护理项目分类信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 结果
*/
int deleteNurseClassifyInfoById(Long id);
/**
* 批量删除护理项目分类信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteNurseClassifyInfoByIds(Long[] ids);
/**
* 批量新增护理项目分类信息
*
* @param nurseClassifyInfoList 护理项目分类信息集合
* @return int
**/
int insertNurseClassifyInfoList(List<NurseClassifyInfo> nurseClassifyInfoList);
/**
* 批量新增护理机构分类信息
*
* @param nurseClassifyInfoList 护理项目分类信息集合
* @return int
**/
int insertNurseStationClassifyList(List<NurseClassifyInfo> nurseClassifyInfoList);
/**
* 根据护理机构分类名称查询名称重复数量
*
* @param classifyName 护理机构分类名称
* @param classifyType 护理机构分类类型
* @return 结果
*/
int selectNurseStationClassNameCount(@Param("classifyName") String classifyName, @Param("classifyType") String classifyType);
/**
* 根据ids查询护理机构信息
*
* @param ids 护理机构id数组
* @return List<NurseClassifyInfo>
*/
List<NurseClassifyInfo> selectNurseStationClassByIds(Long[] ids);
/**
* 根据护理机构分类名称查询名称重复数量
*
* @param classifyNameList 名称集合
* @param classifyType 类型
* @return int
*/
List<String> selectNurseStationClassNameByList(@Param("list") List<String> classifyNameList, @Param("classifyType") String classifyType);
}

View File

@ -1,15 +1,15 @@
package com.xinelu.manage.mapper.nursestation;
import com.xinelu.manage.domain.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.nursestationitem.NurseStationItem;
import com.xinelu.manage.domain.nursestationlabel.NurseStationLabel;
import com.xinelu.manage.domain.nursetype.NurseType;
import com.xinelu.manage.domain.vo.nursestation.NurseStationAndAreaVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationVO;
import com.xinelu.manage.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.vo.nursestation.NurseStationAndAreaVO;
import com.xinelu.manage.vo.nursestation.NurseStationByUserVO;
import com.xinelu.manage.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.vo.nursestation.NurseStationVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.xinelu.manage.mapper.nursestationlabel;
import com.xinelu.manage.domain.nursestationlabel.NurseStationLabel;
import com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO;
import com.xinelu.manage.vo.nursestation.NurseStationLabelVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@ -0,0 +1,136 @@
package com.xinelu.manage.mapper.patientinfo;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 被护理人基本信息Mapper接口
*
* @author xinyilu
* @date 2022-09-02
*/
public interface PatientInfoMapper {
/**
* 查询被护理人基本信息
*
* @param patientId 被护理人基本信息主键
* @return 被护理人基本信息
*/
PatientInfo selectPatientInfoByPatientId(Long patientId);
/**
* 查询被护理人基本信息
*
* @param id 被护理人基本信息主键
* @return 被护理人基本信息
*/
PatientInfoVO selectPatientInfoById(Long id);
/**
* 查询被护理人基本信息列表
*
* @param patientInfo 被护理人基本信息
* @return 被护理人基本信息集合
*/
List<PatientInfoVO> selectPatientInfoList(PatientInfoVO patientInfo);
/**
* 新增被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
int insertPatientInfo(PatientInfo patientInfo);
/**
* 修改被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
int updatePatientInfo(PatientInfo patientInfo);
/**
* 批量删除被护理人基本信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deletePatientInfoByIds(Long[] ids);
/**
* 修改被护理人头像图片
*
* @param openid 用户编号
* @param headPictureUrl 个人头像地址
* @return int
**/
int updateHeadPatientHead(@Param("openid") String openid, @Param("headPictureUrl") String headPictureUrl);
/**
* 修改被护理人头像图片App
*
* @param id 用户ID
* @param headPictureUrl 个人头像地址
* @return int
**/
int updateHeadPatientHeadPortrait(@Param("id") Long id, @Param("headPictureUrl") String headPictureUrl);
/**
* 根据id查询所有信息App
*
* @param id 用户id
* @return PatientInfo 结果
**/
PatientInfoVO getPatientInfoById(Long id);
/**
* 新增被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
int insertAppletLoginPatientInfo(PatientInfo patientInfo);
/**
* 增加会员积分数量
*
* @param id 主键会员id
* @param integral 积分数量
* @return 影响数量
*/
int addPatientIntegralCount(@Param("id") Long id, @Param("integral") Integer integral);
/**
* 减少会员积分数量
*
* @param id 主键会员id
* @param integral 积分数量
* @return 影响数量
*/
int reducePatientIntegralCount(@Param("id") Long id, @Param("integral") Integer integral);
/**
* 更新会员失能情况
*
* @param id 会员id
* @param disablingCondition 失能情况NOT_DISABLED未失能DISABLED已失能
* @param disablingReason 失能原因
* @return int
**/
int updatePatientDisabling(@Param("id") Long id, @Param("disablingCondition") String disablingCondition, @Param("disablingReason") String disablingReason);
/**
* 修改邀请人二维码地址信息
*
* @param id 主键id
* @param personalWeChatCodeUrl 邀请人二维码地址
* @return 数量
*/
int updatePersonalWeChatCodeUrl(@Param("id") Long id, @Param("personalWeChatCodeUrl") String personalWeChatCodeUrl);
}

View File

@ -1,9 +1,9 @@
package com.xinelu.manage.mapper.sysarea;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.domain.vo.sysarea.AreaInfoVO;
import com.xinelu.manage.domain.vo.sysarea.ParentAreaVO;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import com.xinelu.manage.vo.sysarea.AreaInfoVO;
import com.xinelu.manage.vo.sysarea.ParentAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@ -0,0 +1,102 @@
package com.xinelu.manage.service.nurseclassifyinfo;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import java.util.List;
/**
* 护理机构和护理项目分类信息Service接口
*
* @author xinyilu
* @date 2023-02-08
*/
public interface INurseClassifyInfoService {
/**
* 查询护理项目分类信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 护理机构和护理项目分类信息
*/
NurseClassifyInfo selectNurseClassifyInfoById(Long id);
/**
* 查询护理项目分类信息列表
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 护理机构和护理项目分类信息集合
*/
List<NurseClassifyInfo> selectNurseClassifyInfoList(NurseClassifyInfo nurseClassifyInfo);
/**
* 新增护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
AjaxResult insertNurseClassifyInfo(List<NurseClassifyInfo> nurseClassifyInfo);
/**
* 修改护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
AjaxResult updateNurseClassifyInfo(NurseClassifyInfo nurseClassifyInfo);
/**
* 批量删除护理项目分类信息
*
* @param ids 需要删除的护理机构和护理项目分类信息主键集合
* @return 结果
*/
AjaxResult deleteNurseClassifyInfoByIds(Long[] ids);
/**
* 删除护理项目分类信息信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 结果
*/
int deleteNurseClassifyInfoById(Long id);
/**
* 查询护理机构分类信息列表
*
* @param nurseClassifyInfo 护理机构分类信息
* @return 护理机构分类信息集合
*/
List<NurseClassifyInfo> selectNurseStationClassifyList(NurseClassifyInfo nurseClassifyInfo);
/**
* 获取护理机构分类信息详细信息
*
* @param id 护理机构分类信息主键
* @return 护理机构分类信息
*/
NurseClassifyInfo selectNurseStationClassifyById(Long id);
/**
* 新增护理机构分类信息
*
* @param nurseClassifyInfoList 护理机构分类信息集合
* @return 结果
*/
AjaxResult insertNurseStationClassifyInfo(List<NurseClassifyInfo> nurseClassifyInfoList);
/**
* 修改护理机构分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
AjaxResult updateNurseStationClassifyInfo(NurseClassifyInfo nurseClassifyInfo);
/**
* 批量删除护理机构分类信息
*
* @param ids 需要删除的护理机构分类信息主键集合
* @return AjaxResult
*/
AjaxResult deleteNurseStationClassifyByIds(Long[] ids);
}

View File

@ -0,0 +1,317 @@
package com.xinelu.manage.service.nurseclassifyinfo.impl;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.NurseClassifyInfoEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import com.xinelu.manage.mapper.nurseclassifyinfo.NurseClassifyInfoMapper;
import com.xinelu.manage.service.nurseclassifyinfo.INurseClassifyInfoService;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.File;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 护理机构和护理项目分类信息Service业务层处理
*
* @author xinelu
* @date 2023-02-08
*/
@Service
public class NurseClassifyInfoServiceImpl implements INurseClassifyInfoService {
@Resource
private NurseClassifyInfoMapper nurseClassifyInfoMapper;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
@Resource
private IPatientInfoService patientInfoService;
/**
* 查询护理项目分类信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 护理机构和护理项目分类信息
*/
@Override
public NurseClassifyInfo selectNurseClassifyInfoById(Long id) {
return nurseClassifyInfoMapper.selectNurseClassifyInfoById(id);
}
/**
* 查询护理项目分类信息列表
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 护理机构和护理项目分类信息
*/
@Override
public List<NurseClassifyInfo> selectNurseClassifyInfoList(NurseClassifyInfo nurseClassifyInfo) {
nurseClassifyInfo.setClassifyType(NurseClassifyInfoEnum.NURSE_ITEM.getInfo());
return nurseClassifyInfoMapper.selectNurseClassifyInfoList(nurseClassifyInfo);
}
/**
* 新增护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertNurseClassifyInfo(List<NurseClassifyInfo> nurseClassifyInfo) {
if (CollectionUtils.isEmpty(nurseClassifyInfo)) {
return AjaxResult.error("请添加护理项目分类信息!");
}
//筛选护理项目分类名称,去重
List<String> classifyNameList = nurseClassifyInfo.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getClassifyName())).map(NurseClassifyInfo::getClassifyName).collect(Collectors.toList());
List<String> distinctClassifyNameList = classifyNameList.stream().distinct().collect(Collectors.toList());
//集合取差集
List<String> subtractNameList = new ArrayList<>(CollectionUtils.subtract(classifyNameList, distinctClassifyNameList));
if (subtractNameList.size() > 0) {
return AjaxResult.error("'" + subtractNameList.get(0) + "'已存在,请修改后重新录入!");
}
//从数据库去项目分类名称
List<String> existClassNameList = nurseClassifyInfoMapper.selectNurseStationClassNameByList(distinctClassifyNameList, NurseClassifyInfoEnum.NURSE_ITEM.getInfo());
//传入护理项目分类集合与数据库护理项目分类名称取交集
List<String> existRetainAllNameList = new ArrayList<>(CollectionUtils.intersection(distinctClassifyNameList, existClassNameList));
if (existRetainAllNameList.size() > 0) {
return AjaxResult.error("'" + existRetainAllNameList.get(0) + "'名称重复,请重新输入!");
}
for (NurseClassifyInfo nurseClassify : nurseClassifyInfo) {
// 设置创建人与创建时间 护理项目分类编码 以及护理项目类型
nurseClassify.setCreateTime(LocalDateTime.now());
nurseClassify.setCreateBy(SecurityUtils.getUsername());
nurseClassify.setClassifyType(NurseClassifyInfoEnum.NURSE_ITEM.getInfo());
nurseClassify.setClassifyCode(Constants.CLASSIFY_ITEM + generateSystemCodeUtil.generateSystemCode(Constants.CLASSIFY_ITEM));
}
int insertCount = nurseClassifyInfoMapper.insertNurseClassifyInfoList(nurseClassifyInfo);
if (insertCount <= 0) {
throw new ServiceException("新增护理项目分类信息失败,请联系管理员!");
}
return AjaxResult.success();
}
/**
* 修改护理项目分类信息
*
* @param nurseClassifyInfo 护理机构和护理项目分类信息/classifyItem/info/list
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updateNurseClassifyInfo(NurseClassifyInfo nurseClassifyInfo) {
NurseClassifyInfo nurseClassifyInfoById = nurseClassifyInfoMapper.selectNurseClassifyInfoById(nurseClassifyInfo.getId());
if (Objects.isNull(nurseClassifyInfoById)) {
return AjaxResult.error("当前护理项目分类信息不存在,无法修改,请联系管理员!");
}
if (StringUtils.isNotBlank(nurseClassifyInfoById.getClassifyName()) && !nurseClassifyInfo.getClassifyName().equals(nurseClassifyInfoById.getClassifyName())) {
//查询是否有相同名字的护理项目分类
int classifyInfoByCount = nurseClassifyInfoMapper.selectNurseStationClassNameCount(nurseClassifyInfo.getClassifyName(), NurseClassifyInfoEnum.NURSE_ITEM.getInfo());
if (classifyInfoByCount > 0) {
return AjaxResult.error("'" + nurseClassifyInfo.getClassifyName() + "'名称重复,请重新输入!");
}
}
// 设置更新人与更新时间
nurseClassifyInfo.setUpdateTime(LocalDateTime.now());
nurseClassifyInfo.setUpdateBy(SecurityUtils.getUsername());
int updateNurseClassifyInfo = nurseClassifyInfoMapper.updateNurseClassifyInfo(nurseClassifyInfo);
if (updateNurseClassifyInfo <= 0) {
throw new ServiceException("修改护理项目分类信息失败,请联系管理员!");
}
//删除原有上传的分类图片
if (StringUtils.isNotBlank(nurseClassifyInfo.getClassifyPictureUrl()) && StringUtils.isNotBlank(nurseClassifyInfoById.getClassifyPictureUrl())
&& !nurseClassifyInfo.getClassifyPictureUrl().equals(nurseClassifyInfoById.getClassifyPictureUrl())) {
this.deletePictureUrl(nurseClassifyInfoById.getClassifyPictureUrl());
}
return AjaxResult.success();
}
/**
* 批量删除护理项目分类信息
*
* @param ids 需要删除的护理机构和护理项目分类信息主键
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult deleteNurseClassifyInfoByIds(Long[] ids) {
List<NurseClassifyInfo> nurseClassifyList = nurseClassifyInfoMapper.selectNurseStationClassByIds(ids);
int count = nurseClassifyInfoMapper.deleteNurseClassifyInfoByIds(ids);
if (count < 0) {
throw new ServiceException("删除护理分类失败,请联系管理员!");
}
List<String> selectPictureUrl = nurseClassifyList.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getClassifyPictureUrl())).map(NurseClassifyInfo::getClassifyPictureUrl).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(selectPictureUrl)) {
patientInfoService.updatePicture(selectPictureUrl);
}
return AjaxResult.success();
}
/**
* 删除护理项目分类信息信息
*
* @param id 护理机构和护理项目分类信息主键
* @return 结果
*/
@Override
public int deleteNurseClassifyInfoById(Long id) {
return nurseClassifyInfoMapper.deleteNurseClassifyInfoById(id);
}
/**
* 删除护理项目分类信息图片地址
*
* @param pictureUrl 护理项目分类信息图片地址
**/
private void deletePictureUrl(String pictureUrl) {
if (StringUtils.isBlank(pictureUrl)) {
return;
}
String picture = XinELuConfig.getProfile() + pictureUrl.replaceAll("/profile", "");
File checkReportNameFile = new File(picture);
if (checkReportNameFile.exists()) {
boolean delete = checkReportNameFile.delete();
if (BooleanUtils.isFalse(delete)) {
throw new ServiceException("图片地址删除失败!");
}
}
}
/**
* 查询护理机构分类信息列表
*
* @param nurseClassifyInfo 护理机构分类信息
* @return 护理机构分类信息
*/
@Override
public List<NurseClassifyInfo> selectNurseStationClassifyList(NurseClassifyInfo nurseClassifyInfo) {
nurseClassifyInfo.setClassifyType(NurseClassifyInfoEnum.NURSE_AGENCY.getInfo());
return nurseClassifyInfoMapper.selectNurseClassifyInfoList(nurseClassifyInfo);
}
/**
* 获取护理机构分类信息详细信息
*
* @param id 护理机构分类信息主键
* @return 护理机构分类信息
*/
@Override
public NurseClassifyInfo selectNurseStationClassifyById(Long id) {
return nurseClassifyInfoMapper.selectNurseClassifyInfoById(id);
}
/**
* 新增护理机构分类信息
*
* @param nurseClassifyInfoList 护理机构分类信息集合
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertNurseStationClassifyInfo(List<NurseClassifyInfo> nurseClassifyInfoList) {
if (CollectionUtils.isEmpty(nurseClassifyInfoList)) {
return AjaxResult.error("请添加护理机构分类!");
}
//筛选传入名称 去重
List<String> classifyNameList = nurseClassifyInfoList.stream().filter(Objects::nonNull).map(NurseClassifyInfo::getClassifyName).collect(Collectors.toList());
if (CollectionUtils.isEmpty(classifyNameList)) {
return AjaxResult.success();
}
List<String> distinctClassifyNameList = classifyNameList.stream().distinct().collect(Collectors.toList());
//集合取差集
List<String> subtractNameList = new ArrayList<>(CollectionUtils.subtract(classifyNameList, distinctClassifyNameList));
if (subtractNameList.size() > 0) {
return AjaxResult.error("'" + subtractNameList.get(0) + "'重复,请修改后重新录入!");
}
//根据传入资讯名称查询数据库名称集合
List<String> existNameList = nurseClassifyInfoMapper.selectNurseStationClassNameByList(distinctClassifyNameList, NurseClassifyInfoEnum.NURSE_AGENCY.getInfo());
//集合取交集
List<String> existRetainAllNameList = new ArrayList<>(CollectionUtils.intersection(existNameList, distinctClassifyNameList));
if (existRetainAllNameList.size() > 0) {
return AjaxResult.error("'" + existRetainAllNameList.get(0) + "'名称重复,请重新输入!");
}
for (NurseClassifyInfo nurseClassifyInfo : nurseClassifyInfoList) {
// 设置创建人与创建时间
nurseClassifyInfo.setCreateTime(LocalDateTime.now());
nurseClassifyInfo.setCreateBy(SecurityUtils.getUsername());
//增加护理机构类型
nurseClassifyInfo.setClassifyType(NurseClassifyInfoEnum.NURSE_AGENCY.getInfo());
//编号生成
nurseClassifyInfo.setClassifyCode(Constants.NURSE_AGENCY + generateSystemCodeUtil.generateSystemCode(Constants.NURSE_AGENCY));
}
//批量新增
int count = nurseClassifyInfoMapper.insertNurseStationClassifyList(nurseClassifyInfoList);
if (count < 0) {
throw new ServiceException("增加护理机构分类失败,请联系管理员!");
}
return AjaxResult.success();
}
/**
* 修改护理机构分类信息
*
* @param nurseClassifyInfo 护理机构分类信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updateNurseStationClassifyInfo(NurseClassifyInfo nurseClassifyInfo) {
NurseClassifyInfo selectNurseStationClassify = nurseClassifyInfoMapper.selectNurseClassifyInfoById(nurseClassifyInfo.getId());
if (Objects.isNull(selectNurseStationClassify)) {
return AjaxResult.error("当前护理机构分类信息不存在,无法修改,请联系管理员!");
}
if (StringUtils.isNotBlank(selectNurseStationClassify.getClassifyName()) &&
!nurseClassifyInfo.getClassifyName().equals(selectNurseStationClassify.getClassifyName())) {
int nameCount = nurseClassifyInfoMapper.selectNurseStationClassNameCount(nurseClassifyInfo.getClassifyName(), NurseClassifyInfoEnum.NURSE_AGENCY.getInfo());
if (nameCount > 0) {
return AjaxResult.error("'" + nurseClassifyInfo.getClassifyName() + "'名称重复,请重新输入!");
}
}
// 设置更新人与更新时间
nurseClassifyInfo.setUpdateTime(LocalDateTime.now());
nurseClassifyInfo.setUpdateBy(SecurityUtils.getUsername());
nurseClassifyInfoMapper.updateNurseClassifyInfo(nurseClassifyInfo);
//删除原有上传的分类图片
if (StringUtils.isNotBlank(nurseClassifyInfo.getClassifyPictureUrl()) && StringUtils.isNotBlank(selectNurseStationClassify.getClassifyPictureUrl())
&& !nurseClassifyInfo.getClassifyPictureUrl().equals(selectNurseStationClassify.getClassifyPictureUrl())) {
deletePictureUrl(selectNurseStationClassify.getClassifyPictureUrl());
}
return AjaxResult.success();
}
/**
* 删除护理机构分类信息
*
* @param ids 需要删除的护理机构分类信息主键集合
* @return AjaxResult
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult deleteNurseStationClassifyByIds(Long[] ids) {
List<NurseClassifyInfo> nurseClassifyList = nurseClassifyInfoMapper.selectNurseStationClassByIds(ids);
int count = nurseClassifyInfoMapper.deleteNurseClassifyInfoByIds(ids);
if (count < 0) {
throw new ServiceException("删除护理机构分类失败,请联系管理员!");
}
List<String> selectPicture = nurseClassifyList.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getClassifyPictureUrl())).map(NurseClassifyInfo::getClassifyPictureUrl).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(selectPicture)) {
patientInfoService.updatePicture(selectPicture);
}
return AjaxResult.success();
}
}

View File

@ -1,15 +1,15 @@
package com.xinelu.manage.service.nursestation;
import com.xinelu.manage.domain.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.domain.dto.nursestation.NurseStationImportDTO;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.nursestationitem.NurseStationItem;
import com.xinelu.manage.domain.vo.nursestation.NurseStationAndAreaVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.domain.vo.nursestation.NurseStationVO;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.vo.nursestation.NurseStationAndAreaVO;
import com.xinelu.manage.vo.nursestation.NurseStationByUserVO;
import com.xinelu.manage.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.vo.nursestation.NurseStationVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;

View File

@ -1,19 +1,5 @@
package com.xinelu.manage.service.nursestation.impl;
import com.xinelu.manage.domain.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.domain.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.nursestationclassifyrelation.NurseStationClassifyRelation;
import com.xinelu.manage.domain.nursestationitem.NurseStationItem;
import com.xinelu.manage.domain.nursetype.NurseType;
import com.xinelu.manage.domain.vo.nursestation.*;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import com.xinelu.manage.mapper.nursestation.NurseStationMapper;
import com.xinelu.manage.mapper.nursestationclassifyrelation.NurseStationClassifyRelationMapper;
import com.xinelu.manage.mapper.nursestationlabel.NurseStationLabelMapper;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.nursestation.INurseStationService;
import com.xinelu.common.config.AppletPageConfig;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.constant.Constants;
@ -27,6 +13,20 @@ import com.xinelu.common.utils.file.FileUploadUtils;
import com.xinelu.common.utils.file.FileUtils;
import com.xinelu.common.utils.file.MimeTypeUtils;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.nursestationclassifyrelation.NurseStationClassifyRelation;
import com.xinelu.manage.domain.nursestationitem.NurseStationItem;
import com.xinelu.manage.domain.nursetype.NurseType;
import com.xinelu.manage.dto.nursestation.NurseStationDTO;
import com.xinelu.manage.dto.nursestation.NurseStationImportDTO;
import com.xinelu.manage.mapper.nursestation.NurseStationMapper;
import com.xinelu.manage.mapper.nursestationclassifyrelation.NurseStationClassifyRelationMapper;
import com.xinelu.manage.mapper.nursestationlabel.NurseStationLabelMapper;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.nursestation.INurseStationService;
import com.xinelu.manage.vo.nursestation.*;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -0,0 +1,83 @@
package com.xinelu.manage.service.patientinfo;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 被护理人基本信息Service接口
*
* @author xinyilu
* @date 2022-09-02
*/
public interface IPatientInfoService {
/**
* 查询被护理人基本信息
*
* @param id 被护理人基本信息主键
* @return 被护理人基本信息
*/
PatientInfoVO selectPatientInfoById(Long id);
/**
* 查询被护理人基本信息列表
*
* @param patientInfo 被护理人基本信息
* @return 被护理人基本信息集合
*/
List<PatientInfoVO> selectPatientInfoList(PatientInfoVO patientInfo);
/**
* 新增被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
int insertPatientInfo(PatientInfo patientInfo);
/**
* 修改被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
AjaxResult updatePatientInfo(PatientInfo patientInfo);
/**
* 批量删除被护理人基本信息
*
* @param ids 需要删除的被护理人基本信息主键集合
* @return 结果
*/
int deletePatientInfoByIds(Long[] ids);
/**
* 修改被护理人头像图片
*
* @param openid 用户编号
* @param headPictureUrl 个人头像地址
* @return boolean
**/
boolean updateHeadPatientHead(@Param("openid") String openid, @Param("headPictureUrl") String headPictureUrl);
/**
* 删除旧图片
*
* @param pictureUrlList 路径
* @return 结果
*/
AjaxResult updatePicture(List<String> pictureUrlList);
/**
* PC端重置密码
*
* @param id 会员id
* @param password 密码
* @return AjaxResult
*/
AjaxResult updatePasswordById(@Param("id") Long id, @Param("password") String password);
}

View File

@ -0,0 +1,219 @@
package com.xinelu.manage.service.patientinfo.impl;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.common.utils.sign.Md5Utils;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.File;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 被护理人基本信息Service业务层处理
*
* @author xinelu
* @date 2022-09-02
*/
@Service
public class PatientInfoServiceImpl implements IPatientInfoService {
@Resource
private PatientInfoMapper patientInfoMapper;
@Resource
private RegexUtil regexUtil;
@Resource
private SysAreaMapper sysAreaMapper;
/**
* 查询被护理人基本信息
*
* @param id 被护理人基本信息主键
* @return 被护理人基本信息
*/
@Override
public PatientInfoVO selectPatientInfoById(Long id) {
//根据Id获取会员信息
PatientInfoVO patientInfoById = patientInfoMapper.getPatientInfoById(id);
if (Objects.isNull(patientInfoById)) {
throw new ServiceException("当前用户信息不存在,无法进行修改!");
}
//判断当前用户信息是否已经完善只有完善的才可以修改用户信息
if (Objects.isNull(patientInfoById.getLoginFlag())) {
throw new ServiceException("当前用户信息未完善,无法进行修改!");
}
if (Objects.nonNull(patientInfoById.getBirthDate())) {
patientInfoById.setAge(AgeUtil.getAgeMonth(String.valueOf(patientInfoById.getBirthDate())));
}
//根据区域编号查询上级区域信息
SysAreaVO superiorRegions = sysAreaMapper.getSubordinateRegionsFindSuperiorRegions(StringUtils.isBlank(patientInfoById.getAreaCode()) ? "" : patientInfoById.getAreaCode());
ArrayList<SysAreaVO> sysArea = new ArrayList<>();
sysArea.add(superiorRegions);
patientInfoById.setSysAreaVOList(sysArea);
return patientInfoById;
}
/**
* 查询被护理人基本信息列表
*
* @param patientInfo 被护理人基本信息
* @return 被护理人基本信息
*/
@Override
public List<PatientInfoVO> selectPatientInfoList(PatientInfoVO patientInfo) {
List<PatientInfoVO> patientInfoVO = patientInfoMapper.selectPatientInfoList(patientInfo);
List<String> areaCodeList = patientInfoVO
.stream().filter(Objects::nonNull)
.map(PatientInfoVO::getAreaCode)
.filter(StringUtils::isNotBlank).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(areaCodeList)) {
return patientInfoVO;
}
// 获取本护理站的区域信息
List<SysAreaVO> nurseStationAreaByList = sysAreaMapper.getNurseStationAreaByList(areaCodeList);
if (CollectionUtils.isEmpty(nurseStationAreaByList)) {
return patientInfoVO;
}
//以护理站id进行分组将标签配置信息转为Map集合
Map<String, List<SysAreaVO>> nurseStationAreaMap = nurseStationAreaByList.stream()
.filter(Objects::nonNull)
.filter(item -> Objects.nonNull(item.getStreetCode()))
.collect(Collectors.groupingBy(SysAreaVO::getStreetCode));
patientInfoVO.forEach(item ->
item.setSysAreaVOList(nurseStationAreaMap.getOrDefault(Objects.isNull(item.getAreaCode()) ? 0L : item.getAreaCode(), Lists.newArrayList())));
return patientInfoVO;
}
/**
* 新增被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertPatientInfo(PatientInfo patientInfo) {
patientInfo.setCreateBy(SecurityUtils.getUsername());
patientInfo.setCreateTime(LocalDateTime.now());
return patientInfoMapper.insertPatientInfo(patientInfo);
}
/**
* 修改被护理人基本信息
*
* @param patientInfo 被护理人基本信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updatePatientInfo(PatientInfo patientInfo) {
boolean regexPhone = regexUtil.regexPhone(patientInfo.getPhone());
if (BooleanUtils.isFalse(regexPhone)) {
return AjaxResult.error("手机号格式不正确!");
}
boolean regexCardNo = regexUtil.regexCardNo(patientInfo.getCardNo());
if (BooleanUtils.isFalse(regexCardNo)) {
return AjaxResult.error("身份证号格式不正确!");
}
//调用md5加密方法
String changePassword = Md5Utils.hash(patientInfo.getPassword());
patientInfo.setPassword(changePassword);
patientInfo.setUpdateTime(LocalDateTime.now());
patientInfo.setUpdateBy(SecurityUtils.getUsername());
int updatePatientInfo = patientInfoMapper.updatePatientInfo(patientInfo);
if (updatePatientInfo <= 0) {
throw new ServiceException("修改被护理人信息失败,请联系管理员!");
}
return AjaxResult.success();
}
/**
* 批量删除被护理人基本信息
*
* @param ids 需要删除的被护理人基本信息主键
* @return 结果
*/
@Override
public int deletePatientInfoByIds(Long[] ids) {
return patientInfoMapper.deletePatientInfoByIds(ids);
}
/**
* 修改被护理人头像图片用于AppletLoginServiceImpl
*
* @param openid 用户编号
* @param headPictureUrl 个人头像地址
* @return boolean 结果
**/
@Override
public boolean updateHeadPatientHead(String openid, String headPictureUrl) {
return patientInfoMapper.updateHeadPatientHead(openid, headPictureUrl) > 0;
}
/**
* 删除旧图片
*
* @param pictureUrlList 路径
* @return 结果
*/
@Override
public AjaxResult updatePicture(List<String> pictureUrlList) {
if (CollectionUtils.isEmpty(pictureUrlList)) {
return AjaxResult.success();
}
for (String pictureUrl : pictureUrlList) {
if (StringUtils.isBlank(pictureUrl)) {
continue;
}
String picture = XinELuConfig.getProfile() + pictureUrl.replaceAll("/profile", "");
File checkReportNameFile = new File(picture);
if (checkReportNameFile.exists()) {
//文件名称已存在删除文件
boolean delete = checkReportNameFile.delete();
if (BooleanUtils.isFalse(delete)) {
throw new ServiceException("图片文件删除失败!");
}
}
}
return AjaxResult.success();
}
/**
* PC端重置密码
*
* @param id 会员id
* @param password 密码
* @return AjaxResult
*/
@Override
public AjaxResult updatePasswordById(Long id, String password) {
PatientInfo patientInfo = new PatientInfo();
patientInfo.setId(id);
patientInfo.setPassword(Md5Utils.hash(password));
int update = patientInfoMapper.updatePatientInfo(patientInfo);
if (update <= 0) {
throw new ServiceException("重置密码失败,请联系管理员!");
}
return AjaxResult.success();
}
}

View File

@ -1,9 +1,9 @@
package com.xinelu.manage.domain.vo.nursestation;
package com.xinelu.manage.vo.nursestation;
import com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -1,7 +1,7 @@
package com.xinelu.manage.domain.vo.nursestation;
package com.xinelu.manage.vo.nursestation;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.vo.nursestation;
package com.xinelu.manage.vo.nursestation;
import com.xinelu.common.annotation.Excel;

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.vo.nursestation;
package com.xinelu.manage.vo.nursestation;
import lombok.Data;

View File

@ -1,9 +1,9 @@
package com.xinelu.manage.domain.vo.nursestation;
package com.xinelu.manage.vo.nursestation;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.nursetype.NurseType;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -0,0 +1,38 @@
package com.xinelu.manage.vo.patientinfo;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @Description 被护理人传输实体类
* @Author zhangheng
* @Date 2022-09-09
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class PatientInfoVO extends PatientInfo implements Serializable {
private static final long serialVersionUID = 5139292471395501256L;
/**
* 区域名称
*/
private String areaName;
/**
* 护理站区域集合
*/
List<SysAreaVO> sysAreaVOList;
/**
* 年龄
*/
private Long age;
/**
* 护理员标识数量
*/
private Integer personCount;
}

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.vo.sysarea;
package com.xinelu.manage.vo.sysarea;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.vo.sysarea;
package com.xinelu.manage.vo.sysarea;
import com.xinelu.manage.domain.sysarea.SysArea;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.xinelu.manage.domain.vo.sysarea;
package com.xinelu.manage.vo.sysarea;
import lombok.Data;

View File

@ -0,0 +1,294 @@
<?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.xinelu.manage.mapper.nurseclassifyinfo.NurseClassifyInfoMapper">
<resultMap type="NurseClassifyInfo" id="NurseClassifyInfoResult">
<result property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="classifyCode" column="classify_code"/>
<result property="classifyName" column="classify_name"/>
<result property="classifyLevel" column="classify_level"/>
<result property="classifyType" column="classify_type"/>
<result property="classifyPictureUrl" column="classify_picture_url"/>
<result property="classifySort" column="classify_sort"/>
<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="selectNurseClassifyInfoVo">
select id,
parent_id,
classify_code,
classify_name,
classify_level,
classify_type,
classify_picture_url,
classify_sort,
create_by,
create_time,
update_by,
update_time
from nurse_classify_info
</sql>
<select id="selectNurseClassifyInfoList" parameterType="NurseClassifyInfo" resultMap="NurseClassifyInfoResult">
select id,
parent_id,
classify_code,
classify_name,
classify_level,
classify_type,
classify_picture_url,
classify_sort,
create_by,
create_time,
update_by,
update_time
from nurse_classify_info
<where>
<if test="parentId != null ">
and parent_id = #{parentId}
</if>
<if test="classifyCode != null and classifyCode != ''">
and classify_code = #{classifyCode}
</if>
<if test="classifyName != null and classifyName != ''">
and classify_name like concat('%', #{classifyName}, '%')
</if>
<if test="classifyLevel != null ">
and classify_level = #{classifyLevel}
</if>
<if test="classifyType != null and classifyType != ''">
and classify_type = #{classifyType}
</if>
<if test="classifyPictureUrl != null and classifyPictureUrl != ''">
and classify_picture_url = #{classifyPictureUrl}
</if>
<if test="classifySort != null ">
and classify_sort = #{classifySort}
</if>
</where>
ORDER BY classify_sort asc,id DESC
</select>
<select id="selectNurseClassifyInfoById" parameterType="Long"
resultMap="NurseClassifyInfoResult">
<include refid="selectNurseClassifyInfoVo"/>
where id = #{id}
</select>
<insert id="insertNurseClassifyInfo" parameterType="NurseClassifyInfo" useGeneratedKeys="true"
keyProperty="id">
insert into nurse_classify_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,
</if>
<if test="classifyCode != null">classify_code,
</if>
<if test="classifyName != null">classify_name,
</if>
<if test="classifyLevel != null">classify_level,
</if>
<if test="classifyType != null">classify_type,
</if>
<if test="classifyPictureUrl != null">classify_picture_url,
</if>
<if test="classifySort != null">classify_sort,
</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="parentId != null">#{parentId},
</if>
<if test="classifyCode != null">#{classifyCode},
</if>
<if test="classifyName != null">#{classifyName},
</if>
<if test="classifyLevel != null">#{classifyLevel},
</if>
<if test="classifyType != null">#{classifyType},
</if>
<if test="classifyPictureUrl != null">#{classifyPictureUrl},
</if>
<if test="classifySort != null">#{classifySort},
</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="updateNurseClassifyInfo" parameterType="NurseClassifyInfo">
update nurse_classify_info
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id =
#{parentId},
</if>
<if test="classifyCode != null">classify_code =
#{classifyCode},
</if>
<if test="classifyName != null">classify_name =
#{classifyName},
</if>
<if test="classifyLevel != null">classify_level =
#{classifyLevel},
</if>
<if test="classifyType != null">classify_type =
#{classifyType},
</if>
<if test="classifyPictureUrl != null">classify_picture_url =
#{classifyPictureUrl},
</if>
<if test="classifySort != null">classify_sort =
#{classifySort},
</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="deleteNurseClassifyInfoById" parameterType="Long">
delete
from nurse_classify_info
where id = #{id}
</delete>
<delete id="deleteNurseClassifyInfoByIds" parameterType="String">
delete from nurse_classify_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertNurseClassifyInfoList" parameterType="java.util.List">
insert into nurse_classify_info(
parent_id,
classify_code,
classify_name,
classify_level,
classify_type,
classify_picture_url,
classify_sort,
create_by,
create_time,
update_by,
update_time
) values
<foreach item="nurseClassifyInfoList" index="index" collection="list" separator=",">
(
#{nurseClassifyInfoList.parentId},
#{nurseClassifyInfoList.classifyCode},
#{nurseClassifyInfoList.classifyName},
#{nurseClassifyInfoList.classifyLevel},
#{nurseClassifyInfoList.classifyType},
#{nurseClassifyInfoList.classifyPictureUrl},
#{nurseClassifyInfoList.classifySort},
#{nurseClassifyInfoList.createBy},
#{nurseClassifyInfoList.createTime},
#{nurseClassifyInfoList.updateBy},
#{nurseClassifyInfoList.updateTime}
)
</foreach>
</insert>
<insert id="insertNurseStationClassifyList">
insert into nurse_classify_info(
parent_id,
classify_code,
classify_name,
classify_level,
classify_type,
classify_picture_url,
classify_sort,
create_by,
create_time
)
values
<foreach item="nurseClassifyInfoList" index="index" collection="list" separator=",">
(
#{nurseClassifyInfoList.parentId},
#{nurseClassifyInfoList.classifyCode},
#{nurseClassifyInfoList.classifyName},
#{nurseClassifyInfoList.classifyLevel},
#{nurseClassifyInfoList.classifyType},
#{nurseClassifyInfoList.classifyPictureUrl},
#{nurseClassifyInfoList.classifySort},
#{nurseClassifyInfoList.createBy},
#{nurseClassifyInfoList.createTime}
)
</foreach>
</insert>
<select id="selectNurseStationClassNameCount" resultType="java.lang.Integer">
select count(1)
from nurse_classify_info
<where>
<if test="classifyName != null and classifyName != ''">
and classify_name = #{classifyName}
</if>
<if test="classifyType != null and classifyType != ''">
and classify_type = #{classifyType}
</if>
</where>
</select>
<select id="selectNurseStationClassByIds"
resultType="com.xinelu.manage.domain.nurseclassifyinfo.NurseClassifyInfo">
select id,
parent_id,
classify_code,
classify_name,
classify_level,
classify_type,
classify_picture_url,
classify_sort,
create_by,
create_time,
update_by,
update_time
from nurse_classify_info
where
id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectNurseStationClassNameByList" resultType="java.lang.String">
select classify_name
from nurse_classify_info
where
classify_name in
<foreach item="list" collection="list" open="(" separator="," close=")">
#{list}
</foreach>
and classify_type = #{classifyType}
</select>
</mapper>

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.applet.mapper.nursestation.NurseStationMapper">
<mapper namespace="com.xinelu.manage.mapper.nursestation.NurseStationMapper">
<resultMap type="NurseStation" id="NurseStationResult">
<result property="id" column="id"/>
@ -36,7 +36,7 @@
</resultMap>
<resultMap type="com.xinelu.manage.domain.vo.nursestation.NurseStationAndAreaVO" id="NurseStationResultInFo">
<resultMap type="com.xinelu.manage.vo.nursestation.NurseStationAndAreaVO" id="NurseStationResultInFo">
<result property="id" column="id"/>
<result property="areaCode" column="area_code"/>
<result property="userId" column="user_id"/>
@ -52,7 +52,7 @@
<result property="dutyPerson" column="duty_person"/>
<result property="dutyPhone" column="duty_phone"/>
<result property="stationPictureUrl" column="station_picture_url"/>
<result property="stationIntroducePcitureUrl" column="station_introduce_pciture_url"/>
<result property="stationIntroducePictureUrl" column="station_introduce_pciture_url"/>
<result property="sort" column="sort"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
@ -68,7 +68,7 @@
<collection property="nurseClassifyInfoList" javaType="java.util.List" resultMap="NurseClassifyInfoResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO" id="NurseStationLabelInfo">
<resultMap type="com.xinelu.manage.vo.nursestation.NurseStationLabelVO" id="NurseStationLabelInfo">
<result property="id" column="id"/>
<result property="nurseStationId" column="nurse_station_id"/>
<result property="userId" column="user_id"/>
@ -124,8 +124,8 @@
from nurse_station
</sql>
<select id="selectNurseStationList" parameterType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO">
<select id="selectNurseStationList" parameterType="com.xinelu.manage.vo.nursestation.NurseStationVO"
resultType="com.xinelu.manage.vo.nursestation.NurseStationVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="areaCode != null ">
@ -202,7 +202,7 @@
</select>
<select id="selectNurseStationListByUser" parameterType="NurseStation"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO">
resultType="com.xinelu.manage.vo.nursestation.NurseStationByUserVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="areaCode != null ">
@ -552,7 +552,7 @@
</where>
</select>
<select id="selectNurseStationListByIds" resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO">
<select id="selectNurseStationListByIds" resultType="com.xinelu.manage.vo.nursestation.NurseStationByUserVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="nurseStationIdList != null and nurseStationIdList.size() > 0">
@ -694,7 +694,7 @@
</where>
</select>
<select id="getSysDictNurseTypeCode" resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO">
<select id="getSysDictNurseTypeCode" resultType="com.xinelu.manage.vo.nursestation.NurseStationVO">
SELECT sdt.dict_name,
sdd.dict_label nurseTypeName,
sdd.dict_value nurseTypeCode
@ -747,8 +747,8 @@
</select>
<select id="getNurseStationByUserId" parameterType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO">
<select id="getNurseStationByUserId" parameterType="com.xinelu.manage.vo.nursestation.NurseStationSysUserVO"
resultType="com.xinelu.manage.vo.nursestation.NurseStationSysUserVO">
SELECT
su.user_id,
su.nurse_station_ids
@ -762,8 +762,8 @@
order by su.create_time desc
</select>
<select id="getNurseStationIds" parameterType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO">
<select id="getNurseStationIds" parameterType="com.xinelu.manage.vo.nursestation.NurseStationSysUserVO"
resultType="com.xinelu.manage.vo.nursestation.NurseStationSysUserVO">
SELECT
ns.id nurseStationId,
ns.nurse_station_name,
@ -783,7 +783,7 @@
order by ns.create_time desc
</select>
<select id="getAllNurseStationInfo" resultType="com.xinelu.manage.domain.dto.nursestation.NurseStationImportDTO">
<select id="getAllNurseStationInfo" resultType="com.xinelu.manage.dto.nursestation.NurseStationImportDTO">
select nurse_station_name, phone, address, duty_person, duty_phone, agency_introduce FROM nurse_station
<where>
<if test="nurseStationNameList != null and nurseStationNameList.size() > 0">

View File

@ -0,0 +1,589 @@
<?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.xinelu.manage.mapper.patientinfo.PatientInfoMapper">
<resultMap type="com.xinelu.manage.vo.patientinfo.PatientInfoVO" id="PatientInfoResult">
<result property="id" column="id"/>
<result property="communityCode" column="community_code"/>
<result property="areaCode" column="area_code"/>
<result property="patientCode" column="patient_code"/>
<result property="patientName" column="patient_name"/>
<result property="cardNo" column="card_no"/>
<result property="userId" column="user_id"/>
<result property="unionid" column="unionid"/>
<result property="openid" column="openid"/>
<result property="phone" column="phone"/>
<result property="address" column="address"/>
<result property="urgentContactName" column="urgent_contact_name"/>
<result property="urgentContactPhone" column="urgent_contact_phone"/>
<result property="communityAliasName" column="community_alias_name"/>
<result property="homeLongitude" column="home_longitude"/>
<result property="homeLatitude" column="home_latitude"/>
<result property="headPictureUrl" column="head_picture_url"/>
<result property="password" column="password"/>
<result property="integral" column="integral"/>
<result property="loginFlag" column="login_flag"/>
<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="areaName" column="area_name"/>
<result property="primaryAccountFlag" column="primary_account_flag"/>
<result property="serviceIds" column="service_ids"/>
<result property="locationName" column="location_name"/>
<result property="source" column="source"/>
<result property="invitationPatientId" column="invitation_patient_id"/>
<result property="totalSignInDays" column="total_sign_in_days"/>
<result property="sex" column="sex"/>
<result property="birthDate" column="birth_date"/>
<result property="delFlag" column="del_flag"/>
<result property="personalWechatCodeUrl" column="personal_wechat_code_url"/>
<result property="disablingCondition" column="disabling_condition"/>
<result property="disablingReason" column="disabling_reason"/>
</resultMap>
<sql id="selectPatientInfoVo">
select id,
community_code,
area_code,
patient_code,
patient_name,
card_no,
user_id,
unionid,
openid,
phone,
address,
urgent_contact_name,
urgent_contact_phone,
community_alias_name,
home_longitude,
home_latitude,
head_picture_url,
password,
integral,
login_flag,
create_by,
create_time,
primary_account_flag,
service_ids,
location_name,
invitation_patient_id,
total_sign_in_days,
sex,
birth_date,
del_flag,
personal_wechat_code_url,
disabling_condition,
disabling_reason
from patient_info
</sql>
<select id="selectPatientInfoByPatientId" parameterType="Long"
resultMap="PatientInfoResult">
<include refid="selectPatientInfoVo"/>
where id = #{id}
</select>
<select id="selectPatientInfoList" parameterType="com.xinelu.manage.vo.patientinfo.PatientInfoVO"
resultMap="PatientInfoResult">
select
pi.id,
pi.community_code,
pi.area_code,
pi.patient_code,
pi.patient_name,
pi.card_no,
pi.user_id,
pi.unionid,
pi.openid,
pi.phone,
pi.address,
pi.urgent_contact_name,
pi.urgent_contact_phone,
pi.community_alias_name,
pi.home_longitude,
pi.home_latitude,
pi.head_picture_url,
pi.password,
pi.integral,
pi.login_flag,
pi.create_by,
pi.create_time,
pi.disabling_condition,
pi.disabling_reason,
sa.area_name
from patient_info pi
left join sys_area sa on sa.area_code = pi.area_code
<where>
pi.del_flag = 0
<if test="communityCode != null and communityCode != ''">
and pi.community_code = #{communityCode}
</if>
<if test="areaCode != null and areaCode != ''">
and pi.area_code = #{areaCode}
</if>
<if test="patientCode != null and patientCode != ''">
and pi.patient_code = #{patientCode}
</if>
<if test="patientName != null and patientName != ''">
and pi.patient_name like concat('%', #{patientName}, '%')
</if>
<if test="cardNo != null and cardNo != ''">
and pi.card_no = #{cardNo}
</if>
<if test="userId != null ">
and pi.user_id = #{userId}
</if>
<if test="unionid != null and unionid != ''">
and pi.unionid = #{unionid}
</if>
<if test="openid != null and openid != ''">
and pi.openid = #{openid}
</if>
<if test="phone != null and phone != ''">
and pi.phone = #{phone}
</if>
<if test="address != null and address != ''">
and pi.address = #{address}
</if>
<if test="urgentContactName != null and urgentContactName != ''">
and pi.urgent_contact_name like concat('%', #{urgentContactName}, '%')
</if>
<if test="urgentContactPhone != null and urgentContactPhone != ''">
and pi.urgent_contact_phone = #{urgentContactPhone}
</if>
<if test="communityAliasName != null and communityAliasName != ''">
and pi.community_alias_name = #{communityAliasName}
</if>
<if test="homeLongitude != null and homeLongitude != ''">
and pi.home_longitude = #{homeLongitude}
</if>
<if test="homeLatitude != null and homeLatitude != ''">
and pi.home_latitude = #{homeLatitude}
</if>
<if test="headPictureUrl != null and headPictureUrl != ''">
and pi.head_picture_url = #{headPictureUrl}
</if>
<if test="password != null and password != ''">
and pi.password = #{password}
</if>
<if test="integral != null and integral != ''">
and pi.integral = #{integral}
</if>
<if test="loginFlag != null and loginFlag != ''">
and pi.login_flag = #{loginFlag}
</if>
<if test="personalWechatCodeUrl != null and personalWechatCodeUrl != ''">
and pi.personal_wechat_code_url = #{personalWechatCodeUrl}
</if>
</where>
ORDER BY pi.create_time DESC
</select>
<select id="selectPatientInfoById" parameterType="Long"
resultMap="PatientInfoResult">
select pi.id,
pi.community_code,
pi.area_code,
pi.patient_code,
pi.patient_name,
pi.card_no,
pi.user_id,
pi.unionid,
pi.openid,
pi.phone,
pi.address,
pi.urgent_contact_name,
pi.urgent_contact_phone,
pi.community_alias_name,
pi.home_longitude,
pi.home_latitude,
pi.head_picture_url,
pi.password,
pi.integral,
pi.login_flag,
pi.create_by,
pi.create_time,
pi.disabling_condition,
pi.disabling_reason,
sa.area_name
from patient_info pi
INNER join sys_area sa on sa.area_code = pi.area_code
where pi.id = #{id}
</select>
<insert id="insertPatientInfo" parameterType="PatientInfo" useGeneratedKeys="true"
keyProperty="id">
insert into patient_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="communityCode != null and communityCode != ''">community_code,
</if>
<if test="areaCode != null and areaCode != ''">area_code,
</if>
<if test="patientCode != null">patient_code,
</if>
<if test="patientName != null">patient_name,
</if>
<if test="cardNo != null">card_no,
</if>
<if test="userId != null">user_id,
</if>
<if test="unionid != null">unionid,
</if>
<if test="openid != null">openid,
</if>
<if test="phone != null">phone,
</if>
<if test="address != null">address,
</if>
<if test="urgentContactName != null">urgent_contact_name,
</if>
<if test="urgentContactPhone != null">urgent_contact_phone,
</if>
<if test="communityAliasName != null">community_alias_name,
</if>
<if test="homeLongitude != null">home_longitude,
</if>
<if test="homeLatitude != null">home_latitude,
</if>
<if test="headPictureUrl != null">head_picture_url,
</if>
<if test="password != null">password,
</if>
<if test="integral != null">integral,
</if>
<if test="loginFlag != null">login_flag,
</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="primaryAccountFlag != null">primary_account_flag,
</if>
<if test="serviceIds != null">service_ids,
</if>
<if test="locationName != null">location_name,
</if>
<if test="source != null">source,
</if>
<if test="invitationPatientId != null">invitation_patient_id,
</if>
<if test="totalSignInDays != null">total_sign_in_days,
</if>
<if test="sex != null">sex,
</if>
<if test="birthDate != null">birth_date,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="personalWechatCodeUrl != null">personal_wechat_code_url,
</if>
<if test="disablingCondition != null">disabling_condition,
</if>
<if test="disablingReason != null">disabling_reason,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="communityCode != null and communityCode != ''">#{communityCode},
</if>
<if test="areaCode != null and areaCode != ''">#{areaCode},
</if>
<if test="patientCode != null">#{patientCode},
</if>
<if test="patientName != null">#{patientName},
</if>
<if test="cardNo != null">#{cardNo},
</if>
<if test="userId != null">#{userId},
</if>
<if test="unionid != null">#{unionid},
</if>
<if test="openid != null">#{openid},
</if>
<if test="phone != null">#{phone},
</if>
<if test="address != null">#{address},
</if>
<if test="urgentContactName != null">#{urgentContactName},
</if>
<if test="urgentContactPhone != null">#{urgentContactPhone},
</if>
<if test="communityAliasName != null">#{communityAliasName},
</if>
<if test="homeLongitude != null">#{homeLongitude},
</if>
<if test="homeLatitude != null">#{homeLatitude},
</if>
<if test="headPictureUrl != null">#{headPictureUrl},
</if>
<if test="password != null">#{password},
</if>
<if test="integral != null">#{integral},
</if>
<if test="loginFlag != null">#{loginFlag},
</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="primaryAccountFlag != null">#{primaryAccountFlag},
</if>
<if test="serviceIds != null">#{serviceIds},
</if>
<if test="locationName != null">#{locationName},
</if>
<if test="source != null">#{source},
</if>
<if test="invitationPatientId != null">#{invitationPatientId},
</if>
<if test="totalSignInDays != null">#{totalSignInDays},
</if>
<if test="sex != null">#{sex},
</if>
<if test="birthDate != null">#{birthDate},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="personalWechatCodeUrl != null">#{personalWechatCodeUrl},
</if>
<if test="disablingCondition != null">#{disablingCondition},
</if>
<if test="disablingReason != null">#{disablingReason},
</if>
</trim>
</insert>
<update id="updatePatientInfo" parameterType="PatientInfo">
update patient_info
<trim prefix="SET" suffixOverrides=",">
<if test="communityCode != null and communityCode != ''">community_code =
#{communityCode},
</if>
<if test="areaCode != null and areaCode != ''">area_code =
#{areaCode},
</if>
<if test="patientCode != null">patient_code =
#{patientCode},
</if>
<if test="patientName != null">patient_name =
#{patientName},
</if>
<if test="cardNo != null">card_no =
#{cardNo},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="unionid != null">unionid =
#{unionid},
</if>
<if test="openid != null">openid =
#{openid},
</if>
<if test="phone != null">phone =
#{phone},
</if>
<if test="address != null">address =
#{address},
</if>
<if test="urgentContactName != null">urgent_contact_name =
#{urgentContactName},
</if>
<if test="urgentContactPhone != null">urgent_contact_phone =
#{urgentContactPhone},
</if>
<if test="communityAliasName != null">community_alias_name =
#{communityAliasName},
</if>
<if test="homeLongitude != null">home_longitude =
#{homeLongitude},
</if>
<if test="homeLatitude != null">home_latitude =
#{homeLatitude},
</if>
<if test="headPictureUrl != null">head_picture_url =
#{headPictureUrl},
</if>
<if test="password != null">password =
#{password},
</if>
<if test="integral != null">integral =
#{integral},
</if>
<if test="loginFlag != null">login_flag =
#{loginFlag},
</if>
<if test="primaryAccountFlag != null">primary_account_flag =
#{primaryAccountFlag},
</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="serviceIds != null">service_ids =
#{serviceIds},
</if>
<if test="locationName != null">location_name =
#{locationName},
</if>
<if test="source != null">source =
#{source},
</if>
<if test="invitationPatientId != null">invitation_patient_id =
#{invitationPatientId},
</if>
<if test="totalSignInDays != null">total_sign_in_days =
#{totalSignInDays},
</if>
<if test="sex != null">sex =
#{sex},
</if>
<if test="birthDate != null">birth_date =
#{birthDate},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="personalWechatCodeUrl != null">personal_wechat_code_url =
#{personalWechatCodeUrl},
</if>
<if test="disablingCondition != null">disabling_condition =
#{disablingCondition},
</if>
<if test="disablingReason != null">disabling_reason =
#{disablingReason},
</if>
</trim>
where id = #{id}
</update>
<delete id="deletePatientInfoByIds" parameterType="String">
delete from patient_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateHeadPatientHead" parameterType="PatientInfo">
update patient_info
set head_picture_url = #{headPictureUrl}
where id = #{id}
</update>
<update id="updateHeadPatientHeadPortrait" parameterType="PatientInfo">
update patient_info
set head_picture_url = #{headPictureUrl}
where id = #{id}
</update>
<select id="getPatientInfoById" resultType="com.xinelu.manage.vo.patientinfo.PatientInfoVO">
SELECT id,
community_code,
area_code,
patient_code,
patient_name,
card_no,
user_id,
unionid,
openid,
phone,
address,
urgent_contact_name,
urgent_contact_phone,
community_alias_name,
home_longitude,
home_latitude,
head_picture_url,
password,
integral,
login_flag,
create_by,
create_time,
service_ids,
primary_account_flag,
del_flag,
invitation_patient_id,
total_sign_in_days,
sex,
birth_date,
personal_wechat_code_url,
disabling_condition,
disabling_reason
FROM patient_info
WHERE id = #{id}
and del_flag = 0
</select>
<insert id="insertAppletLoginPatientInfo" parameterType="PatientInfo" useGeneratedKeys="true"
keyProperty="id">
insert into patient_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="openid != null">openid,
</if>
<if test="phone != null">phone,
</if>
<if test="createTime != null">create_time,
</if>
<if test="areaCode != null and areaCode != ''">area_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="openid != null">#{openid},
</if>
<if test="phone != null">#{phone},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="areaCode != null and areaCode != ''">#{areaCode},
</if>
</trim>
</insert>
<update id="addPatientIntegralCount">
update patient_info
set integral = integral + #{integral},
update_time = now()
where id = #{id}
</update>
<update id="reducePatientIntegralCount">
update patient_info
set integral = integral - #{integral},
update_time = now()
where id = #{id}
and integral &gt; 0
</update>
<update id="updatePatientDisabling">
update patient_info
set disabling_condition = #{disablingCondition},
disabling_reason = #{disablingReason}
where id = #{id}
</update>
<update id="updatePersonalWeChatCodeUrl">
update patient_info
set personal_wechat_code_url = #{personalWeChatCodeUrl},
update_time = now()
where id = #{id}
</update>
</mapper>

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.applet.mapper.sysarea.SysAreaMapper">
<mapper namespace="com.xinelu.manage.mapper.sysarea.SysAreaMapper">
<resultMap type="SysArea" id="SysAreaResult">
<result property="id" column="id"/>
@ -183,7 +183,7 @@
</delete>
<select id="getCityInfoList"
resultType="com.xinelu.manage.domain.vo.sysarea.AreaInfoVO">
resultType="com.xinelu.manage.vo.sysarea.AreaInfoVO">
SELECT id,
parent_id,
area_code,
@ -196,7 +196,7 @@
</select>
<select id="getStreetInfoList"
resultType="com.xinelu.manage.domain.vo.sysarea.AreaInfoVO">
resultType="com.xinelu.manage.vo.sysarea.AreaInfoVO">
SELECT
id,
parent_id,
@ -217,7 +217,7 @@
</select>
<select id="getSubordinateRegionsFindSuperiorRegions" parameterType="String"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
resultType="com.xinelu.manage.vo.sysarea.SysAreaVO">
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
@ -252,8 +252,8 @@
</select>
<select id="getNurseStationAreaByList" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
<select id="getNurseStationAreaByList" parameterType="com.xinelu.manage.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.vo.sysarea.SysAreaVO">
SELECT
province.area_name province_name,
province.area_code province_code,
@ -280,8 +280,8 @@
</if>
</select>
<select id="getNurseStationGoodsAreaByList" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
<select id="getNurseStationGoodsAreaByList" parameterType="com.xinelu.manage.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.vo.sysarea.SysAreaVO">
SELECT
province.area_name province_name,
province.area_code province_code,
@ -307,8 +307,8 @@
</select>
<select id="getNurseStationAreaByCode" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
<select id="getNurseStationAreaByCode" parameterType="com.xinelu.manage.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.vo.sysarea.SysAreaVO">
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
@ -342,7 +342,7 @@
AND region.area_code = #{areaCode} limit 1;
</select>
<select id="selectParentName" resultType="com.xinelu.manage.domain.vo.sysarea.ParentAreaVO">
<select id="selectParentName" resultType="com.xinelu.manage.vo.sysarea.ParentAreaVO">
SELECT sa.id,
sa.parent_code,
(select area_name FROM sys_area where area_code = sa.parent_code) parentName,