Merge branch 'jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' of http://101.200.89.70:3000/jihan/xinelu-api into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支

 Conflicts:
	xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java
	xinelu-common/src/main/java/com/xinelu/common/core/domain/BaseDomain.java
	xinelu-common/src/main/java/com/xinelu/common/utils/DateUtils.java
	xinelu-common/src/main/java/com/xinelu/common/utils/codes/GenerateSystemCodeUtil.java
	xinelu-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java
	xinelu-common/src/main/java/com/xinelu/common/utils/regex/RegexUtil.java
This commit is contained in:
haown 2023-09-20 15:47:27 +08:00
commit b675c19e17
38 changed files with 5837 additions and 138 deletions

View File

@ -0,0 +1,46 @@
package com.xinelu.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Description 小程序页面配置类
* @Author 纪寒
* @Date 2023-02-27 17:26:51
* @Version 1.0
*/
@Data
@Component
@ConfigurationProperties(prefix = "applet-page-config")
public class AppletPageConfig {
/**
* 首页路径
*/
private String pageUrl;
/**
* 个人中心-优惠券页面跳转路径
*/
private String couponPageUrl;
/**
* 商品订单页面跳转路径
*/
private String goodsOrderPageUrl;
/**
* 预约订单页面跳转路径
*/
private String appointOrderPageUrl;
/**
* 积分跳转路径
*/
private String integralPageUrl;
/**
* 护理结构详情页面跳转路径
*/
private String nurseStationDetailsPageUrl;
}

View File

@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "xinelu")
public class XinELuConfig {
/**
* 项目名称
*/
@ -46,6 +47,198 @@ public class XinELuConfig {
*/
private static String captchaType;
/**
* 全医通小程序图片存放路径
*/
private String nurserAppletPicture;
/**
* 护理站图片上传存放路径
*/
private String nurserStationPictureUrl;
/**
* 护理站图片上传存放路径
*/
private String nurserStationIntroducePictureUrl;
/**
* 护理站项目图片上传存放路径
*/
private String nurserStationItemPictureUrl;
/**
* 商品图片路径上传存放路径
*/
private String goodsPictureUrl;
/**
* 商品属性图片地址
*/
private String attributePitureUrl;
/**
* 修改会员App用户头像上传
*/
private String headPictureUrl;
/**
* 评价信息图片上传路径
*/
private String evaluatePictureUrl;
/**
* 任务完成上传图片
*/
private String appointmentOrderDetailsUrl;
/**
* 护理机构上传图片
*/
private String nurseStationClassifyUrl;
/**
* 海报图片存放路径
*/
private String posterPictureUrl;
/**
* 海报视频存放路径
*/
private String posterVideoUrl;
/**
* 资讯主缩略图地址
*/
private String leadThumbnailUrl;
/**
* 商品分类图片地址
*/
private String goodsCategoryPicture;
/**
* 护理员App人员头像的上传路径图片上传路径
*/
private String nurseStationAppPersonUrl;
/**
* 获取管理端富文本的上传路径
*/
private String richTextPictureUrl;
/**
* 护理项目分类图标存放地址存放路径
*/
private String nurseItemClassifyUrl;
/**
* 在线客服群二维码存放路径
*/
private String groupQrCodeUrl;
/**
* 科室人员证书图片存放路径
*/
private String certificateUrl;
/**
* 健康咨询 科室人员头像地址
*/
private String personPictureUrl;
/**
* 护理人员证书地址
*/
private String personCertificateUrl;
/**
* 审核护理人员证书地址
*/
private String personCertificateCheckUrl;
/**
* 医路
*/
private String yiLuYouPinStoreName;
/**
* 护理员App上传路径
*/
private String appFileName;
/**
* 泉医到家App文件存放路径
*/
private String appFilePath;
/**
* 培训分类图片路径
*/
private String trainingCategoryPictureUrl;
/**
* 培训项目logo图片路径
*/
private String trainingItemCoverUrl;
/**
* 培训项目海报图片路径
*/
private String trainingItemPosterUrl;
/**
* 培训项目海报图片路径
*/
private String trainingItemContentUrl;
/**
* 培训项目章节视频存放地址
*/
private String itemDirectoryUrl;
/**
* 微信好有邀请二维码存放路径
*/
private String personalWeChatCodeUrl;
/**
* 护理站二维码存放路径
*/
private String stationWechatCodeUrl;
public String getStationWechatCodeUrl() {
return stationWechatCodeUrl;
}
public void setStationWechatCodeUrl(String stationWechatCodeUrl) {
this.stationWechatCodeUrl = stationWechatCodeUrl;
}
public String getPersonalWeChatCodeUrl() {
return personalWeChatCodeUrl;
}
public void setPersonalWeChatCodeUrl(String personalWeChatCodeUrl) {
this.personalWeChatCodeUrl = personalWeChatCodeUrl;
}
public String getAppFilePath() {
return appFilePath;
}
public void setAppFilePath(String appFilePath) {
this.appFilePath = appFilePath;
}
public String getYiLuYouPinStoreName() {
return yiLuYouPinStoreName;
}
public void setYiLuYouPinStoreName(String yiLuYouPinStoreName) {
this.yiLuYouPinStoreName = yiLuYouPinStoreName;
}
public String getName() {
return name;
}
@ -129,4 +322,232 @@ public class XinELuConfig {
public static String getUploadPath() {
return getProfile() + "/upload";
}
}
public String getNurserAppletPicture() {
return nurserAppletPicture;
}
public void setNurserAppletPicture(String nurserAppletPicture) {
this.nurserAppletPicture = nurserAppletPicture;
}
public String getNurserStationPictureUrl() {
return nurserStationPictureUrl;
}
public void setNurserStationPictureUrl(String nurserStationPictureUrl) {
this.nurserStationPictureUrl = nurserStationPictureUrl;
}
public String getNurserStationIntroducePictureUrl() {
return nurserStationIntroducePictureUrl;
}
public void setNurserStationIntroducePictureUrl(String nurserStationIntroducePictureUrl) {
this.nurserStationIntroducePictureUrl = nurserStationIntroducePictureUrl;
}
public String getNurserStationItemPictureUrl() {
return nurserStationItemPictureUrl;
}
public void setNurserStationItemPictureUrl(String nurserStationItemPictureUrl) {
this.nurserStationItemPictureUrl = nurserStationItemPictureUrl;
}
public String getGoodsPictureUrl() {
return goodsPictureUrl;
}
public void setGoodsPictureUrl(String goodsPictureUrl) {
this.goodsPictureUrl = goodsPictureUrl;
}
public String getHeadPictureUrl() {
return headPictureUrl;
}
public void setHeadPictureUrl(String headPictureUrl) {
this.headPictureUrl = headPictureUrl;
}
public String getAppointmentOrderDetailsUrl() {
return appointmentOrderDetailsUrl;
}
public void setAppointmentOrderDetailsUrl(String appointmentOrderDetailsUrl) {
this.appointmentOrderDetailsUrl = appointmentOrderDetailsUrl;
}
public String getAttributePitureUrl() {
return attributePitureUrl;
}
public void setAttributePitureUrl(String attributePitureUrl) {
this.attributePitureUrl = attributePitureUrl;
}
public String getAppFileName() {
return appFileName;
}
public void setAppFileName(String appFileName) {
this.appFileName = appFileName;
}
public String getNurseStationAppPersonUrl() {
return nurseStationAppPersonUrl;
}
public void setNurseStationAppPersonUrl(String nurseStationAppPersonUrl) {
this.nurseStationAppPersonUrl = nurseStationAppPersonUrl;
}
public String getEvaluatePictureUrl() {
return evaluatePictureUrl;
}
public void setEvaluatePictureUrl(String evaluatePictureUrl) {
this.evaluatePictureUrl = evaluatePictureUrl;
}
public String getRichTextPictureUrl() {
return richTextPictureUrl;
}
public void setRichTextPictureUrl(String richTextPictureUrl) {
this.richTextPictureUrl = richTextPictureUrl;
}
public String getGoodsCategoryPicture() {
return goodsCategoryPicture;
}
public void setGoodsCategoryPicture(String goodsCategoryPicture) {
this.goodsCategoryPicture = goodsCategoryPicture;
}
public String getNurseStationClassifyUrl() {
return nurseStationClassifyUrl;
}
public void setNurseStationClassifyUrl(String nurseStationClassifyUrl) {
this.nurseStationClassifyUrl = nurseStationClassifyUrl;
}
public String getNurseItemClassifyUrl() {
return nurseItemClassifyUrl;
}
public void setNurseItemClassifyUrl(String nurseItemClassifyUrl) {
this.nurseItemClassifyUrl = nurseItemClassifyUrl;
}
public String getPosterPictureUrl() {
return posterPictureUrl;
}
public void setPosterPictureUrl(String posterPictureUrl) {
this.posterPictureUrl = posterPictureUrl;
}
public String getLeadThumbnailUrl() {
return leadThumbnailUrl;
}
public void setLeadThumbnailUrl(String leadThumbnailUrl) {
this.leadThumbnailUrl = leadThumbnailUrl;
}
public String getPosterVideoUrl() {
return posterVideoUrl;
}
public void setPosterVideoUrl(String posterVideoUrl) {
this.posterVideoUrl = posterVideoUrl;
}
public String getGroupQrCodeUrl() {
return groupQrCodeUrl;
}
public void setGroupQrCodeUrl(String groupQrCodeUrl) {
this.groupQrCodeUrl = groupQrCodeUrl;
}
public String getCertificateUrl() {
return certificateUrl;
}
public void setCertificateUrl(String certificateUrl) {
this.certificateUrl = certificateUrl;
}
public String getPersonPictureUrl() {
return personPictureUrl;
}
public void setPersonPictureUrl(String personPictureUrl) {
this.personPictureUrl = personPictureUrl;
}
public String getPersonCertificateUrl() {
return personCertificateUrl;
}
public void setPersonCertificateUrl(String personCertificateUrl) {
this.personCertificateUrl = personCertificateUrl;
}
public String getPersonCertificateCheckUrl() {
return personCertificateCheckUrl;
}
public void setPersonCertificateCheckUrl(String personCertificateCheckUrl) {
this.personCertificateCheckUrl = personCertificateCheckUrl;
}
public String getTrainingCategoryPictureUrl() {
return trainingCategoryPictureUrl;
}
public void setTrainingCategoryPictureUrl(String trainingCategoryPictureUrl) {
this.trainingCategoryPictureUrl = trainingCategoryPictureUrl;
}
public String getTrainingItemCoverUrl() {
return trainingItemCoverUrl;
}
public void setTrainingItemCoverUrl(String trainingItemCoverUrl) {
this.trainingItemCoverUrl = trainingItemCoverUrl;
}
public String getTrainingItemPosterUrl() {
return trainingItemPosterUrl;
}
public void setTrainingItemPosterUrl(String trainingItemPosterUrl) {
this.trainingItemPosterUrl = trainingItemPosterUrl;
}
public String getTrainingItemContentUrl() {
return trainingItemContentUrl;
}
public void setTrainingItemContentUrl(String trainingItemContentUrl) {
this.trainingItemContentUrl = trainingItemContentUrl;
}
public String getItemDirectoryUrl() {
return itemDirectoryUrl;
}
public void setItemDirectoryUrl(String itemDirectoryUrl) {
this.itemDirectoryUrl = itemDirectoryUrl;
}
}

View File

@ -134,6 +134,120 @@ public class Constants {
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.xinelu.common.utils.file"};
/**
* Excel文件格式后缀
*/
public static final String XLSX = "xlsx";
/**
* Excel文件格式后缀
*/
public static final String XLS = "xls";
/**
* 护理站模板信息下载
*/
public static final String NURSE_STATION = "nurseStation";
/**
* 护理站人员模板信息下载
*/
public static final String NURSE_STATION_PERSON = "nurseStationPerson";
/**
* 字符串空格标识
*/
public static final String EMPTY = " ";
/**
* 图片上传文件带.
*/
public static final String FILE_NAME_SPOT = ".";
/**
* 护理编码前缀
*/
public static final String PATIENT_PREFIX = "HL";
/**
* 护理站标签编码前缀
*/
public static final String LABEL_CODE = "BQ";
/**
* 护理站图片路径上传
*/
public static final String NURSE_STATION_TYPE = "stationPictureUrl";
/**
* 护理站简介附近图片路径上传
*/
public static final String NURSE_STATION_INTRODUCE_TYPE = "stationIntroducePictureUrl";
/**
* 护理站项目图片路径上传
*/
public static final String NURSE_STATION_ITEM_TYPE = "itemPictureUrl";
/**
* 商品图片路径上传
*/
public static final String GOODS_PICTURE_URL = "goodsPictureUrl";
/**
* 用户头像修改上传
*/
public static final String HEAD_PICTURE_URL = "headPictureUrl";
/**
* 商品分类图片地址
*/
public static final String GOODS_CATEGORY_PICTURE = "goodsCategoryPicture";
/**
* 商品属性图片地址
*/
public static final String ATTRIBUTE_PICTURE_URL = "attributePictureUrl";
/**
* 护理项目分类图标存放地址
*/
public static final String NURSE_ITEM_CLASSIFY_URL = "nurseItemClassifyUrl";
/**
* 护理机构分类图片识别标识
*/
public static final String NURSE_STATION_CLASSIFY_URL = "nurseStationClassifyUrl";
/**
* 海报图片存放路径
*/
public static final String POSTER_PICTURE_URL = "posterPictureUrl";
/**
* 资讯主缩略图地址
*/
public static final String LEAD_THUMBNAIL_URL = "leadThumbnailUrl";
/**
* 护理人员证书地址
*/
public static final String PERSON_CERTIFICATE_URL = "personCertificateUrl";
/**
* 健康咨询科室人员头像地址
*/
public static final String PERSON_PICTURE_URL = "personPictureUrl";
/**
* 健康咨询-科室人员资质证书证书编号前缀
*/
public static final String CERTIFICATE_URL = "certificateUrl";
/**
* 客服图片路径上传
*/
public static final String GROUP_QR_CODE_URL = "groupQrCodeUrl";
/**
* 科室编码前缀
*/

View File

@ -0,0 +1,31 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* 护理机构和护理项目分类信息类型
*
* @author ljh
*/
@Getter
public enum NurseClassifyInfoEnum {
/**
* 护理机构分类
*/
NURSE_AGENCY("NURSE_AGENCY"),
/**
* 护理项目分类
*/
NURSE_ITEM("NURSE_ITEM"),
;
final private String info;
NurseClassifyInfoEnum(String info) {
this.info = info;
}
}

View File

@ -1,21 +1,23 @@
package com.xinelu.common.utils;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.Date;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
* 时间工具类
*
* @author xinelu
* @author xinyilu
*/
@Slf4j
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY = "yyyy";
@ -27,7 +29,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
private static final String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
@ -50,27 +52,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime() {
public static String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow() {
public static String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format) {
public static String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date) {
public static String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date) {
public static String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts) {
public static Date dateTime(final String format, final String ts) {
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
@ -81,7 +83,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* 日期路径 即年// 如2018/08/08
*/
public static final String datePath() {
public static String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
@ -89,7 +91,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* 日期路径 即年// 如20180808
*/
public static final String dateTime() {
public static String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
@ -161,44 +163,226 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return Date.from(zdt.toInstant());
}
/**
* 获取指定日期的结束时间
*
* @param date 指定日期,如果为null,默认为当天
* @return 结束日期
* @author jihan
*/
public static LocalDateTime end(LocalDate date) {
return LocalDateTime.of(null == date ? LocalDate.now() : date, LocalTime.MAX);
}
/**
* 转换日期到字符串
*
* @param date LocalDate
* @param pattern 解析格式
* @return 日期字符串
* @Author jihan
*/
public static String formatDateToString(LocalDate date, String pattern) {
if (Objects.isNull(date)) {
throw new IllegalArgumentException("date time is null.");
}
return date.format(StringUtils.isNotBlank(pattern) ? DateTimeFormatter.ofPattern(pattern) : DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
/**
* 转换日期到字符串
*
* @param date LocalDate
* @param pattern 解析格式
* @return 日期字符串
* @Author jihan
*/
public static String formatDateToString(LocalDate date, String pattern) {
if (Objects.isNull(date)) {
throw new IllegalArgumentException("date time is null.");
}
return date.format(StringUtils.isNotBlank(pattern) ? DateTimeFormatter.ofPattern(pattern) : DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
/**
* 获取指定日期的结束时间
*
* @param date 指定日期,如果为null,默认为当天
* @return 结束日期
* @author jihan
*/
public static LocalDateTime end(LocalDate date) {
return LocalDateTime.of(null == date ? LocalDate.now() : date, LocalTime.MAX);
}
/**
* 计算两个时间的分钟差
*
* @param beginTime 开始时间
* @param endTime 结束时间可以为null, 如果为null则表示now
* @return 分钟差值
* @author jihan
*/
public static long differenceMinutes(LocalDateTime beginTime, LocalDateTime endTime) {
if (null == beginTime) {
throw new IllegalArgumentException("开始时间不能为空");
}
return ChronoUnit.MINUTES.between(beginTime, null == endTime ? LocalDateTime.now() : endTime);
}
/**
* 计算两个时间的分钟差
*
* @param beginTime 开始时间
* @param endTime 结束时间可以为null, 如果为null则表示now
* @return 分钟差值
* @author jihan
*/
public static long differenceMinutes(LocalDateTime beginTime, LocalDateTime endTime) {
if (null == beginTime) {
throw new IllegalArgumentException("开始时间不能为空");
}
return ChronoUnit.MINUTES.between(beginTime, null == endTime ? LocalDateTime.now() : endTime);
}
/**
* 获取过去第几天的日期
*
* @param intervals 几天
* @return java.util.ArrayList<java.lang.String>
**/
public static List<LocalDate> getPastDateList(int intervals) {
List<LocalDate> pastDaysList = new ArrayList<>();
for (int i = 0; i < intervals; i++) {
pastDaysList.add(getPastDate(i));
}
return pastDaysList;
}
/**
* 获取过去第几天的日期
*
* @param past 几天
*/
public static LocalDate getPastDate(int past) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past);
return calendar.getTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
/**
* LocalDateTime转Date
*
* @param localDateTime 日期时间
* @return : java.util.Date
*/
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* Date LocalDateTime
*
* @param date 时间
* @return java.time.LocalDateTime
**/
public static LocalDateTime dateToLocalDate(Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
/**
* String LocalDateTime
*
* @param date 时间
* @return java.time.LocalDateTime
**/
public static LocalDateTime strToLocalDate(String date) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return LocalDateTime.parse(date, df);
}
/**
* LocalDateTime String
*
* @param localDateTime 时间
* @return java.lang.String
**/
public static String localDateToStr(LocalDateTime localDateTime) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return df.format(localDateTime);
}
/**
* long date
*
* @param date 时间
* @return java.util.Date
**/
public static Date longToDate(Long date) {
return new Date(date);
}
/**
* 时间加分钟
*
* @param now 时间
* @param addDate 时间
* @return java.util.Date
**/
public static Date dateAdd(Date now, long addDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
return new Date(now.getTime() + addDate);
}
/**
* 天转分钟
*
* @param date 时间
* @return java.lang.Long
**/
public static Long dateToTime(String date) {
return Long.parseLong(date) * 60 * 24;
}
/**
* date转long
*
* @param date 时间
* @return long
**/
public static long dateToLong(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
return date.getTime();
}
/**
* 字符串转日期
*
* @param str 时间
* @return java.util.Date
**/
public static Date strToDate(String str) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
try {
return df.parse(str);
} catch (ParseException pe) {
log.error(pe.getMessage());
}
return null;
}
/**
* 日期转字符串
*
* @param date 时间
* @return java.lang.String
**/
public static String dateToStr(Date date) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
return df.format(date);
}
/**
* 添加小时
*
* @param day 时间
* @param hour 时间
* @return java.lang.String
**/
public static String addDateHour(String day, int hour) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = format.parse(day);
} catch (Exception ex) {
ex.printStackTrace();
}
if (date == null) {
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
// 24小时制
cal.add(Calendar.HOUR, hour);
date = cal.getTime();
cal = null;
return format.format(date);
}
/**
* 时间戳转LocalDateTime
*
* @param timestamp 时间戳
* @return java.time.LocalDateTime
*/
public static LocalDateTime timestampToLocalDateTime(long timestamp) {
return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8));
}
}

View File

@ -1,14 +1,16 @@
package com.xinelu.common.utils.codes;
import com.xinelu.common.utils.DateUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
/**
* @Description 编号工具类

View File

@ -2,12 +2,14 @@ package com.xinelu.common.utils.file;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.exception.file.FileNameLengthLimitExceededException;
import com.xinelu.common.exception.file.FileSizeLimitExceededException;
import com.xinelu.common.exception.file.InvalidExtensionException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.uuid.Seq;
import com.xinelu.common.utils.uuid.UUID;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
@ -22,10 +24,11 @@ import java.util.Objects;
* @author xinelu
*/
public class FileUploadUtils {
/**
* 默认大小 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
public static final long DEFAULT_MAX_SIZE = 500 * 1024 * 1024;
/**
* 默认的文件名最大长度 100
@ -50,9 +53,9 @@ public class FileUploadUtils {
*
* @param file 上传的文件
* @return 文件名称
* @throws Exception
* @throws IOException 异常信息
*/
public static final String upload(MultipartFile file) throws IOException {
public static String upload(MultipartFile file) throws IOException {
try {
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (Exception e) {
@ -66,9 +69,9 @@ public class FileUploadUtils {
* @param baseDir 相对应用的基目录
* @param file 上传的文件
* @return 文件名称
* @throws IOException
* @throws IOException 异常信息
*/
public static final String upload(String baseDir, MultipartFile file) throws IOException {
public static String upload(String baseDir, MultipartFile file) throws IOException {
try {
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (Exception e) {
@ -88,18 +91,17 @@ public class FileUploadUtils {
* @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常
*/
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
public static String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//校验文件大小
assertAllowed(file, allowedExtension);
//编码文件名
String fileName = extractFilename(file);
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
file.transferTo(Paths.get(absPath));
return getPathFileName(baseDir, fileName);
@ -108,14 +110,20 @@ public class FileUploadUtils {
/**
* 编码文件名
*/
public static final String extractFilename(MultipartFile file) {
public static String extractFilename(MultipartFile file) {
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
/**
* 创建文件路径
*
* @param uploadDir 路径名称
* @param fileName 文件名称
* @return File 文件目录
*/
public static File getAbsoluteFile(String uploadDir, String fileName) {
File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists()) {
if (!desc.getParentFile().exists()) {
desc.getParentFile().mkdirs();
@ -124,7 +132,14 @@ public class FileUploadUtils {
return desc;
}
public static final String getPathFileName(String uploadDir, String fileName) throws IOException {
/**
* 获取文件路径
*
* @param uploadDir 上传路径
* @param fileName 文件名称
* @return 文件路径
*/
public static String getPathFileName(String uploadDir, String fileName) {
int dirLastIndex = XinELuConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
@ -134,17 +149,15 @@ public class FileUploadUtils {
* 文件大小校验
*
* @param file 上传的文件
* @return
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws InvalidExtensionException
* @throws InvalidExtensionException 异常信息
*/
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
public static void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException {
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) {
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
@ -160,6 +173,9 @@ public class FileUploadUtils {
} else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
fileName);
} else if (allowedExtension == MimeTypeUtils.IMAGE_APK) {
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
fileName);
} else {
throw new InvalidExtensionException(allowedExtension, extension, fileName);
}
@ -169,11 +185,11 @@ public class FileUploadUtils {
/**
* 判断MIME类型是否是允许的MIME类型
*
* @param extension
* @param allowedExtension
* @return
* @param extension 文件类型
* @param allowedExtension 文件类型集合
* @return 是否正确
*/
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
public static boolean isAllowedExtension(String extension, String[] allowedExtension) {
for (String str : allowedExtension) {
if (str.equalsIgnoreCase(extension)) {
return true;
@ -188,11 +204,152 @@ public class FileUploadUtils {
* @param file 表单文件
* @return 后缀名
*/
public static final String getExtension(MultipartFile file) {
public static String getExtension(MultipartFile file) {
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension)) {
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
}
return extension;
}
/**
* 文件上传
*
* @param baseDir 相对应用的基目录
* @param file 上传的文件
* @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长
* @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常
*/
public static String uploadNurseStationPath(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//校验文件大小
assertAllowed(file, allowedExtension);
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String substring = uuid.substring(uuid.length() - 10);
//编码文件名
String fileName = extractFilenames(file);
if (StringUtils.isBlank(fileName)) {
throw new ServiceException("文件名称不能为空!");
}
//获取文件路径
String newFileName = "";
if (fileName.contains(Constants.FILE_NAME_SPOT)) {
String firstFileName = fileName.substring(0, fileName.indexOf(".")) + substring;
String lastFileName = fileName.substring(fileName.indexOf("."));
newFileName = firstFileName + lastFileName;
}
if (StringUtils.isBlank(newFileName)) {
throw new ServiceException("文件名称不能为空!");
}
String absPath = getAbsoluteFile(baseDir, newFileName).getAbsolutePath();
file.transferTo(Paths.get(absPath));
return getNurseStationPathFileName(baseDir, newFileName);
}
/**
* 编码文件名
*/
public static String extractFilenames(MultipartFile file) {
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String substring = uuid.substring(uuid.length() - 10);
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(substring), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
/**
* 获取文件名称
*
* @param uploadDir 上传路径
* @param fileName 文件名称
* @return 文件路径
*/
public static String getNurseStationPathFileName(String uploadDir, String fileName) {
int dirLastIndex = XinELuConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
}
/**
* APP头像文件上传
*
* @param baseDir 相对应用的基目录
* @param file 上传的文件
* @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长
* @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常
*/
public static String uploadPictureUrlPath(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//校验文件大小
assertAllowed(file, allowedExtension);
//编码文件名
String fileName = extractFilenamesHear(file);
//获取文件路径
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
file.transferTo(Paths.get(absPath));
return getPathFileName(baseDir, fileName);
}
/**
* 编码文件名
*/
public static String extractFilenamesHear(MultipartFile file) {
return StringUtils.format("{}_{}.{}",
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
/**
* 护理员App上传APK
*
* @param baseDir 相对应用的基目录
* @param file 上传的文件
* @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长
* @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常
*/
public static String uploadPersonAppApkPath(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
//校验文件大小
assertAllowed(file, allowedExtension);
//编码文件名
String fileName = extractAppFilenamesHear(file);
//获取文件路径
String absPath = getAbsoluteFile(baseDir, fileName).getPath();
file.transferTo(Paths.get(absPath));
return baseDir + "/" + fileName;
}
/**
* 新增泉医到家App文件信息获取编码文件名
*/
public static String extractAppFilenamesHear(MultipartFile file) {
return StringUtils.format("{}.{}",
FilenameUtils.getBaseName(file.getOriginalFilename()), getExtension(file));
}
}

View File

@ -1,23 +1,29 @@
package com.xinelu.common.utils.file;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.uuid.IdUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 文件处理工具类
@ -27,15 +33,15 @@ import java.nio.charset.StandardCharsets;
public class FileUtils {
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* 匹配content中的<img />标签
**/
private static final String PATTEN_IMG = "<(img|IMG)(.*?)(/>|></img>|>)";
/**
* 匹配content中的<img />标签
**/
private static final String PATTEN_IMG = "<(img|IMG)(.*?)(/>|></img>|>)";
/**
* 匹配<img />标签中的src
**/
private static final String PATTEN_SRC = "(src|SRC)=(\"|\')(.*?)(\"|\')";
/**
* 匹配<img />标签中的src
**/
private static final String PATTEN_SRC = "(src|SRC)=(\"|\')(.*?)(\"|\')";
/**
* 输出指定文件的byte数组
@ -229,7 +235,7 @@ public class FileUtils {
}
/**
* 获取文件名称 /profile/upload/2022/04/16/xinelu.png -- xinelu.png
* 获取文件名称 /profile/upload/2022/04/16/xinyilu.png -- xinyilu.png
*
* @param fileName 路径名称
* @return 没有文件路径的名称
@ -244,52 +250,127 @@ public class FileUtils {
return fileName.substring(index + 1);
}
/**
* 获取不带后缀文件名称 /profile/upload/2022/04/16/xinelu.png -- xinelu
* 获取img标签中的src值
*
* @param fileName 路径名称
* @return 没有文件路径和后缀的名称
* @param content img的内容
* @return List<String>
*/
public static String getNameNotSuffix(String fileName) {
if (fileName == null) {
return null;
public static List<String> getImgSrc(String content) {
if (StringUtils.isBlank(content)) {
return Lists.newArrayList();
}
String baseName = FilenameUtils.getBaseName(fileName);
return baseName;
List<String> list = new ArrayList<>();
//开始匹配content中的<img />标签
Pattern pImg = Pattern.compile(PATTEN_IMG);
Matcher mImg = pImg.matcher(content);
boolean resultImg = mImg.find();
if (resultImg) {
while (resultImg) {
//获取到匹配的<img />标签中的内容
String strImg = mImg.group(2);
//开始匹配<img />标签中的src
Pattern pSrc = Pattern.compile(PATTEN_SRC);
Matcher mSrc = pSrc.matcher(strImg);
if (mSrc.find()) {
String strSrc = mSrc.group(3);
if (StringUtils.isNotBlank(strSrc)) {
list.add(strSrc);
}
}
//匹配content中是否存在下一个<img />标签有则继续以上步骤匹配<img />标签中的src
resultImg = mImg.find();
}
}
return list;
}
/**
* 获取img标签中的src值
*
* @param content img的内容
* @return List<String>
*/
public static List<String> getImgSrc(String content) {
if (StringUtils.isBlank(content)) {
return Lists.newArrayList();
}
List<String> list = new ArrayList<>();
//开始匹配content中的<img />标签
Pattern pImg = Pattern.compile(PATTEN_IMG);
Matcher mImg = pImg.matcher(content);
boolean resultImg = mImg.find();
if (resultImg) {
while (resultImg) {
//获取到匹配的<img />标签中的内容
String strImg = mImg.group(2);
//开始匹配<img />标签中的src
Pattern pSrc = Pattern.compile(PATTEN_SRC);
Matcher mSrc = pSrc.matcher(strImg);
if (mSrc.find()) {
String strSrc = mSrc.group(3);
if (StringUtils.isNotBlank(strSrc)) {
list.add(strSrc);
}
}
//匹配content中是否存在下一个<img />标签有则继续以上步骤匹配<img />标签中的src
resultImg = mImg.find();
}
}
return list;
}
/**
* 删除系统富文本图片方法
*
* @param databaseUrl 原有图片路径
* @param afferentUrl 传值图片路径
*/
public static void deleteTextUrl(String databaseUrl, String afferentUrl) {
//数据库中的
List<String> databaseImgSrc = Lists.newArrayList();
if (StringUtils.isNotBlank(databaseUrl)) {
databaseImgSrc = FileUtils.getImgSrc(databaseUrl);
}
//前端传的
List<String> afferentImgSrc = Lists.newArrayList();
if (org.apache.commons.lang3.StringUtils.isNotBlank(afferentUrl)) {
afferentImgSrc = FileUtils.getImgSrc(afferentUrl);
}
//差集不同的
List<String> subtractImgSrc = new ArrayList<>(CollectionUtils.subtract(databaseImgSrc, afferentImgSrc));
if (CollectionUtils.isEmpty(subtractImgSrc)) {
return;
}
for (String pictureUrl : subtractImgSrc) {
if (org.apache.commons.lang3.StringUtils.isBlank(pictureUrl)) {
continue;
}
//修改路径
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
//删除商品富文本图片
deleteSystemFile(substring);
}
}
/**
* 根据文件路径删除系统本地文件
*
* @param filePath 文件路径
*/
public static void deleteSystemFile(String filePath) {
if (StringUtils.isBlank(filePath)) {
return;
}
String picture = XinELuConfig.getProfile() + filePath.replaceAll("/profile", "");
File checkReportNameFile = new File(picture);
if (checkReportNameFile.exists()) {
boolean delete = checkReportNameFile.delete();
if (BooleanUtils.isFalse(delete)) {
throw new ServiceException("删除系统文件失败!");
}
}
}
/**
* 图片上传接口
*
* @param uploadPathUrl 路径
* @param multipartFile 文件
* @return AjaxResult
* @throws Exception 异常信息
**/
public static AjaxResult uploadImages(String uploadPathUrl, MultipartFile multipartFile) throws Exception {
String pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
if (org.apache.commons.lang3.StringUtils.isBlank(pictureName)) {
throw new ServiceException("图片上传失败,请联系管理员!");
}
AjaxResult ajax = AjaxResult.success("上传成功!");
ajax.put("imgUrl", pictureName);
return ajax;
}
/**
* 视频上传接口
*
* @param uploadPathUrl 路径
* @param multipartFile 文件
* @return AjaxResult
* @throws Exception 异常信息
**/
public static AjaxResult uploadVideo(String uploadPathUrl, MultipartFile multipartFile) throws Exception {
String pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.VIDEO_EXTENSION);
if (org.apache.commons.lang3.StringUtils.isBlank(pictureName)) {
throw new ServiceException("视频上传失败,请联系管理员!");
}
AjaxResult ajax = AjaxResult.success("上传成功!");
ajax.put("imgUrl", pictureName);
return ajax;
}
}

View File

@ -16,12 +16,16 @@ public class MimeTypeUtils {
public static final String IMAGE_GIF = "image/gif";
public static final String MEDIA_MP4 = "video/mp4";
public static final String[] IMAGE_APK = {"apk"};
public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};
public static final String[] FLASH_EXTENSION = {"swf", "flv"};
public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
"asf", "rm", "rmvb"};
"asf", "rm", "rmvb", "mp4"};
public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb"};
@ -49,6 +53,8 @@ public class MimeTypeUtils {
return "bmp";
case IMAGE_GIF:
return "gif";
case MEDIA_MP4:
return "mp4";
default:
return "";
}

View File

@ -1,10 +1,11 @@
package com.xinelu.common.utils.regex;
import com.xinelu.common.exception.ServiceException;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.util.regex.Pattern;
/**
* @Description 正则表达式工具类
* @Author 纪寒

View File

@ -0,0 +1,208 @@
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;
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.exception.ServiceException;
import com.xinelu.common.utils.poi.ExcelUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ResourceUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
* 护理站信息Controller
*
* @author ljh
* @date 2022-09-02
*/
@RestController
@RequestMapping("/system/station")
public class NurseStationController extends BaseController {
@Resource
private INurseStationService nurseStationService;
/**
* 查询护理站信息列表
*/
@PreAuthorize("@ss.hasPermi('system:station:list')")
@GetMapping("/list")
public TableDataInfo list(NurseStationVO nurseStation) {
startPage();
List<NurseStationVO> list = nurseStationService.selectNurseStationList(nurseStation);
return getDataTable(list);
}
/**
* 导出护理站信息列表
*/
@PreAuthorize("@ss.hasPermi('system:station:export')")
@Log(title = "护理站信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NurseStationVO nurseStation) {
List<NurseStationVO> list = nurseStationService.selectNurseStationList(nurseStation);
ExcelUtil<NurseStationVO> util = new ExcelUtil<>(NurseStationVO.class);
util.exportExcel(response, list, "护理站信息数据");
}
/**
* 获取护理站信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:station:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(nurseStationService.selectNurseStationById(id));
}
/**
* 新增护理站信息
*/
@PreAuthorize("@ss.hasPermi('system:station:add')")
@Log(title = "护理站信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@Validated(Insert.class) @RequestBody NurseStationDTO nurseStation) {
return nurseStationService.insertNurseStation(nurseStation);
}
/**
* 修改护理站信息
*/
@PreAuthorize("@ss.hasPermi('system:station:edit')")
@Log(title = "护理站信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@Validated(Update.class) @RequestBody NurseStationDTO nurseStation) {
return nurseStationService.updateNurseStation(nurseStation);
}
/**
* 删除护理站信息
*/
@PreAuthorize("@ss.hasPermi('system:station:remove')")
@Log(title = "护理站信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return nurseStationService.deleteNurseStationByIds(ids);
}
/**
* 头像图片上传
*/
@PostMapping("/updateNurseStationHeads")
public AjaxResult updateNurseStationHeads(@RequestParam("file") MultipartFile multipartFile, @RequestParam(value = "type") String type) throws Exception {
if (Objects.isNull(multipartFile) || StringUtils.isBlank(multipartFile.getOriginalFilename())) {
return AjaxResult.error("当前文件不存在,无法上传!");
}
if (multipartFile.getOriginalFilename().contains(Constants.EMPTY)) {
return AjaxResult.error("当前文件名含有空格,请先去除空格在上传!");
}
if (StringUtils.isBlank(type)) {
return AjaxResult.error("请选择所要上传的路径类型!");
}
return nurseStationService.updateNurseStationHeads(multipartFile, type);
}
/**
* 导入护理站信息
*
* @param file 模板文件
* @return 导入结果
* @throws Exception 异常信息
*/
@PreAuthorize("@ss.hasPermi('system:station:importStationInfo')")
@Log(title = "导入护理站信息", businessType = BusinessType.IMPORT)
@PostMapping("/insertNurseStationImportList")
public AjaxResult insertNurseStationImportList(MultipartFile file) throws Exception {
//判断excel里面是否有数据/文件格式
if (Objects.isNull(file) || StringUtils.isBlank(file.getOriginalFilename())) {
return AjaxResult.error("请选择需要导入的文件!");
}
// 获取文件名
String orgName = file.getOriginalFilename();
if (!orgName.endsWith(Constants.XLSX) && !orgName.endsWith(Constants.XLS)) {
return AjaxResult.error("导入文件格式不正确请导入xlsx或xls格式的文件");
}
ExcelUtil<NurseStationImportDTO> util = new ExcelUtil<>(NurseStationImportDTO.class);
List<NurseStationImportDTO> list = util.importExcel(file.getInputStream());
return nurseStationService.insertNurseStationImportList(list);
}
/**
* 查询护理站信息列表
*/
@GetMapping("/getSysDictNurseTypeCode")
public List<NurseStationVO> getSysDictNurseTypeCode(NurseStationVO nurseStation) {
return nurseStationService.getSysDictNurseTypeCode(nurseStation);
}
/**
* 护理站基本信息模板 护理人员基本信息导入模板
*
* @param fileType 文件类型
* @param res http请求
**/
@RequestMapping("downloadTemplate")
public void download(@RequestParam(value = "fileType") String fileType, HttpServletResponse res) throws IOException {
if (StringUtils.isBlank(fileType)) {
throw new ServiceException("请选择文件类型!");
}
File file = null;
if (fileType.equals(Constants.NURSE_STATION)) {
file = ResourceUtils.getFile("classpath:template/护理站基本信息模板.xlsx");
}
if (fileType.equals(Constants.NURSE_STATION_PERSON)) {
file = ResourceUtils.getFile("classpath:template/护理站人员基本信息导入模板.xlsx");
}
if (Objects.isNull(file)) {
throw new ServiceException("下载导入模板文件失败,请联系管理员!");
}
res.setCharacterEncoding("UTF-8");
res.setHeader("Content-Disposition", "inline;filename=" + fileType + ".txt");
res.setContentType("text/plain;UTF-8");
ServletOutputStream os = res.getOutputStream();
byte[] bytes = FileUtils.readFileToByteArray(file);
os.write(bytes);
os.flush();
os.close();
}
/**
* 查询护理站信息列表
*/
@GetMapping("/getNurseStationType")
public AjaxResult getNurseStationType(String nurseTypeCode) {
return nurseStationService.getNurseStationType(nurseTypeCode);
}
/**
* 查询护理站信息列表
*/
@GetMapping("/nurseStationByUserId")
public AjaxResult nurseStationByUserId(NurseStationSysUserVO sysUser) {
return nurseStationService.getNurseStationByUserId(sysUser);
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.domain.dto.nursestation;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
/**
* @author ljh
* @version 1.0
* Create by 2022/9/8 12:01
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseStationDTO extends NurseStation implements Serializable {
private static final long serialVersionUID = 1311159088689376468L;
/**
* 护理站的id
**/
private Long nurseStationId;
/**
* 护理站标签信息表id集合
**/
List<Long> nurseStationLabelIdList;
/**
* 护理站标签信息表集合
**/
@Valid
List<NurseStationLabelVO> nurseStationLabelList;
/**
* 护理站所属护理机构分类id数组
*/
Long[] nurseStationClassifyIds;
/**
* 上午营业开始时间前端传值
*/
private String morningOpenStartTimeStr;
/**
* 上午营业结束时间前端传值
*/
private String morningOpenEndTimeStr;
/**
* 下午营业开始时间前端传值
*/
private String afternoonOpenStartTimeStr;
/**
* 下午营业结束时间前端传值
*/
private String afternoonOpenEndTimeStr;
}

View File

@ -0,0 +1,86 @@
package com.xinelu.manage.domain.dto.nursestation;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import lombok.Data;
import java.io.Serializable;
import java.util.Objects;
/**
* @author ljh
* @version 1.0
* Create by 2022/9/16 15:08
*/
@Data
public class NurseStationImportDTO extends BaseDomain implements Serializable {
private static final long serialVersionUID = -820358405795833252L;
/**
* 护理站名称
*/
@Excel(name = "护理站名称")
private String nurseStationName;
/**
* 联系电话
*/
@Excel(name = "护理站电话")
private String phone;
/**
* 护理站地址
*/
@Excel(name = "护理站地址")
private String address;
/**
* 负责人
*/
@Excel(name = "负责人")
private String dutyPerson;
/**
* 负责人联系电话
*/
@Excel(name = "负责人电话")
private String dutyPhone;
/**
* 护理站简介
*/
@Excel(name = "护理站简介")
private String agencyIntroduce;
/**
* 创建人Id
*/
private Long userId;
/**
* 护理站编号
*/
private String nurseStationCode;
/**
* 所属区域编码
*/
private Long areaCode;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NurseStationImportDTO that = (NurseStationImportDTO) o;
return Objects.equals(nurseStationName, that.nurseStationName);
}
@Override
public int hashCode() {
return Objects.hash(nurseStationName);
}
}

View File

@ -0,0 +1,110 @@
package com.xinelu.manage.domain.nurseclassifyinfo;
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.Size;
import java.io.Serializable;
/**
* 护理机构和护理项目分类信息对象 nurse_classify_info
*
* @author xinyilu
* @date 2023-02-08
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理机构和护理项目分类信息对象", description = "nurse_classify_info")
public class NurseClassifyInfo extends BaseDomain implements Serializable {
private static final long serialVersionUID = -5375302736623261278L;
/**
* 主键id
*/
private Long id;
/**
* 父级分类id
*/
@ApiModelProperty(value = "父级分类id")
@Excel(name = "父级分类id")
private Long parentId;
/**
* 分类编码
*/
@ApiModelProperty(value = "分类编码")
@Excel(name = "分类编码")
private String classifyCode;
/**
* 分类名称
*/
@ApiModelProperty(value = "分类名称")
@Excel(name = "分类名称")
@Length(max = 30, message = "分类名称不能超过30个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "分类名称不能为空", groups = {Insert.class, Update.class})
private String classifyName;
/**
* 分类级别
*/
@ApiModelProperty(value = "分类级别")
@Excel(name = "分类级别")
private Integer classifyLevel;
/**
* 分类所属类型NURSE_AGENCY护理机构分类NURSE_ITEM护理项目分类
*/
@ApiModelProperty(value = "分类所属类型NURSE_AGENCY护理机构分类NURSE_ITEM护理项目分类")
@Excel(name = "分类所属类型NURSE_AGENCY护理机构分类NURSE_ITEM护理项目分类")
private String classifyType;
/**
* 分类图标存放地址
*/
@ApiModelProperty(value = "分类图标存放地址")
@Excel(name = "分类图标存放地址")
@NotBlank(message = "分类图标不能为空", groups = {Insert.class, Update.class})
private String classifyPictureUrl;
/**
* 分类排序
*/
@ApiModelProperty(value = "分类排序")
@Excel(name = "分类排序")
@Size(min = 0, max = 5, message = "分类排序不能超过5个字符")
private Integer classifySort;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentId", getParentId())
.append("classifyCode", getClassifyCode())
.append("classifyName", getClassifyName())
.append("classifyLevel", getClassifyLevel())
.append("classifyType", getClassifyType())
.append("classifyPictureUrl", getClassifyPictureUrl())
.append("classifySort", getClassifySort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,237 @@
package com.xinelu.manage.domain.nursestation;
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 javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalTime;
/**
* 护理站信息对象 nurse_station
*
* @author ljh
* @date 2022-09-02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理站信息对象", description = "nurse_station")
public class NurseStation extends BaseDomain implements Serializable {
private static final long serialVersionUID = -6786694820814666195L;
/**
* 主键id
*/
private Long id;
/**
* 所属区域编码
*/
@ApiModelProperty(value = "所属区域编码")
@Excel(name = "所属区域编码")
@NotBlank(message = "所属区域编码不能为空", groups = {Insert.class, Update.class})
private String areaCode;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
@Excel(name = "创建人id")
private Long userId;
/**
* 护理站编号
*/
@ApiModelProperty(value = "护理站编号")
@Excel(name = "护理站编号")
private String nurseStationCode;
/**
* 护理站名称
*/
@ApiModelProperty(value = "护理站名称")
@Excel(name = "护理站名称")
@Length(max = 100, message = "护理站名称不能超过100个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "护理站名称不能为空", groups = {Insert.class, Update.class})
private String nurseStationName;
/**
* 护理类型多个用逗号隔开
*/
@ApiModelProperty(value = "护理类型,多个用逗号隔开")
@Excel(name = "护理类型,多个用逗号隔开")
@Length(max = 200, message = "护理类型不能超过200个字符", groups = {Insert.class, Update.class})
private String nurseStationType;
/**
* 护理站简介
*/
@ApiModelProperty(value = "护理站简介")
@Excel(name = "护理站简介")
@NotBlank(message = "护理站简介不能为空", groups = {Insert.class, Update.class})
private String agencyIntroduce;
/**
* 护理站信息总概述
*/
@ApiModelProperty(value = "护理站信息总概述")
@Excel(name = "护理站信息总概述")
@Length(max = 200, message = "护理站信息总概述不能超过200个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "护理站信息总概述不能为空", groups = {Insert.class, Update.class})
private String nurseStationDescription;
/**
* 护理站经纬横坐标
*/
@ApiModelProperty(value = "护理站经纬")
@Excel(name = "护理站经纬", readConverterExp = "横=坐标")
@NotBlank(message = "护理站经度不能为空", groups = {Insert.class, Update.class})
private String longitude;
/**
* 护理站纬度纵坐标
*/
@ApiModelProperty(value = "护理站纬度")
@Excel(name = "护理站纬度", readConverterExp = "纵=坐标")
@NotBlank(message = "护理站纬度不能为空", groups = {Insert.class, Update.class})
private String latitude;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
@Excel(name = "联系电话")
@Length(max = 11, message = "联系电话不能超过11个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "联系电话不能为空", groups = {Insert.class, Update.class})
private String phone;
/**
* 护理站地址
*/
@ApiModelProperty(value = "护理站地址")
@Excel(name = "护理站地址")
@Length(max = 100, message = "护理站地址不能超过100个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "护理站地址不能为空", groups = {Insert.class, Update.class})
private String address;
/**
* 负责人
*/
@ApiModelProperty(value = "负责人")
@Excel(name = "负责人")
@Length(max = 20, message = "负责人名称不能超过20个字符", groups = {Insert.class, Update.class})
private String dutyPerson;
/**
* 负责人联系电话
*/
@ApiModelProperty(value = "负责人联系电话")
@Excel(name = "负责人联系电话")
@Length(max = 11, message = "负责人联系电话不能超过11个字符", groups = {Insert.class, Update.class})
private String dutyPhone;
/**
* 护理站图片路径
*/
@ApiModelProperty(value = "护理站图片路径")
@Excel(name = "护理站图片路径")
private String stationPictureUrl;
/**
* 护理站简介图片路径
*/
@ApiModelProperty(value = "护理站简介图片路径")
@Excel(name = "护理站简介图片路径")
private String stationIntroducePictureUrl;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
@NotNull(message = "排序不能为空", groups = {Insert.class, Update.class})
@Size(min = 0, max = 5, message = "排序不能超过5个字符")
private Integer sort;
/**
* 护理站等级数字代表几个星
*/
@ApiModelProperty(value = "护理站等级,数字代表几个星")
@Excel(name = "护理站等级,数字代表几个星")
private Integer nurseGrade;
/**
* 营业概述
*/
@ApiModelProperty(value = "营业概述")
@Excel(name = "营业概述")
private String openingHoursDescribe;
/**
* 上午营业开始时间格式HH:mm:ss
*/
private LocalTime morningOpenStartTime;
/**
* 上午营业结束时间格式HH:mm:ss
*/
private LocalTime morningOpenEndTime;
/**
* 下午营业开始时间格式MM:dd
*/
private LocalTime afternoonOpenStartTime;
/**
* 下午营业结束时间格式MM:dd
*/
private LocalTime afternoonOpenEndTime;
/**
* 护理机构微信二维码图片存放地址
*/
private String stationWechatCodeUrl;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("areaCode", getAreaCode())
.append("userId", getUserId())
.append("nurseStationCode", getNurseStationCode())
.append("nurseStationName", getNurseStationName())
.append("nurseStationType", getNurseStationType())
.append("agencyIntroduce", getAgencyIntroduce())
.append("nurseStationDescription", getNurseStationDescription())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("phone", getPhone())
.append("address", getAddress())
.append("dutyPerson", getDutyPerson())
.append("dutyPhone", getDutyPhone())
.append("stationPictureUrl", getStationPictureUrl())
.append("stationIntroducePcitureUrl", getStationIntroducePictureUrl())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.xinelu.manage.domain.nursestationclassifyrelation;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
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 java.io.Serializable;
/**
* 护理机构所属分类关系对象 nurse_station_classify_relation
*
* @author zh
* @date 2023-02-09
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理机构所属分类关系对象", description = "nurse_station_classify_relation")
public class NurseStationClassifyRelation extends BaseDomain implements Serializable {
private static final long serialVersionUID = 4051724936970962134L;
/**
* 主键id
*/
private Long id;
/**
* 护理站id
*/
@ApiModelProperty(value = "护理站id")
@Excel(name = "护理站id")
private Long nurseStationId;
/**
* 护理站所属分类id
*/
@ApiModelProperty(value = "护理站所属分类id")
@Excel(name = "护理站所属分类id")
private Long nurseClassifyId;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nurseStationId", getNurseStationId())
.append("nurseClassifyId", getNurseClassifyId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,168 @@
package com.xinelu.manage.domain.nursestationitem;
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 javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 护理站护理项目对象 nurse_station_item
*
* @author ljh
* @date 2022-09-02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理站护理项目对象", description = "nurse_station_item")
public class NurseStationItem extends BaseDomain implements Serializable {
private static final long serialVersionUID = -50387461159185746L;
/**
* 主键id
*/
@NotNull(message = "请选择护理站护理项目对象", groups = {Update.class})
private Long id;
/**
* 护理站信息表id
*/
@ApiModelProperty(value = "护理站信息表id")
@Excel(name = "护理站信息表id")
@NotNull(message = "所属护理站不能为空", groups = {Insert.class, Update.class})
private Long nurseStationId;
/**
* 护理类型表id
*/
@ApiModelProperty(value = "护理类型表id")
@Excel(name = "护理类型表id")
private Long nurseTypeId;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
@Excel(name = "创建人id")
private Long userId;
/**
* 护理项目编号
*/
@ApiModelProperty(value = "护理项目编号")
@Excel(name = "护理项目编号")
private String nurseItemCode;
/**
* 护理项目名称
*/
@ApiModelProperty(value = "护理项目名称")
@Excel(name = "护理项目名称")
@NotNull(message = "护理项目名称不能为空", groups = {Insert.class, Update.class})
@Length(max = 50, message = "护理项目名称不能超过50个字符", groups = {Insert.class, Update.class})
private String nurseItemName;
/**
* 护理项目内容简介
*/
@ApiModelProperty(value = "护理项目内容简介")
@Excel(name = "护理项目内容简介")
@NotNull(message = "护理项目内容简介不能为空", groups = {Insert.class, Update.class})
private String nurseItemContent;
/**
* 提前预约时长单位小时
*/
@ApiModelProperty(value = "提前预约时长,单位小时")
@Excel(name = "提前预约时长,单位小时")
private String advanceAppointDuration;
/**
* 护理项目图片地址
*/
@ApiModelProperty(value = "护理项目图片地址")
@Excel(name = "护理项目图片地址")
@NotNull(message = "护理项目图片地址不能为空", groups = {Insert.class, Update.class})
@Length(max = 300, message = "护理项目图片地址不能超过300个字符", groups = {Insert.class, Update.class})
private String itemPictureUrl;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
private Integer sort;
/**
* 护理项目所属分类id`
*/
@ApiModelProperty(value = "护理项目所属分类id")
@Excel(name = "护理项目所属分类id")
private Long nurseClassifyId;
/**
* 护理项目每个时间点的预约人数上限
*/
@ApiModelProperty(value = "护理项目每个时间点的预约人数上限")
@Excel(name = "护理项目每个时间点的预约人数上限")
@Size(min = 0, max = 8, message = "护理项目每个时间点的预约人数上限长度不能超过8个字符")
private Integer appointmentLimitCount;
/**
* 护理项目预约时间点间隔 半小时HALF_HOUR一小时ONE_HOUR九十分钟NINETY_MINUTES两小时TWO_HOUR
*/
@ApiModelProperty(value = "护理项目预约时间点间隔")
@Excel(name = "护理项目预约时间点间隔")
@NotBlank(message = "护理项目预约时间点间隔不能为空", groups = {Insert.class, Update.class})
private String appointmentTimeInterval;
/**
* 护理项目所属分类名称
*/
@ApiModelProperty(value = "护理项目所属分类名称")
@Excel(name = "护理项目所属分类名称")
private String nurseClassifyName;
/**
* 上架状态NOT_SHELF未上架SHELF已上架
*/
private String shelfStatus;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nurseStationId", getNurseStationId())
.append("nurseTypeId", getNurseTypeId())
.append("userId", getUserId())
.append("nurseItemCode", getNurseItemCode())
.append("nurseItemName", getNurseItemName())
.append("nurseItemContent", getNurseItemContent())
.append("advanceAppointDuration", getAdvanceAppointDuration())
.append("itemPictureUrl", getItemPictureUrl())
.append("sort", getSort())
.append("nurseClassifyId", getNurseClassifyId())
.append("appointmentLimitCount", getAppointmentLimitCount())
.append("appointmentTimeInterval", getAppointmentTimeInterval())
.append("nurseClassifyName", getNurseClassifyName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.domain.nursestationlabel;
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 javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 护理站标签信息对象 nurse_station_label
*
* @author 纪寒
* @date 2022-09-05
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理站标签信息对象", description = "nurse_station_label")
public class NurseStationLabel extends BaseDomain implements Serializable {
private static final long serialVersionUID = 385185619581249467L;
/**
* 主键id
*/
private Long id;
/**
* 护理站主表id
*/
@ApiModelProperty(value = "护理站主表id")
@Excel(name = "护理站主表id")
private Long nurseStationId;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
@Excel(name = "创建人id")
private Long userId;
/**
* 标签编码
*/
@ApiModelProperty(value = "标签编码")
@Excel(name = "标签编码")
private String labelCode;
/**
* 护理站标签描述
*/
@ApiModelProperty(value = "护理站标签描述")
@Excel(name = "护理站标签描述")
@NotBlank(message = "护理站标签描述不能为空", groups = {Insert.class, Update.class})
private String labelDescription;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
@NotNull(message = "护理站标签排序不能为空", groups = {Insert.class, Update.class})
private Integer sort;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nurseStationId", getNurseStationId())
.append("userId", getUserId())
.append("labelCode", getLabelCode())
.append("labelDescription", getLabelDescription())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,75 @@
package com.xinelu.manage.domain.nursetype;
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 java.io.Serializable;
/**
* 护理类型信息对象 nurse_type
*
* @author 纪寒
* @date 2022-09-02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "护理类型信息对象", description = "nurse_type")
public class NurseType extends BaseDomain implements Serializable {
private static final long serialVersionUID = -9129758108652051712L;
/**
* 主键id
*/
private Long id;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
@Excel(name = "创建人id")
private Long userId;
/**
* 护理类型编码
*/
@ApiModelProperty(value = "护理类型编码")
@Excel(name = "护理类型编码")
private String nurseTypeCode;
/**
* 护理类型名称
*/
@ApiModelProperty(value = "护理类型名称")
@Excel(name = "护理类型名称")
@Length(max = 50, message = "护理类型名称不能超过50个字符", groups = {Insert.class, Update.class})
@NotBlank(message = "护理类型名称不能为空", groups = {Insert.class, Update.class})
private String nurseTypeName;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("nurseTypeCode", getNurseTypeCode())
.append("nurseTypeName", getNurseTypeName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,106 @@
package com.xinelu.manage.domain.sysarea;
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 javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 区域对象 sys_area
*
* @author jihan
* @date 2022-09-02
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "区域对象", description = "sys_area")
public class SysArea extends BaseDomain implements Serializable {
private static final long serialVersionUID = -7082314399349945860L;
/**
* 主键id
*/
@NotNull(message = "主键id不能为空", groups = {Update.class})
private Long id;
/**
* 父级id
*/
@ApiModelProperty(value = "父级id")
@Excel(name = "父级id")
private Long parentId;
/**
* 区域编码
*/
@ApiModelProperty(value = "区域编码")
@Excel(name = "区域编码")
@NotBlank(message = "区域编码不能为空", groups = {Insert.class, Update.class})
private String areaCode;
/**
* 区域名称
*/
@ApiModelProperty(value = "区域名称")
@Excel(name = "区域名称")
@NotBlank(message = "区域名称不能为空", groups = {Insert.class, Update.class})
private String areaName;
/**
* 区域级别
*/
@ApiModelProperty(value = "区域级别")
@Excel(name = "区域级别")
private Integer areaLevel;
/**
* 当前区域所属上级区域编码父级区域编码
*/
@ApiModelProperty(value = "当前区域所属上级区域编码")
@Excel(name = "当前区域所属上级区域编码")
private String parentCode;
/**
* 偏远地区标识01
*/
@ApiModelProperty(value = "偏远地区标识")
@Excel(name = "偏远地区标识")
@NotNull(message = "偏远地区标识不能为空", groups = {Insert.class, Update.class})
private Integer remoteSigns;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
private Long sort;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentId", getParentId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("areaLevel", getAreaLevel())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,82 @@
package com.xinelu.manage.domain.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 lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 护理站以及起所在区域
*
* @author ZH
* @date 2022-09-02
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseStationAndAreaVO extends NurseStation implements Serializable {
private static final long serialVersionUID = -6292739444042098764L;
/**
* 主键id
*/
private String provinceName;
/**
* 父级id
*/
private String provinceCode;
/**
* 主键id
*/
private String cityName;
/**
* 父级id
*/
private String cityCode;
/**
* 主键id
*/
private String regionName;
/**
* 父级id
*/
private String regionCode;
/**
* 主键id
*/
private String streetName;
/**
* 父级id
*/
private String streetCode;
/**
* 护理站所在地区
*/
private SysAreaVO sysAreaVOList;
/**
* 护理站标签信息
*/
private List<NurseStationLabelVO> nurseStationLabel;
/**
* 护理机构分类信息
*/
private List<NurseClassifyInfo> nurseClassifyInfoList;
/**
* 护理站所属护理机构名称集合的字符串
*/
private String classifyNameList;
}

View File

@ -0,0 +1,30 @@
package com.xinelu.manage.domain.vo.nursestation;
import com.xinelu.manage.domain.nursestation.NurseStation;
import com.xinelu.manage.domain.vo.sysarea.SysAreaVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author wanghao
* @create 2022/9/21 0021
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseStationByUserVO extends NurseStation implements Serializable {
private static final long serialVersionUID = 5831823552404704142L;
private String isAdmin;
/**
* 护理站区域集合
*/
List<SysAreaVO> sysAreaVOList;
/**
* 区域名称
*/
private String areaName;
}

View File

@ -0,0 +1,66 @@
package com.xinelu.manage.domain.vo.nursestation;
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.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author ljh
* @version 1.0
* Create by 2022/11/7 10:34
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseStationLabelVO extends BaseDomain implements Serializable {
private static final long serialVersionUID = -6783958798607978604L;
/**
* 主键id
*/
private Long id;
/**
* 护理站主表id
*/
@ApiModelProperty(value = "护理站主表id")
@Excel(name = "护理站主表id")
private Long nurseStationId;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
@Excel(name = "创建人id")
private Long userId;
/**
* 标签编码
*/
@ApiModelProperty(value = "标签编码")
@Excel(name = "标签编码")
private String labelCode;
/**
* 护理站标签描述
*/
@ApiModelProperty(value = "护理站标签描述")
@Excel(name = "护理站标签描述")
@NotBlank(message = "护理站标签描述不能为空", groups = {Insert.class, Update.class})
private String labelDescription;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
@NotNull(message = "护理站标签排序不能为空", groups = {Insert.class, Update.class})
private Integer labelSort;
}

View File

@ -0,0 +1,50 @@
package com.xinelu.manage.domain.vo.nursestation;
import lombok.Data;
import java.io.Serializable;
/**
* @author ljh
* @version 1.0
* Create by 2022/10/26 15:03
*/
@Data
public class NurseStationSysUserVO implements Serializable {
private static final long serialVersionUID = 882956979178904302L;
/**
* 用户ID
*/
private Long userId;
/**
* 用户所属护理站id集合多个用逗号隔开
*/
private String nurseStationIds;
/**
* 护理站ID
*/
private Long nurseStationId;
/**
* 护理站名称
*/
private String nurseStationName;
/**
* 护理站图片路径
*/
private String stationPictureUrl;
/**
* 护理站简介图片路径
*/
private String stationIntroducePcitureUrl;
/**
* 护理站简介
*/
private String agencyIntroduce;
}

View File

@ -0,0 +1,54 @@
package com.xinelu.manage.domain.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 lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author ljh
* @version 1.0
* Create by 2022/9/20 14:27
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseStationVO extends NurseStation implements Serializable {
private static final long serialVersionUID = -5498280873851943793L;
/**
* 字典表的护理类型
**/
private String dictName;
/**
* 字典表的护理类型名称
**/
private String nurseTypeName;
/**
* 字典表的护理类型编码
**/
private String nurseTypeCode;
/**
* 护理站类型集合
*/
List<NurseType> nurseTypeList;
/**
* 护理站区域集合
*/
List<SysAreaVO> sysAreaVOList;
/**
* 区域名称
*/
private String areaName;
}

View File

@ -0,0 +1,51 @@
package com.xinelu.manage.domain.vo.sysarea;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 区域信息返回值实体类
* @Author 纪寒
* @Date 2022-09-07 13:40:09
* @Version 1.0
*/
@Data
public class AreaInfoVO implements Serializable {
private static final long serialVersionUID = 1291062789068003643L;
/**
* 主键id
*/
private Long id;
/**
* 父级id
*/
private Long parentId;
/**
* 区域编码
*/
private String areaCode;
/**
* 区域名称
*/
private String areaName;
/**
* 区域级别
*/
private Integer areaLevel;
/**
* 排序
*/
private Long sort;
/**
* 下级区域集合
*/
private List<AreaInfoVO> children;
}

View File

@ -0,0 +1,23 @@
package com.xinelu.manage.domain.vo.sysarea;
import com.xinelu.manage.domain.sysarea.SysArea;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Description 查询区域信息及上级区域信息
* @Author zhangHeng
* @Date 2023-1-09
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ParentAreaVO extends SysArea implements Serializable {
private static final long serialVersionUID = 5935612028047136844L;
/**
* 上级区域名称
*/
private String parentName;
}

View File

@ -0,0 +1,62 @@
package com.xinelu.manage.domain.vo.sysarea;
import lombok.Data;
import java.io.Serializable;
/**
* @author ljh
* @version 1.0
* Create by 2022/9/20 17:58
*/
@Data
public class SysAreaVO implements Serializable {
private static final long serialVersionUID = -6098312186830650793L;
/**
* 省名称
*/
private String provinceName;
/**
* 省区域编码
*/
private String provinceCode;
/**
* 市名称
*/
private String cityName;
/**
* 市区域编码
*/
private String cityCode;
/**
* 区域名称
*/
private String regionName;
/**
* 区区域编码
*/
private String regionCode;
/**
* 街道名称
*/
private String streetName;
/**
* 街道区域编码
*/
private String streetCode;
/**
* 街道区域编码
*/
private String areaCode;
}

View File

@ -0,0 +1,257 @@
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 org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 护理站信息Mapper接口
*
* @author ljh
* @date 2022-09-02
*/
public interface NurseStationMapper {
/**
* 查询护理站信息
*
* @param id 护理站信息主键
* @return 护理站信息
*/
NurseStationAndAreaVO selectNurseStationById(Long id);
/**
* 查询护理站信息列表
*
* @param nurseStation 护理站信息
* @return 护理站信息集合
*/
List<NurseStationVO> selectNurseStationList(NurseStationVO nurseStation);
/**
* 查询护理站信息列表
*
* @param nurseStation 输入参数
* @return 护理站列表信息
*/
List<NurseStationByUserVO> selectNurseStationListByUser(NurseStation nurseStation);
/**
* 通过护理站名称集合查询数据
*
* @param nurseStationIdList 护理站id集合
* @param nurseStationCode 护理站编码
* @param nurseStationName 护理站名称
* @return 列表信息
*/
List<NurseStationByUserVO> selectNurseStationListByIds(@Param("nurseStationIdList") List<String> nurseStationIdList,
@Param("nurseStationCode") String nurseStationCode,
@Param("nurseStationName") String nurseStationName);
/**
* 新增护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
int insertNurseStation(NurseStation nurseStation);
/**
* 修改护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
int updateNurseStation(NurseStation nurseStation);
/**
* 删除护理站信息
*
* @param id 护理站信息主键
* @return 结果
*/
int deleteNurseStationById(Long id);
/**
* 批量删除护理站信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteNurseStationByIds(Long[] ids);
/**
* 修改护理站图片路径
*
* @param nurseStationCode 护理站编号
* @param stationPictureUrl 护理站头像图片地址
* @return int
**/
int updateNurseStationByHead(@Param("nurseStationCode") String nurseStationCode, @Param("stationPictureUrl") String stationPictureUrl);
/**
* 修改护理站简介图片路径
*
* @param nurseStationCode 护理站编号
* @param stationIntroducePcitureUrl 护理站图片路径
* @return int
**/
int updateNurseStationIntroduceByHead(@Param("nurseStationCode") String nurseStationCode, @Param("stationIntroducePcitureUrl") String stationIntroducePcitureUrl);
/**
* 修改护理站项目头像图片
*
* @param nurseItemCode 护理项目编号
* @param itemPictureUrl 护理项目图片地址
* @return int
**/
int updateNurseStationItemByHead(@Param("nurseItemCode") String nurseItemCode, @Param("itemPictureUrl") String itemPictureUrl);
/**
* 根据护理项目编号查询护理站信息
*
* @param nurseItemCode 护理站项目编号
* @return com.xinyilu.base.domain.nursestationitem.NurseStationItem
**/
NurseStationItem getNurseItemCode(String nurseItemCode);
/**
* 根据护理站编号查询所有信息
*
* @param nurseStationCode 护理站编号
* @return com.xinyilu.base.domain.nursestation.NurseStation
**/
NurseStation getNurseStationCode(String nurseStationCode);
/**
* 根据护理站名称查询护理站信息列表
*
* @param nurseStationIdList 护理站信息
* @return 护理站信息集合
*/
List<NurseStation> selectNurseStationListByNames(@Param("nurseStationIdList") List<String> nurseStationIdList);
/**
* 护理站信息导入
*
* @param nurseStation 护理站信息
* @return int
**/
int insertNurseStationImportList(List<NurseStation> nurseStation);
/**
* 查询护理站名称是否重复
*
* @param areaCode 所属区域编码
* @param nurseStationName 护理站名称
* @return int
**/
int getNurseStationName(@Param("areaCode") String areaCode, @Param("nurseStationName") String nurseStationName);
/**
* 获取字典中的护理类型编码
*
* @param nurseStation 护理站字典信息
* @return com.xinyilu.base.vo.nursestation.NurseStationVO
**/
List<NurseStationVO> getSysDictNurseTypeCode(NurseStationVO nurseStation);
/**
* 根据护理站id删除护理站标签信息
*
* @param ids 需要删除的数据主键集合
* @return int 结果
**/
int deleteNurseStationLabelByIds(Long[] ids);
/**
* 根据护理站id查询护理站标签信息
*
* @param ids 护理站id
* @return int id
**/
int selectNurseStationLabelByIds(Long[] ids);
/**
* 根据护理站类型编码查询护理站类型名称
*
* @param nurseTypeCodeList 护理站类型编码
* @return java.util.List<com.xinyilu.base.domain.nursetype.NurseType>
**/
List<NurseType> getNurseStationType(@Param("nurseTypeCodeList") List<String> nurseTypeCodeList);
/**
* 查询护理站标签信息
*
* @param nurseStationId 护理站信息主键
* @return 护理站标签信息
*/
List<NurseStationLabel> selectStationLabelByStationId(Long nurseStationId);
/**
* 根据用户id查询护理站
*
* @param sysUser 用户信息
* @return java.util.List<com.xinyilu.base.domain.nursestation.NurseStation>
**/
NurseStationSysUserVO getNurseStationByUserId(NurseStationSysUserVO sysUser);
/**
* 根据用户id查询护理站
*
* @param nurseStationIdsList 用户信息
* @return java.util.List<com.xinyilu.base.domain.nursestation.NurseStation>
**/
List<NurseStationSysUserVO> getNurseStationIds(@Param("nurseStationIdsList") List<Long> nurseStationIdsList);
/**
* 查询所有的护理站列表信息
*
* @param nurseStationNames 护理站名称集合
* @return 列表集合信息
*/
List<NurseStationImportDTO> getAllNurseStationInfo(@Param("nurseStationNameList") List<String> nurseStationNames);
/**
* 根据护理站id查询护理站信息是否存在
*
* @param idList 护理站id
* @return 护理站个数
*/
int getNurseStationCount(@Param("idList") List<Long> idList);
/**
* 根据id查询护理站表信息
*
* @param stationId 护理站id
* @return 护理站信息
*/
NurseStation getNurseStationById(Long stationId);
/**
* 修改机构二维码地址信息
*
* @param stationId 机构id
* @param stationWeChatCodeUrl 机构二维码地址
* @return 数量
*/
int updateStationWeChatCodeUrl(@Param("stationId") Long stationId, @Param("stationWeChatCodeUrl") String stationWeChatCodeUrl);
}

View File

@ -0,0 +1,103 @@
package com.xinelu.manage.mapper.nursestationclassifyrelation;
import com.xinelu.manage.domain.nursestationclassifyrelation.NurseStationClassifyRelation;
import java.util.List;
/**
* 护理机构所属分类关系Mapper接口
*
* @author zh
* @date 2023-02-09
*/
public interface NurseStationClassifyRelationMapper {
/**
* 查询护理机构所属分类关系
*
* @param id 护理机构所属分类关系主键
* @return 护理机构所属分类关系
*/
NurseStationClassifyRelation selectNurseStationClassifyRelationById(Long id);
/**
* 查询护理机构所属分类关系列表
*
* @param nurseStationClassifyRelation 护理机构所属分类关系
* @return 护理机构所属分类关系集合
*/
List<NurseStationClassifyRelation> selectNurseStationClassifyRelationList(NurseStationClassifyRelation nurseStationClassifyRelation);
/**
* 新增护理机构所属分类关系
*
* @param nurseStationClassifyRelation 护理机构所属分类关系
* @return 结果
*/
int insertNurseStationClassifyRelation(NurseStationClassifyRelation nurseStationClassifyRelation);
/**
* 修改护理机构所属分类关系
*
* @param nurseStationClassifyRelation 护理机构所属分类关系
* @return 结果
*/
int updateNurseStationClassifyRelation(NurseStationClassifyRelation nurseStationClassifyRelation);
/**
* 删除护理机构所属分类关系
*
* @param id 护理机构所属分类关系主键
* @return 结果
*/
int deleteNurseStationClassifyRelationById(Long id);
/**
* 批量删除护理机构所属分类关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteNurseStationClassifyRelationByIds(Long[] ids);
/**
* 批量新增护理机构所属分类关系
*
* @param nurseStationClassifyRelationList 护理机构所属分类集合
* @return 结果
*/
int insertNurseStationClassifyRelationList(List<NurseStationClassifyRelation> nurseStationClassifyRelationList);
/**
* 查询护理机构是否有分类
*
* @param nurseStationId 护理站id
* @return 数量
*/
int selectNurseStationClassifyRelationByStationId(Long nurseStationId);
/**
* 查询护理机构是否有分类
*
* @param nurseStationId 护理站id
* @return 数量
*/
int selectNurseStationClassifyRelationByStationIds(Long[] nurseStationId);
/**
* 根据护理站id批量删除护理机构所属分类关系
*
* @param nurseStationId 护理站id
* @return 结果
*/
int deleteStationClassifyRelationByStationId(Long nurseStationId);
/**
* 根据护理站id批量删除护理机构所属分类关系
*
* @param nurseStationId 护理站id
* @return 结果
*/
int deleteStationClassifyRelationByStationIds(Long[] nurseStationId);
}

View File

@ -0,0 +1,159 @@
<?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.applet.mapper.nursestationclassifyrelation.NurseStationClassifyRelationMapper">
<resultMap type="NurseStationClassifyRelation" id="NurseStationClassifyRelationResult">
<result property="id" column="id"/>
<result property="nurseStationId" column="nurse_station_id"/>
<result property="nurseClassifyId" column="nurse_classify_id"/>
<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="selectNurseStationClassifyRelationVo">
select id, nurse_station_id, nurse_classify_id, create_by, create_time, update_by, update_time
from nurse_station_classify_relation
</sql>
<select id="selectNurseStationClassifyRelationList" parameterType="NurseStationClassifyRelation"
resultMap="NurseStationClassifyRelationResult">
<include refid="selectNurseStationClassifyRelationVo"/>
<where>
<if test="nurseStationId != null ">
and nurse_station_id = #{nurseStationId}
</if>
<if test="nurseClassifyId != null ">
and nurse_classify_id = #{nurseClassifyId}
</if>
</where>
</select>
<select id="selectNurseStationClassifyRelationById" parameterType="Long"
resultMap="NurseStationClassifyRelationResult">
<include refid="selectNurseStationClassifyRelationVo"/>
where id = #{id}
</select>
<insert id="insertNurseStationClassifyRelation" parameterType="NurseStationClassifyRelation" useGeneratedKeys="true"
keyProperty="id">
insert into nurse_station_classify_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nurseStationId != null">nurse_station_id,
</if>
<if test="nurseClassifyId != null">nurse_classify_id,
</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="nurseStationId != null">#{nurseStationId},
</if>
<if test="nurseClassifyId != null">#{nurseClassifyId},
</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="updateNurseStationClassifyRelation" parameterType="NurseStationClassifyRelation">
update nurse_station_classify_relation
<trim prefix="SET" suffixOverrides=",">
<if test="nurseStationId != null">nurse_station_id =
#{nurseStationId},
</if>
<if test="nurseClassifyId != null">nurse_classify_id =
#{nurseClassifyId},
</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="deleteNurseStationClassifyRelationById" parameterType="Long">
delete
from nurse_station_classify_relation
where id = #{id}
</delete>
<delete id="deleteNurseStationClassifyRelationByIds" parameterType="String">
delete from nurse_station_classify_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertNurseStationClassifyRelationList">
insert into nurse_station_classify_relation (
nurse_station_id,
nurse_classify_id,
create_by,
create_time
)
values
<foreach item="nurseStationClassifyRelationList" index="index" collection="list" separator=",">
(
#{nurseStationClassifyRelationList.nurseStationId},
#{nurseStationClassifyRelationList.nurseClassifyId},
#{nurseStationClassifyRelationList.createBy},
#{nurseStationClassifyRelationList.createTime}
)
</foreach>
</insert>
<select id="selectNurseStationClassifyRelationByStationId" resultType="java.lang.Integer">
select count(1)
from nurse_station_classify_relation
where nurse_station_id = #{nurseStationId}
</select>
<select id="selectNurseStationClassifyRelationByStationIds" resultType="java.lang.Integer">
select count(1)
from nurse_station_classify_relation
where nurse_station_id in
<foreach item="nurseStationId" collection="array" open="(" separator="," close=")">
#{nurseStationId}
</foreach>
</select>
<delete id="deleteStationClassifyRelationByStationId">
delete
from nurse_station_classify_relation
where nurse_station_id = #{nurseStationId}
</delete>
<delete id="deleteStationClassifyRelationByStationIds">
delete
from nurse_station_classify_relation
where nurse_station_id in
<foreach item="nurseStationId" collection="array" open="(" separator="," close=")">
#{nurseStationId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,87 @@
package com.xinelu.manage.mapper.nursestationlabel;
import com.xinelu.manage.domain.nursestationlabel.NurseStationLabel;
import com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 护理站标签信息Mapper接口
*
* @author 纪寒
* @date 2022-09-05
*/
public interface NurseStationLabelMapper {
/**
* 查询护理站标签信息
*
* @param id 护理站标签信息主键
* @return 护理站标签信息
*/
NurseStationLabel selectNurseStationLabelById(Long id);
/**
* 查询护理站标签信息列表
*
* @param nurseStationLabel 护理站标签信息
* @return 护理站标签信息集合
*/
List<NurseStationLabel> selectNurseStationLabelList(NurseStationLabel nurseStationLabel);
/**
* 新增护理站标签信息
*
* @param nurseStationLabel 护理站标签信息
* @return 结果
*/
int insertNurseStationLabel(NurseStationLabel nurseStationLabel);
/**
* 修改护理站标签信息
*
* @param nurseStationLabel 护理站标签信息
* @return 结果
*/
int updateNurseStationLabel(NurseStationLabel nurseStationLabel);
/**
* 删除护理站标签信息
*
* @param id 护理站标签信息主键
* @return 结果
*/
int deleteNurseStationLabelById(Long id);
/**
* 批量删除护理站标签信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteNurseStationLabelByIds(Long[] ids);
/**
* 根据护理站id 查询护理站标签信息
*
* @param nurseStationId 护理站id
* @return int
**/
int getNurseStationLabelStationId(Long nurseStationId);
/**
* 根据护理站id 删除护理站标签信息
*
* @param nurseStationId 护理站id
* @return int
**/
int deleteNurseStationLabelStationId(Long nurseStationId);
/**
* 批量新增护理站标签信息
*
* @param nurseStationLabelList 护理站标签信息集合
* @return 结果
*/
int insertBatchNurseStationLabel(@Param("nurseStationLabelList") List<NurseStationLabelVO> nurseStationLabelList);
}

View File

@ -0,0 +1,189 @@
<?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.applet.mapper.nursestationlabel.NurseStationLabelMapper">
<resultMap type="NurseStationLabel" id="NurseStationLabelResult">
<result property="id" column="id"/>
<result property="nurseStationId" column="nurse_station_id"/>
<result property="userId" column="user_id"/>
<result property="labelCode" column="label_code"/>
<result property="labelDescription" column="label_description"/>
<result property="sort" column="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="selectNurseStationLabelVo">
select id,
nurse_station_id,
user_id,
label_code,
label_description,
sort,
create_by,
create_time,
update_by,
update_time
from nurse_station_label
</sql>
<select id="selectNurseStationLabelList" parameterType="NurseStationLabel" resultMap="NurseStationLabelResult">
<include refid="selectNurseStationLabelVo"/>
<where>
<if test="nurseStationId != null ">
and nurse_station_id = #{nurseStationId}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="labelCode != null and labelCode != ''">
and label_code = #{labelCode}
</if>
<if test="labelDescription != null and labelDescription != ''">
and label_description = #{labelDescription}
</if>
<if test="sort != null ">
and sort = #{sort}
</if>
order by create_time desc
</where>
</select>
<select id="selectNurseStationLabelById" parameterType="Long"
resultMap="NurseStationLabelResult">
<include refid="selectNurseStationLabelVo"/>
where id = #{id}
</select>
<insert id="insertNurseStationLabel" parameterType="NurseStationLabel" useGeneratedKeys="true"
keyProperty="id">
insert into nurse_station_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nurseStationId != null">nurse_station_id,
</if>
<if test="userId != null">user_id,
</if>
<if test="labelCode != null">label_code,
</if>
<if test="labelDescription != null">label_description,
</if>
<if test="sort != null">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="nurseStationId != null">#{nurseStationId},
</if>
<if test="userId != null">#{userId},
</if>
<if test="labelCode != null">#{labelCode},
</if>
<if test="labelDescription != null">#{labelDescription},
</if>
<if test="sort != null">#{sort},
</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="updateNurseStationLabel" parameterType="NurseStationLabel">
update nurse_station_label
<trim prefix="SET" suffixOverrides=",">
<if test="nurseStationId != null">nurse_station_id =
#{nurseStationId},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="labelCode != null">label_code =
#{labelCode},
</if>
<if test="labelDescription != null">label_description =
#{labelDescription},
</if>
<if test="sort != null">sort =
#{sort},
</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="deleteNurseStationLabelById" parameterType="Long">
delete
from nurse_station_label
where id = #{id}
</delete>
<delete id="deleteNurseStationLabelByIds" parameterType="String">
delete from nurse_station_label where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getNurseStationLabelStationId" parameterType="long" resultType="int">
SELECT count(1)
FROM nurse_station_label
WHERE nurse_station_id = #{nurseStationId}
</select>
<delete id="deleteNurseStationLabelStationId" parameterType="Long">
DELETE
FROM nurse_station_label
WHERE nurse_station_id = #{nurseStationId}
</delete>
<insert id="insertBatchNurseStationLabel" parameterType="java.util.List">
insert into nurse_station_label(
nurse_station_id,
user_id,
label_code,
label_description,
sort,
create_by,
create_time
) values
<foreach item="label" index="index" collection="nurseStationLabelList" separator=",">
(
#{label.nurseStationId},
#{label.userId},
#{label.labelCode},
#{label.labelDescription},
#{label.labelSort},
#{label.createBy},
#{label.createTime}
)
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,123 @@
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 org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 区域Mapper接口
*
* @author jihan
* @date 2022-09-02
*/
public interface SysAreaMapper {
/**
* 查询区域
*
* @param id 区域主键
* @param areaCode 区域
* @return 区域
*/
SysArea selectSysAreaById(@Param("id") Long id, @Param("areaCode") String areaCode);
/**
* 查询区域列表
*
* @param sysArea 区域
* @return 区域集合
*/
List<SysArea> selectSysAreaList(SysArea sysArea);
/**
* 新增区域
*
* @param sysArea 区域
* @return 结果
*/
int insertSysArea(SysArea sysArea);
/**
* 修改区域
*
* @param sysArea 区域
* @return 结果
*/
int updateSysArea(SysArea sysArea);
/**
* 删除区域
*
* @param id 区域主键
* @return 结果
*/
int deleteSysAreaById(Long id);
/**
* 批量删除区域
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSysAreaByIds(Long[] ids);
/**
* 根据区域编码查询对应得市级区域信息
*
* @param areaCode 区域编码
* @return 市级区域集合
*/
List<AreaInfoVO> getCityInfoList(@Param("areaCode") String areaCode, @Param("remoteSigns") Integer remoteSigns);
/**
* 根据父id查询街道信息集合
*
* @param parentIdList 父id集合
* @return 街道集合
*/
List<AreaInfoVO> getStreetInfoList(@Param("parentIdList") List<Long> parentIdList);
/**
* 下级区域寻找上级区域
*
* @param areaCode 区域编码
* @return com.xinyilu.base.domain.vo.sysarea.SysAreaVO
**/
SysAreaVO getSubordinateRegionsFindSuperiorRegions(@Param("areaCode") String areaCode);
/**
* 区域编码的集合
*
* @param areaCodeList 区域编码的集合
* @return java.util.List<com.xinyilu.base.domain.vo.sysarea.SysAreaVO>
**/
List<SysAreaVO> getNurseStationAreaByList(@Param("areaCodeList") List<String> areaCodeList);
/**
* 区域编码的
*
* @param areaCode 区域编码的集合
* @return java.util.List<com.xinyilu.base.domain.vo.sysarea.SysAreaVO>
**/
SysAreaVO getNurseStationAreaByCode(@Param("areaCode") String areaCode);
/**
* 小程序商品修改用户地址地址区域编码的集合(街道)
*
* @param areaCodeList 区域编码的集合
* @return java.util.List<com.xinyilu.base.domain.vo.sysarea.SysAreaVO>
**/
List<SysAreaVO> getNurseStationGoodsAreaByList(@Param("areaCodeList") List<String> areaCodeList);
/**
* 查询本级区域信息及上级区域信息
*
* @param id 区域主键
* @return ParentAreaVO
*/
ParentAreaVO selectParentName(Long id);
}

View File

@ -0,0 +1,152 @@
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.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 org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 护理站信息Service接口
*
* @author ljh
* @date 2022-09-02
*/
public interface INurseStationService {
/**
* 查询护理站信息
*
* @param id 护理站信息主键
* @return 护理站信息
*/
NurseStationAndAreaVO selectNurseStationById(Long id);
/**
* 查询护理站信息列表
*
* @param nurseStation 护理站信息
* @return 护理站信息集合
*/
List<NurseStationVO> selectNurseStationList(NurseStationVO nurseStation);
/**
* 查询所有护理站列列表信息
*
* @param nurseStation 查询参数
* @return 护理站列表信息
*/
List<NurseStationByUserVO> selectNurseStationListByUser(NurseStation nurseStation);
/**
* 查询用户绑定的护理站列表信息
*
* @param nurseStationIdList 护理站id集合
* @param nurseStation 查询条件信息
* @return 护理站列表信息
*/
List<NurseStationByUserVO> selectNurseStationListByIds(List<String> nurseStationIdList, NurseStation nurseStation);
/**
* 新增护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
AjaxResult insertNurseStation(NurseStationDTO nurseStation);
/**
* 修改护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
AjaxResult updateNurseStation(NurseStationDTO nurseStation);
/**
* 批量删除护理站信息
*
* @param ids 需要删除的护理站信息主键集合
* @return 结果
*/
AjaxResult deleteNurseStationByIds(Long[] ids);
/**
* 删除护理站信息信息
*
* @param id 护理站信息主键
* @return 结果
*/
int deleteNurseStationById(Long id);
/**
* 根据护理项目编号查询护理站信息
*
* @param nurseItemCode 护理项目编号
* @return com.xinyilu.base.domain.nursestationitem.NurseStationItem
**/
NurseStationItem getNurseItemCode(String nurseItemCode);
/**
* 根据护理站编号查询所有信息
*
* @param nurseStationCode 护理站编号
* @return com.xinyilu.base.domain.nursestation.NurseStation
**/
NurseStation getNurseStationCode(String nurseStationCode);
/**
* 头像图片接口
*
* @param multipartFile 文件
* @return com.xinyilu.common.core.domain.AjaxResult
**/
AjaxResult updateNurseStationHeads(MultipartFile multipartFile, String type) throws Exception;
/**
* 护理站信息导入
*
* @param nurseStation 护理站信息
* @return int
**/
AjaxResult insertNurseStationImportList(List<NurseStationImportDTO> nurseStation);
/**
* 获取字典中的护理类型编码
*
* @param nurseStation 护理站字典信息
* @return com.xinyilu.base.vo.nursestation.NurseStationVO
**/
List<NurseStationVO> getSysDictNurseTypeCode(NurseStationVO nurseStation);
/**
* 根据护理站类型编码查询护理站类型名称
*
* @param nurseTypeCode 护理站类型编码
* @return java.util.List<com.xinyilu.base.domain.nursetype.NurseType>
**/
AjaxResult getNurseStationType(String nurseTypeCode);
/**
* 根据用户id查询护理站
*
* @param sysUser 用户信息
* @return java.util.List<com.xinyilu.base.domain.nursestation.NurseStation>
**/
AjaxResult getNurseStationByUserId(NurseStationSysUserVO sysUser);
/**
* 根据护理站id查询护理站信息是否存在
*
* @param idList 护理站信息主键
* @return 护理站信息
*/
int getNurseStationById(List<Long> idList);
}

View File

@ -0,0 +1,786 @@
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;
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.bean.BeanUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
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 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 org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 护理站信息Service业务层处理
*
* @author ljh
* @date 2022-09-02
*/
@Service
public class NurseStationServiceImpl implements INurseStationService {
@Resource
private RegexUtil regexUtil;
@Resource
private NurseStationMapper nurseStationMapper;
@Resource
private NurseStationLabelMapper nurseStationLabelMapper;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
@Resource
private XinELuConfig xinELuConfig;
@Resource
private SysAreaMapper sysAreaMapper;
@Resource
private NurseStationClassifyRelationMapper stationClassifyRelationMapper;
@Resource
private AppletPageConfig appletPageConfig;
/**
* 护理站营业时间默认值
*/
private static final String OPEN_TIME = "00:00:00";
/**
* 获取小程序二维码接口失败标识
*/
private static final String FAIL = "FAIL";
/**
* 返回成功状态码
*/
private static final int SUCCESS_CODE = 0;
/**
* 查询护理站信息
*
* @param id 护理站信息主键
* @return 护理站信息
*/
@Override
public NurseStationAndAreaVO selectNurseStationById(Long id) {
// 根据护理站id查询护理站所属护理机构
NurseStationAndAreaVO nurseStation = nurseStationMapper.selectNurseStationById(id);
//筛选护理站所属护理机构列表
List<NurseClassifyInfo> nurseClassifyInfoList = nurseStation.getNurseClassifyInfoList().stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getClassifyType()) && item.getClassifyType().equals(NurseClassifyInfoEnum.NURSE_AGENCY.getInfo())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(nurseClassifyInfoList)) {
nurseStation.setNurseClassifyInfoList(nurseClassifyInfoList);
}
//用逗号分割护理机构名称为字符串
StringJoiner stringJoiner = new StringJoiner(",");
nurseClassifyInfoList.forEach(s -> stringJoiner.add(s.getClassifyName()));
String classifyNameList = stringJoiner.toString();
//回显护理站所属护理机构的字符串
nurseStation.setClassifyNameList(classifyNameList);
if (StringUtils.isNotBlank(nurseStation.getAreaCode())) {
SysAreaVO nurseStationAndAreaCode = sysAreaMapper.getSubordinateRegionsFindSuperiorRegions(nurseStation.getAreaCode());
nurseStation.setProvinceCode(StringUtils.isBlank(nurseStationAndAreaCode.getProvinceCode()) ? "" : nurseStationAndAreaCode.getProvinceCode());
nurseStation.setProvinceName(StringUtils.isBlank(nurseStationAndAreaCode.getProvinceName()) ? "" : nurseStationAndAreaCode.getProvinceName());
nurseStation.setCityCode(StringUtils.isBlank(nurseStationAndAreaCode.getCityCode()) ? "" : nurseStationAndAreaCode.getCityCode());
nurseStation.setCityName(StringUtils.isBlank(nurseStationAndAreaCode.getCityName()) ? "" : nurseStationAndAreaCode.getCityName());
nurseStation.setRegionCode(StringUtils.isBlank(nurseStationAndAreaCode.getRegionCode()) ? "" : nurseStationAndAreaCode.getRegionCode());
nurseStation.setRegionName(StringUtils.isBlank(nurseStationAndAreaCode.getRegionName()) ? "" : nurseStationAndAreaCode.getRegionName());
nurseStation.setStreetCode(StringUtils.isBlank(nurseStationAndAreaCode.getStreetCode()) ? "" : nurseStationAndAreaCode.getStreetCode());
nurseStation.setStreetName(StringUtils.isBlank(nurseStationAndAreaCode.getStreetName()) ? "" : nurseStationAndAreaCode.getStreetName());
}
return nurseStation;
}
/**
* 查询护理站信息列表
*
* @param nurseStation 护理站信息
* @return 护理站信息
*/
@Override
public List<NurseStationVO> selectNurseStationList(NurseStationVO nurseStation) {
// 查询护理站的信息
List<NurseStationVO> nurseStationList = nurseStationMapper.selectNurseStationList(nurseStation);
//获取所有的护理站的区域编码
List<String> areaCodeList = nurseStationList
.stream().filter(Objects::nonNull)
.map(NurseStationVO::getAreaCode)
.filter(StringUtils::isNotBlank).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(areaCodeList)) {
return nurseStationList;
}
// 获取本护理站的区域信息
List<SysAreaVO> nurseStationAreaByList = sysAreaMapper.getNurseStationAreaByList(areaCodeList);
if (CollectionUtils.isEmpty(nurseStationAreaByList)) {
return nurseStationList;
}
Map<String, SysAreaVO> collect = nurseStationAreaByList.stream().filter(item -> Objects.nonNull(item.getStreetCode())).collect(Collectors.toMap(SysAreaVO::getStreetCode, item -> item));
nurseStationList.forEach(item -> {
SysAreaVO orDefault = collect.getOrDefault(item.getAreaCode(), new SysAreaVO());
item.setAreaName(orDefault.getProvinceName() + "-" + orDefault.getCityName() + "-" + orDefault.getRegionName() + "-" + orDefault.getStreetName());
});
return nurseStationList;
}
/**
* 查询所有护理站列列表信息
*
* @param nurseStation 查询参数
* @return 护理站列表信息
*/
@Override
public List<NurseStationByUserVO> selectNurseStationListByUser(NurseStation nurseStation) {
return nurseStationMapper.selectNurseStationListByUser(nurseStation);
}
/**
* 查询用户绑定的护理站列表信息
*
* @param nurseStationIdList 护理站id集合
* @param nurseStation 查询参数
* @return 护理站列表信息
*/
@Override
public List<NurseStationByUserVO> selectNurseStationListByIds(List<String> nurseStationIdList, NurseStation nurseStation) {
//护理站名称
String nurseStationName = StringUtils.isBlank(nurseStation.getNurseStationName()) ? "" : nurseStation.getNurseStationName();
//护理站编码
String nurseStationCode = StringUtils.isBlank(nurseStation.getNurseStationCode()) ? "" : nurseStation.getNurseStationCode();
return nurseStationMapper.selectNurseStationListByIds(nurseStationIdList, nurseStationCode, nurseStationName);
}
/**
* 新增护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertNurseStation(NurseStationDTO nurseStation) {
//校验电话
AjaxResult checkPhone = checkPhone(nurseStation);
if (Objects.nonNull(checkPhone)) {
return checkPhone;
}
//校验营业时间
AjaxResult checkOpenTime = checkOpenTime(nurseStation);
if (Objects.nonNull(checkOpenTime)) {
return checkOpenTime;
}
// 查询判断护理站名称是否重复
int nurseStationName = nurseStationMapper.getNurseStationName(nurseStation.getAreaCode(), nurseStation.getNurseStationName());
if (nurseStationName > 0) {
throw new ServiceException("此区域已有相同的护理站名称:" + nurseStation.getNurseStationName() + ",请重新输入!");
}
// 设置创建人与创建时间
nurseStation.setUserId(SecurityUtils.getUserId());
nurseStation.setCreateBy(SecurityUtils.getUsername());
nurseStation.setCreateTime(LocalDateTime.now());
//设置营业时间
this.setBusinessHours(nurseStation);
//护理站编码 生成有效唯一的编码
nurseStation.setNurseStationCode(Constants.PATIENT_PREFIX + generateSystemCodeUtil.generateSystemCode(Constants.PATIENT_PREFIX));
// 新增护理站信息
int insertNurseStation = nurseStationMapper.insertNurseStation(nurseStation);
if (insertNurseStation <= 0) {
throw new ServiceException("新增护理站信息失败,请联系管理员!");
}
if (Objects.isNull(nurseStation.getId())) {
throw new ServiceException("新增护理站信息失败,请联系管理员!");
}
// 新增护理站标签信息
if (CollectionUtils.isEmpty(nurseStation.getNurseStationLabelList())) {
return AjaxResult.success();
}
this.insertNurseStationLabelLists(nurseStation.getNurseStationLabelList(), nurseStation.getId());
//新增护理机构分类关系表
if (nurseStation.getNurseStationClassifyIds().length == 0 || nurseStation.getNurseStationClassifyIds() == null) {
return AjaxResult.success();
}
this.insertNurseStationClassifyRelation(nurseStation.getNurseStationClassifyIds(), nurseStation.getId());
return AjaxResult.success();
}
/**
* 修改护理站信息
*
* @param nurseStation 护理站信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updateNurseStation(NurseStationDTO nurseStation) {
//校验电话
AjaxResult checkPhone = checkPhone(nurseStation);
if (Objects.nonNull(checkPhone)) {
return checkPhone;
}
//校验营业时间
AjaxResult checkOpenTime = checkOpenTime(nurseStation);
if (Objects.nonNull(checkOpenTime)) {
return checkOpenTime;
}
// 根据修改护理站的id查询所有信息
NurseStationAndAreaVO station = nurseStationMapper.selectNurseStationById(nurseStation.getId());
if (Objects.isNull(station)) {
return AjaxResult.error("当前护理站信息不存在,无法修改,请联系管理员!");
}
boolean nurseName = (StringUtils.isNotBlank(station.getAreaCode()) && !nurseStation.getAreaCode().equals(station.getAreaCode()))
|| (StringUtils.isNotBlank(station.getNurseStationName()) && !nurseStation.getNurseStationName().equals(station.getNurseStationName()));
if (nurseName) {
int nurseStationName = nurseStationMapper.getNurseStationName(nurseStation.getAreaCode(), nurseStation.getNurseStationName());
if (nurseStationName > 0) {
throw new ServiceException("此区域已有相同的护理站名称:" + nurseStation.getNurseStationName() + ",请重新输入!");
}
}
// 设置修改人人与修改时间
nurseStation.setUpdateBy(SecurityUtils.getUsername());
nurseStation.setUpdateTime(LocalDateTime.now());
//设置营业时间
this.setBusinessHours(nurseStation);
// 修改护理站信息
int insertNurseStation = nurseStationMapper.updateNurseStation(nurseStation);
if (insertNurseStation <= 0) {
throw new ServiceException("修改护理站信息失败,请联系管理员!");
}
if (Objects.isNull(nurseStation.getId())) {
throw new ServiceException("修改护理站信息失败,请联系管理员!");
}
//全增全删护理站标签及护理机构分类
this.updateStationLabelAndClassifyRelation(nurseStation);
if (StringUtils.isNotBlank(nurseStation.getStationPictureUrl()) && StringUtils.isNotBlank(station.getStationPictureUrl()) && !nurseStation.getStationPictureUrl().equals(station.getStationPictureUrl())) {
//删除护理站图片地址
this.deletePictureUrl(station.getStationPictureUrl());
}
if (StringUtils.isNotBlank(nurseStation.getStationIntroducePictureUrl()) && StringUtils.isNotBlank(station.getStationIntroducePictureUrl()) && !nurseStation.getStationIntroducePictureUrl().equals(station.getStationIntroducePictureUrl())) {
//删除护理站简介图片地址
this.deletePictureUrl(station.getStationIntroducePictureUrl());
}
//删除护理站富文本图片
this.deleteNurseStationPictureUrl(nurseStation, station);
return AjaxResult.success();
}
/**
* 批量删除护理站信息
*
* @param ids 需要删除的护理站信息主键
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult deleteNurseStationByIds(Long[] ids) {
//根据护理站id查询
List<NurseStationSysUserVO> nurseStationIds = nurseStationMapper.getNurseStationIds(Arrays.asList(ids));
//获取护理站图片地址
List<String> stationPictureUrlList = nurseStationIds.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getStationPictureUrl())).map(NurseStationSysUserVO::getStationPictureUrl).distinct().collect(Collectors.toList());
//获取护理站简介图片地址
List<String> stationIntroducePictureUrlList = nurseStationIds.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getStationIntroducePcitureUrl())).map(NurseStationSysUserVO::getStationIntroducePcitureUrl).distinct().collect(Collectors.toList());
//获取护理站富文本的内容
List<String> nurseStationAgencyIntroduceList = nurseStationIds.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getAgencyIntroduce())).map(NurseStationSysUserVO::getAgencyIntroduce).distinct().collect(Collectors.toList());
// 删除护理站信息
int nurseStationByIds = nurseStationMapper.deleteNurseStationByIds(ids);
if (nurseStationByIds <= 0) {
throw new ServiceException("删除护理站信息失败!");
}
int stationLabelByIds = nurseStationMapper.selectNurseStationLabelByIds(ids);
if (stationLabelByIds > 0) {
int nurseStationLabelByIds = nurseStationMapper.deleteNurseStationLabelByIds(ids);
if (nurseStationLabelByIds <= 0) {
throw new ServiceException("删除护理站信息标签配置失败!");
}
}
//删除护理机构所属分类关系表 - 查询护理机构所属分类关系是否存在
int relationCount = stationClassifyRelationMapper.selectNurseStationClassifyRelationByStationIds(ids);
if (relationCount > 0) {
//删除关系表
int deleteRelationCount = stationClassifyRelationMapper.deleteStationClassifyRelationByStationIds(ids);
if (deleteRelationCount <= 0) {
throw new ServiceException("删除护理机构所属分类关系失败!");
}
}
//遍历删除护理站图片地址
stationPictureUrlList.forEach(this::deletePictureUrl);
//遍历删除护理站简介图片地址
stationIntroducePictureUrlList.forEach(this::deletePictureUrl);
//遍历删除护理站富文本图片地址
for (String nurseStationAgencyIntroduce : nurseStationAgencyIntroduceList) {
List<String> nurseStationImgSrc = FileUtils.getImgSrc(nurseStationAgencyIntroduce);
for (String pictureUrl : nurseStationImgSrc) {
if (StringUtils.isBlank(pictureUrl)) {
continue;
}
//修改路径
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
//删除商品富文本图片
deletePictureUrl(substring);
}
}
return AjaxResult.success();
}
/**
* 删除护理站信息信息
*
* @param id 护理站信息主键
* @return 结果
*/
@Override
public int deleteNurseStationById(Long id) {
return nurseStationMapper.deleteNurseStationById(id);
}
/**
* 根据护理项目编号查询护理站信息
*
* @param nurseItemCode 护理项目编号
* @return com.xinelu.applet.domain.nursestationitem.NurseStationItem
**/
@Override
public NurseStationItem getNurseItemCode(String nurseItemCode) {
return nurseStationMapper.getNurseItemCode(nurseItemCode);
}
/**
* 根据护理站编号查询所有信息
*
* @param nurseStationCode 护理站编号
* @return com.xinelu.applet.domain.nursestation.NurseStation
**/
@Override
public NurseStation getNurseStationCode(String nurseStationCode) {
return nurseStationMapper.getNurseStationCode(nurseStationCode);
}
/**
* 头像图片上传接口
*
* @param multipartFile 文件
* @return com.xinelu.common.core.domain.AjaxResult
**/
@Override
public AjaxResult updateNurseStationHeads(MultipartFile multipartFile, String type) throws Exception {
//获取不同的文件路径
String uploadPathUrl = "";
switch (type) {
//护理站图片路径上传
case Constants.NURSE_STATION_TYPE:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getNurserStationPictureUrl();
break;
//护理站简介附近图片路径上传
case Constants.NURSE_STATION_INTRODUCE_TYPE:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getNurserStationIntroducePictureUrl();
break;
//护理站项目图片路径上传
case Constants.NURSE_STATION_ITEM_TYPE:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getNurserStationItemPictureUrl();
break;
//商品图片路径上传
case Constants.GOODS_PICTURE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getGoodsPictureUrl();
break;
//用户头像上传
case Constants.HEAD_PICTURE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getHeadPictureUrl();
break;
//商品属性图片地址
case Constants.ATTRIBUTE_PICTURE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getAttributePitureUrl();
break;
//商品分类图片地址
case Constants.GOODS_CATEGORY_PICTURE:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getGoodsCategoryPicture();
break;
//护理项目分类图标存放地址
case Constants.NURSE_ITEM_CLASSIFY_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getNurseItemClassifyUrl();
break;
//护理机构分类图片识别标识
case Constants.NURSE_STATION_CLASSIFY_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getNurseStationClassifyUrl();
break;
//海报图片存放路径地址
case Constants.POSTER_PICTURE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPosterPictureUrl();
break;
//资讯主缩略图地址
case Constants.LEAD_THUMBNAIL_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getLeadThumbnailUrl();
break;
//客服图片地址
case Constants.GROUP_QR_CODE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getGroupQrCodeUrl();
break;
//科室人员证书图片存放路径
case Constants.CERTIFICATE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getCertificateUrl();
break;
//健康咨询科室人员头像地址
case Constants.PERSON_PICTURE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPersonPictureUrl();
break;
//护理人员证书地址
case Constants.PERSON_CERTIFICATE_URL:
uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPersonCertificateUrl();
break;
default:
break;
}
if (StringUtils.isBlank(uploadPathUrl)) {
return AjaxResult.success();
}
//上传
String pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION);
if (StringUtils.isBlank(pictureName)) {
throw new ServiceException("图片上传失败,请联系管理员!");
}
AjaxResult ajax = AjaxResult.success("上传成功!");
ajax.put("imgUrl", pictureName);
return ajax;
}
/**
* 护理站信息导入
*
* @param nurseStation 护理站信息
* @return 导入结果
**/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertNurseStationImportList(List<NurseStationImportDTO> nurseStation) {
//判断添加的数据是否为空
if (CollectionUtils.isEmpty(nurseStation)) {
return AjaxResult.error("请添加护理站导入信息!");
}
//根据护理站名称做去除处理
List<NurseStationImportDTO> importDataList = nurseStation.stream().filter(item -> StringUtils.isNotBlank(item.getNurseStationName())).distinct().collect(Collectors.toList());
//校验联系电话格式是否正确
NurseStationImportDTO dto = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getPhone()))).findFirst().orElse(new NurseStationImportDTO());
if (StringUtils.isNotBlank(dto.getPhone())) {
return AjaxResult.error("当前护理站电话:" + dto.getPhone() + " 格式不正确,请重新录入!");
}
//校验负责人联系电话格式是否正确
NurseStationImportDTO dtoTwo = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getDutyPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getDutyPhone()))).findFirst().orElse(new NurseStationImportDTO());
if (StringUtils.isNotBlank(dtoTwo.getDutyPhone())) {
return AjaxResult.error("当前负责人电话:" + dtoTwo.getDutyPhone() + " 格式不正确,请重新录入!");
}
List<String> nurseStationNames = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getNurseStationName())).map(NurseStationImportDTO::getNurseStationName).distinct().collect(Collectors.toList());
//根据名称查询护理站基本信息
List<NurseStationImportDTO> allNurseStationInfo = nurseStationMapper.getAllNurseStationInfo(nurseStationNames);
//做差集去除数据库中已经存在的护理站信息
List<NurseStationImportDTO> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allNurseStationInfo));
if (CollectionUtils.isEmpty(subtractList)) {
return AjaxResult.success();
}
List<NurseStation> nurseStationList = new ArrayList<>();
for (NurseStationImportDTO item : subtractList) {
item.setUserId(SecurityUtils.getUserId());
item.setCreateTime(LocalDateTime.now());
item.setNurseStationCode(Constants.PATIENT_PREFIX + generateSystemCodeUtil.generateSystemCode(Constants.PATIENT_PREFIX));
NurseStation nurseStations = new NurseStation();
BeanUtils.copyProperties(item, nurseStations);
nurseStationList.add(nurseStations);
}
int insertCount = nurseStationMapper.insertNurseStationImportList(nurseStationList);
if (insertCount <= 0) {
throw new ServiceException("导入护理站信息失败,请联系管理员!");
}
return AjaxResult.success();
}
/**
* 获取字典中的护理类型编码
*
* @param nurseStation 护理站字典信息
* @return com.xinelu.applet.vo.nursestation.NurseStationVO
**/
@Override
public List<NurseStationVO> getSysDictNurseTypeCode(NurseStationVO nurseStation) {
return nurseStationMapper.getSysDictNurseTypeCode(nurseStation);
}
/**
* 根据护理站类型编码查询护理站类型名称
*
* @param nurseTypeCode 护理站类型编码
* @return java.util.List<com.xinelu.applet.domain.nursetype.NurseType>
**/
@Override
public AjaxResult getNurseStationType(String nurseTypeCode) {
// 得到的编码如果是多个进行分割
List<String> nurseTypeCodeList = Arrays.asList(StringUtils.split(nurseTypeCode, ","));
// 去重 查询值
List<NurseType> nurseStationType = nurseStationMapper.getNurseStationType(nurseTypeCodeList).stream().distinct().collect(Collectors.toList());
return AjaxResult.success(nurseStationType);
}
/**
* 根据用户id查询护理站
*
* @param sysUser 用户信息
* @return java.util.List<com.xinelu.applet.domain.nursestation.NurseStation>
**/
@Override
public AjaxResult getNurseStationByUserId(NurseStationSysUserVO sysUser) {
sysUser.setUserId(SecurityUtils.getUserId());
NurseStationSysUserVO nurseStationByUserId = nurseStationMapper.getNurseStationByUserId(sysUser);
String nurseStationIds = nurseStationByUserId.getNurseStationIds();
List<String> nurseTypeCodeList = Arrays.asList(StringUtils.split(nurseStationIds, ","));
//List<String> List<Long>
List<Long> cdids = nurseTypeCodeList.stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
List<NurseStationSysUserVO> stationIds = nurseStationMapper.getNurseStationIds(cdids).stream().distinct().collect(Collectors.toList());
return AjaxResult.success(stationIds);
}
/**
* 根据护理站id查询护理站信息是否存在
*
* @param idList 护理站信息主键
* @return 护理站信息
*/
@Override
public int getNurseStationById(List<Long> idList) {
return nurseStationMapper.getNurseStationCount(idList);
}
/**
* 新增护理站标签信息
*
* @param nurseStationLabels 护理站标签集合
* @param nurseStationId 护理站id
**/
private void insertNurseStationLabelLists(List<NurseStationLabelVO> nurseStationLabels, Long nurseStationId) {
// 判断护理站标签信息是否为空
for (NurseStationLabelVO nurseStationLabel : nurseStationLabels) {
//判断项目成绩级别是否为空
nurseStationLabel.setNurseStationId(nurseStationId);
nurseStationLabel.setCreateBy(SecurityUtils.getUsername());
nurseStationLabel.setCreateTime(LocalDateTime.now());
// 护理站标签编码 生成有效唯一的编码
nurseStationLabel.setLabelCode(Constants.LABEL_CODE + generateSystemCodeUtil.generateSystemCode(Constants.LABEL_CODE));
nurseStationLabel.setUserId(SecurityUtils.getUserId());
}
// 新增护理站标签信息
int nurseStationLabel = nurseStationLabelMapper.insertBatchNurseStationLabel(nurseStationLabels);
if (nurseStationLabel <= 0) {
throw new ServiceException("新增护理站标签信息失败,请联系管理员!");
}
}
/**
* 删除护理站富文本图片
*
* @param nurseStation 前端传的
* @param station 数据库查的
* @return void
**/
public void deleteNurseStationPictureUrl(NurseStationDTO nurseStation, NurseStationAndAreaVO station) {
if (StringUtils.isNotBlank(nurseStation.getAgencyIntroduce()) && StringUtils.isNotBlank(station.getAgencyIntroduce())
&& !nurseStation.getAgencyIntroduce().equals(station.getAgencyIntroduce())) {
//数据库中的
List<String> stationImgSrc = FileUtils.getImgSrc(station.getAgencyIntroduce());
//前端传的
List<String> nurseStationImgSrc = FileUtils.getImgSrc(nurseStation.getAgencyIntroduce());
//差集不同的
List<String> subtractNurseStationImgSrc = new ArrayList<>(CollectionUtils.subtract(stationImgSrc, nurseStationImgSrc));
for (String pictureUrl : subtractNurseStationImgSrc) {
if (StringUtils.isBlank(pictureUrl)) {
continue;
}
//修改路径
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
//删除商品富文本图片
deletePictureUrl(substring);
}
}
}
/**
* 删除护理站图片地址
*
* @param pictureUrl 护理站图片地址
* @return void 护理站图片地址
**/
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 nurseStationClassifyIds 护理机构ids
* @param stationId 护理站id
*/
private void insertNurseStationClassifyRelation(Long[] nurseStationClassifyIds, Long stationId) {
List<NurseStationClassifyRelation> nurseStationClassifyRelations = new ArrayList<>();
//遍历塞值
for (Long nurseStationClassifyId : nurseStationClassifyIds) {
NurseStationClassifyRelation stationClassifyRelation = new NurseStationClassifyRelation();
stationClassifyRelation.setNurseStationId(stationId);
stationClassifyRelation.setNurseClassifyId(nurseStationClassifyId);
stationClassifyRelation.setCreateBy(SecurityUtils.getUsername());
stationClassifyRelation.setCreateTime(LocalDateTime.now());
nurseStationClassifyRelations.add(stationClassifyRelation);
}
//新增护理机构分类关系表
int insertCount = stationClassifyRelationMapper.insertNurseStationClassifyRelationList(nurseStationClassifyRelations);
if (insertCount <= 0) {
throw new ServiceException("护理机构类型新增失败,请联系管理员!");
}
}
/**
* 全增全删护理站标签及护理机构分类
*
* @param nurseStation 护理站修改信息
*/
private void updateStationLabelAndClassifyRelation(NurseStationDTO nurseStation) {
//删除护理站标签信息
int nurseStationLabelStationId = nurseStationLabelMapper.getNurseStationLabelStationId(nurseStation.getId());
if (nurseStationLabelStationId > 0) {
int deleteNurseStationLabelStationId = nurseStationLabelMapper.deleteNurseStationLabelStationId(nurseStation.getId());
if (deleteNurseStationLabelStationId <= 0) {
throw new ServiceException("删除护理站标签信息失败");
}
}
//修改护理站标签信息
if (CollectionUtils.isNotEmpty(nurseStation.getNurseStationLabelList())) {
this.insertNurseStationLabelLists(nurseStation.getNurseStationLabelList(), nurseStation.getId());
}
//删除护理机构所属分类关系表
int count = stationClassifyRelationMapper.selectNurseStationClassifyRelationByStationId(nurseStation.getId());
if (count > 0) {
int deleteCount = stationClassifyRelationMapper.deleteStationClassifyRelationByStationId(nurseStation.getId());
if (deleteCount <= 0) {
throw new ServiceException("删除护理机构所属分类关系失败");
}
}
//重新增加护理机构所属分类关系表
if (nurseStation.getNurseStationClassifyIds() != null && nurseStation.getNurseStationClassifyIds().length != 0) {
this.insertNurseStationClassifyRelation(nurseStation.getNurseStationClassifyIds(), nurseStation.getId());
}
}
/**
* 校验护理站营业时间
*
* @param nurseStation 输入参数
* @return 校验结果
*/
private AjaxResult checkOpenTime(NurseStationDTO nurseStation) {
if (StringUtils.isBlank(nurseStation.getMorningOpenStartTimeStr())
|| StringUtils.isBlank(nurseStation.getMorningOpenEndTimeStr())
|| OPEN_TIME.equals(nurseStation.getMorningOpenStartTimeStr())
|| OPEN_TIME.equals(nurseStation.getMorningOpenEndTimeStr())) {
return AjaxResult.error("上午营业时间不能为空!");
}
if (StringUtils.isBlank(nurseStation.getAfternoonOpenStartTimeStr())
|| StringUtils.isBlank(nurseStation.getAfternoonOpenEndTimeStr())
|| OPEN_TIME.equals(nurseStation.getAfternoonOpenStartTimeStr())
|| OPEN_TIME.equals(nurseStation.getAfternoonOpenEndTimeStr())) {
return AjaxResult.error("下午营业时间不能为空!");
}
//格式化日期
LocalTime morningStartTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getMorningOpenStartTimeStr())));
LocalTime morningEndTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getMorningOpenEndTimeStr())));
LocalTime afterStartTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getAfternoonOpenStartTimeStr())));
LocalTime afterEndTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getAfternoonOpenEndTimeStr())));
if (morningStartTime.isAfter(morningEndTime) || morningStartTime.equals(morningEndTime)) {
return AjaxResult.error("上午营业开始时间不能大于等于上午营业结束时间!");
}
if (afterStartTime.isAfter(afterEndTime) || afterStartTime.equals(afterEndTime)) {
return AjaxResult.error("下午营业开始时间不能大于等于下午营业结束时间!");
}
if (morningEndTime.isAfter(afterStartTime)) {
return AjaxResult.error("上午营业结束时间不能大于下午营业开始时间!");
}
return null;
}
/**
* 校点电话
*
* @param nurseStation 输入参数
* @return 结果
*/
private AjaxResult checkPhone(NurseStationDTO nurseStation) {
if (StringUtils.isNotBlank(nurseStation.getPhone())) {
// 校验手机号是否正确
boolean phone = regexUtil.regexSeatNumber(nurseStation.getPhone());
if (BooleanUtils.isFalse(phone)) {
return AjaxResult.error("您输入的联系电话" + nurseStation.getPhone() + "不正确,请重新输入!");
}
}
if (StringUtils.isNotBlank(nurseStation.getDutyPhone())) {
// 校验负责人手机号是否正确
boolean dutyPhone = regexUtil.regexSeatNumber(nurseStation.getDutyPhone());
if (BooleanUtils.isFalse(dutyPhone)) {
return AjaxResult.error("您输入的联系电话" + nurseStation.getDutyPhone() + "不正确,请重新输入!");
}
}
return null;
}
/**
* 设置营业时间
*
* @param nurseStation 护理站信息
*/
private void setBusinessHours(NurseStationDTO nurseStation) {
//格式化日期
LocalTime morningStartTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getMorningOpenStartTimeStr())));
LocalTime morningEndTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getMorningOpenEndTimeStr())));
LocalTime afterStartTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getAfternoonOpenStartTimeStr())));
LocalTime afterEndTime = LocalTime.parse(DateTimeFormatter.ofPattern("HH:mm").format(LocalTime.parse(nurseStation.getAfternoonOpenEndTimeStr())));
//塞值
nurseStation.setMorningOpenStartTime(morningStartTime);
nurseStation.setMorningOpenEndTime(morningEndTime);
nurseStation.setAfternoonOpenStartTime(afterStartTime);
nurseStation.setAfternoonOpenEndTime(afterEndTime);
}
}

View File

@ -0,0 +1,821 @@
<?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.applet.mapper.nursestation.NurseStationMapper">
<resultMap type="NurseStation" id="NurseStationResult">
<result property="id" column="id"/>
<result property="areaCode" column="area_code"/>
<result property="userId" column="user_id"/>
<result property="nurseStationCode" column="nurse_station_code"/>
<result property="nurseStationName" column="nurse_station_name"/>
<result property="nurseStationType" column="nurse_station_type"/>
<result property="agencyIntroduce" column="agency_introduce"/>
<result property="nurseStationDescription" column="nurse_station_description"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="phone" column="phone"/>
<result property="address" column="address"/>
<result property="dutyPerson" column="duty_person"/>
<result property="dutyPhone" column="duty_phone"/>
<result property="stationPictureUrl" column="station_picture_url"/>
<result property="stationIntroducePictureUrl" column="station_introduce_picture_url"/>
<result property="sort" column="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"/>
<result property="nurseGrade" column="nurse_grade"/>
<result property="openingHoursDescribe" column="opening_hours_describe"/>
<result property="morningOpenStartTime" column="morning_open_start_time"/>
<result property="morningOpenEndTime" column="morning_open_end_time"/>
<result property="afternoonOpenStartTime" column="afternoon_open_start_time"/>
<result property="afternoonOpenEndTime" column="afternoon_open_end_time"/>
<result property="stationWechatCodeUrl" column="station_wechat_code_url"/>
</resultMap>
<resultMap type="com.xinelu.manage.domain.vo.nursestation.NurseStationAndAreaVO" id="NurseStationResultInFo">
<result property="id" column="id"/>
<result property="areaCode" column="area_code"/>
<result property="userId" column="user_id"/>
<result property="nurseStationCode" column="nurse_station_code"/>
<result property="nurseStationName" column="nurse_station_name"/>
<result property="nurseStationType" column="nurse_station_type"/>
<result property="agencyIntroduce" column="agency_introduce"/>
<result property="nurseStationDescription" column="nurse_station_description"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="phone" column="phone"/>
<result property="address" column="address"/>
<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="sort" column="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"/>
<result property="nurseGrade" column="nurse_grade"/>
<result property="openingHoursDescribe" column="opening_hours_describe"/>
<result property="morningOpenStartTime" column="morning_open_start_time"/>
<result property="morningOpenEndTime" column="morning_open_end_time"/>
<result property="afternoonOpenStartTime" column="afternoon_open_start_time"/>
<result property="afternoonOpenEndTime" column="afternoon_open_end_time"/>
<collection property="nurseStationLabel" javaType="java.util.List" resultMap="NurseStationLabelInfo"/>
<collection property="nurseClassifyInfoList" javaType="java.util.List" resultMap="NurseClassifyInfoResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.domain.vo.nursestation.NurseStationLabelVO" id="NurseStationLabelInfo">
<result property="id" column="id"/>
<result property="nurseStationId" column="nurse_station_id"/>
<result property="userId" column="user_id"/>
<result property="labelCode" column="label_code"/>
<result property="labelDescription" column="label_description"/>
<result property="labelSort" column="labelSort"/>
<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>
<resultMap type="NurseClassifyInfo" id="NurseClassifyInfoResult">
<result property="id" column="nurseClassifyId"/>
<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"/>
</resultMap>
<sql id="selectNurseStationVo">
select id,
area_code,
user_id,
nurse_station_code,
nurse_station_name,
nurse_station_type,
agency_introduce,
nurse_station_description,
longitude,
latitude,
phone,
address,
duty_person,
duty_phone,
station_picture_url,
station_introduce_pciture_url,
sort,
create_by,
create_time,
update_by,
update_time,
nurse_grade,
opening_hours_describe,
morning_open_start_time,
morning_open_end_time,
afternoon_open_start_time,
afternoon_open_end_time,
station_wechat_code_url
from nurse_station
</sql>
<select id="selectNurseStationList" parameterType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="areaCode != null ">
and area_code = #{areaCode}
</if>
<if test="id != null ">
and id = #{id}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="nurseStationCode != null and nurseStationCode != ''">
and nurse_station_code like concat('%', #{nurseStationCode}, '%')
</if>
<if test="nurseStationName != null and nurseStationName != ''">
and nurse_station_name like concat('%', #{nurseStationName}, '%')
</if>
<if test="nurseStationType != null and nurseStationType != ''">
and find_in_set(#{nurseStationType},nurse_station_type)
</if>
<if test="agencyIntroduce != null and agencyIntroduce != ''">
and agency_introduce = #{agencyIntroduce}
</if>
<if test="nurseStationDescription != null and nurseStationDescription != ''">
and nurse_station_description = #{nurseStationDescription}
</if>
<if test="longitude != null and longitude != ''">
and longitude = #{longitude}
</if>
<if test="latitude != null and latitude != ''">
and latitude = #{latitude}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="address != null and address != ''">
and address = #{address}
</if>
<if test="dutyPerson != null and dutyPerson != ''">
and duty_person = #{dutyPerson}
</if>
<if test="dutyPhone != null and dutyPhone != ''">
and duty_phone = #{dutyPhone}
</if>
<if test="stationPictureUrl != null and stationPictureUrl != ''">
and station_picture_url = #{stationPictureUrl}
</if>
<if test="stationIntroducePcitureUrl != null and stationIntroducePcitureUrl != ''">
and station_introduce_pciture_url = #{stationIntroducePcitureUrl}
</if>
<if test="sort != null ">
and sort = #{sort}
</if>
<if test="nurseGrade != null ">
and nurse_grade = #{nurseGrade}
</if>
<if test="openingHoursDescribe != null and openingHoursDescribe != ''">
and opening_hours_describe = #{openingHoursDescribe}
</if>
<if test="morningOpenStartTime != null ">
and morning_open_start_time = #{morningOpenStartTime}
</if>
<if test="morningOpenEndTime != null ">
and morning_open_end_time = #{morningOpenEndTime}
</if>
<if test="afternoonOpenStartTime != null ">
and afternoon_open_start_time = #{afternoonOpenStartTime}
</if>
<if test="afternoonOpenEndTime != null ">
and afternoon_open_end_time = #{afternoonOpenEndTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectNurseStationListByUser" parameterType="NurseStation"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="areaCode != null ">
and area_code = #{areaCode}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="nurseStationCode != null and nurseStationCode != ''">
and nurse_station_code = #{nurseStationCode}
</if>
<if test="nurseStationName != null and nurseStationName != ''">
and nurse_station_name like concat('%', #{nurseStationName}, '%')
</if>
<if test="nurseStationType != null and nurseStationType != ''">
and nurse_station_type = #{nurseStationType}
</if>
<if test="agencyIntroduce != null and agencyIntroduce != ''">
and agency_introduce = #{agencyIntroduce}
</if>
<if test="nurseStationDescription != null and nurseStationDescription != ''">
and nurse_station_description = #{nurseStationDescription}
</if>
<if test="longitude != null and longitude != ''">
and longitude = #{longitude}
</if>
<if test="latitude != null and latitude != ''">
and latitude = #{latitude}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="address != null and address != ''">
and address = #{address}
</if>
<if test="dutyPerson != null and dutyPerson != ''">
and duty_person = #{dutyPerson}
</if>
<if test="dutyPhone != null and dutyPhone != ''">
and duty_phone = #{dutyPhone}
</if>
<if test="stationPictureUrl != null and stationPictureUrl != ''">
and station_picture_url = #{stationPictureUrl}
</if>
<if test="sort != null ">
and sort = #{sort}
</if>
</where>
</select>
<select id="selectNurseStationById" parameterType="Long"
resultMap="NurseStationResultInFo">
SELECT ns.id,
ns.area_code,
ns.user_id,
ns.nurse_station_code,
ns.nurse_station_name,
ns.nurse_station_type,
ns.agency_introduce,
ns.nurse_station_description,
ns.longitude,
ns.latitude,
ns.phone,
ns.address,
ns.duty_person,
ns.duty_phone,
ns.station_picture_url,
ns.station_introduce_pciture_url,
ns.sort,
ns.create_by,
ns.create_time,
ns.update_by,
ns.update_time,
ns.nurse_grade,
ns.opening_hours_describe,
ns.morning_open_start_time,
ns.morning_open_end_time,
ns.afternoon_open_start_time,
ns.afternoon_open_end_time,
nsl.nurse_station_id,
nsl.user_id,
nsl.label_code,
nsl.label_description,
nsl.sort labelSort,
nsl.create_by,
nsl.create_time,
nsl.update_by,
nsl.update_time,
nci.id nurseClassifyId,
nci.classify_code,
nci.classify_name,
nci.classify_type
FROM nurse_station ns
LEFT JOIN nurse_station_label nsl ON nsl.nurse_station_id = ns.id
LEFT JOIN nurse_station_classify_relation nscr ON nscr.nurse_station_id = ns.id
LEFT JOIN nurse_classify_info nci ON nci.id = nscr.nurse_classify_id
where ns.id = #{id}
</select>
<insert id="insertNurseStation" parameterType="NurseStation" useGeneratedKeys="true"
keyProperty="id">
insert into nurse_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaCode != null">area_code,
</if>
<if test="userId != null">user_id,
</if>
<if test="nurseStationCode != null">nurse_station_code,
</if>
<if test="nurseStationName != null">nurse_station_name,
</if>
<if test="nurseStationType != null">nurse_station_type,
</if>
<if test="agencyIntroduce != null">agency_introduce,
</if>
<if test="nurseStationDescription != null">nurse_station_description,
</if>
<if test="longitude != null">longitude,
</if>
<if test="latitude != null">latitude,
</if>
<if test="phone != null">phone,
</if>
<if test="address != null">address,
</if>
<if test="dutyPerson != null">duty_person,
</if>
<if test="dutyPhone != null">duty_phone,
</if>
<if test="stationPictureUrl != null">station_picture_url,
</if>
<if test="stationIntroducePcitureUrl != null">station_introduce_pciture_url,
</if>
<if test="sort != null">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>
<if test="nurseGrade != null">nurse_grade,
</if>
<if test="openingHoursDescribe != null">opening_hours_describe,
</if>
<if test="morningOpenStartTime != null">morning_open_start_time,
</if>
<if test="morningOpenEndTime != null">morning_open_end_time,
</if>
<if test="afternoonOpenStartTime != null">afternoon_open_start_time,
</if>
<if test="afternoonOpenEndTime != null">afternoon_open_end_time,
</if>
<if test="stationWechatCodeUrl != null">station_wechat_code_url,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaCode != null">#{areaCode},
</if>
<if test="userId != null">#{userId},
</if>
<if test="nurseStationCode != null">#{nurseStationCode},
</if>
<if test="nurseStationName != null">#{nurseStationName},
</if>
<if test="nurseStationType != null">#{nurseStationType},
</if>
<if test="agencyIntroduce != null">#{agencyIntroduce},
</if>
<if test="nurseStationDescription != null">#{nurseStationDescription},
</if>
<if test="longitude != null">#{longitude},
</if>
<if test="latitude != null">#{latitude},
</if>
<if test="phone != null">#{phone},
</if>
<if test="address != null">#{address},
</if>
<if test="dutyPerson != null">#{dutyPerson},
</if>
<if test="dutyPhone != null">#{dutyPhone},
</if>
<if test="stationPictureUrl != null">#{stationPictureUrl},
</if>
<if test="stationIntroducePcitureUrl != null">#{stationIntroducePcitureUrl},
</if>
<if test="sort != null">#{sort},
</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="nurseGrade != null">#{nurseGrade},
</if>
<if test="openingHoursDescribe != null">#{openingHoursDescribe},
</if>
<if test="morningOpenStartTime != null">#{morningOpenStartTime},
</if>
<if test="morningOpenEndTime != null">#{morningOpenEndTime},
</if>
<if test="afternoonOpenStartTime != null">#{afternoonOpenStartTime},
</if>
<if test="afternoonOpenEndTime != null">#{afternoonOpenEndTime},
</if>
<if test="stationWechatCodeUrl != null">#{stationWechatCodeUrl},
</if>
</trim>
</insert>
<update id="updateNurseStation" parameterType="NurseStation">
update nurse_station
<trim prefix="SET" suffixOverrides=",">
<if test="areaCode != null">area_code =
#{areaCode},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="nurseStationCode != null">nurse_station_code =
#{nurseStationCode},
</if>
<if test="nurseStationName != null">nurse_station_name =
#{nurseStationName},
</if>
<if test="nurseStationType != null">nurse_station_type =
#{nurseStationType},
</if>
<if test="agencyIntroduce != null">agency_introduce =
#{agencyIntroduce},
</if>
<if test="nurseStationDescription != null">nurse_station_description =
#{nurseStationDescription},
</if>
<if test="longitude != null">longitude =
#{longitude},
</if>
<if test="latitude != null">latitude =
#{latitude},
</if>
<if test="phone != null">phone =
#{phone},
</if>
<if test="address != null">address =
#{address},
</if>
<if test="dutyPerson != null">duty_person =
#{dutyPerson},
</if>
<if test="dutyPhone != null">duty_phone =
#{dutyPhone},
</if>
<if test="stationPictureUrl != null">station_picture_url =
#{stationPictureUrl},
</if>
<if test="stationIntroducePcitureUrl != null">station_introduce_pciture_url =
#{stationIntroducePcitureUrl},
</if>
<if test="sort != null">sort =
#{sort},
</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="nurseGrade != null">nurse_grade =
#{nurseGrade},
</if>
<if test="openingHoursDescribe != null">opening_hours_describe =
#{openingHoursDescribe},
</if>
<if test="morningOpenStartTime != null">morning_open_start_time =
#{morningOpenStartTime},
</if>
<if test="morningOpenEndTime != null">morning_open_end_time =
#{morningOpenEndTime},
</if>
<if test="afternoonOpenStartTime != null">afternoon_open_start_time =
#{afternoonOpenStartTime},
</if>
<if test="afternoonOpenEndTime != null">afternoon_open_end_time =
#{afternoonOpenEndTime},
</if>
<if test="stationWechatCodeUrl != null">station_wechat_code_url =
#{stationWechatCodeUrl},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNurseStationById" parameterType="Long">
delete
from nurse_station
where id = #{id}
</delete>
<delete id="deleteNurseStationByIds" parameterType="String">
delete from nurse_station where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteNurseStationLabelByIds" parameterType="String">
delete from nurse_station_label where nurse_station_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateNurseStationByHead" parameterType="NurseStation">
update nurse_station
set station_picture_url = #{stationPictureUrl}
where nurse_station_code = #{nurseStationCode}
</update>
<update id="updateNurseStationIntroduceByHead" parameterType="NurseStation">
update nurse_station
set station_introduce_pciture_url = #{stationIntroducePcitureUrl}
where nurse_station_code = #{nurseStationCode}
</update>
<select id="selectNurseStationListByNames" parameterType="String"
resultMap="NurseStationResult">
<include refid="selectNurseStationVo"/>
<where>
<if test="nurseStationIdList != null and nurseStationIdList.size() > 0">
and nurse_station_name in
<foreach item="nurseStationName" collection="nurseStationIdList" open="(" separator="," close=")">
#{nurseStationName}
</foreach>
</if>
</where>
</select>
<select id="selectNurseStationListByIds" resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationByUserVO">
<include refid="selectNurseStationVo"/>
<where>
<if test="nurseStationIdList != null and nurseStationIdList.size() > 0">
and id in
<foreach item="nurseStationId" collection="nurseStationIdList" open="(" separator="," close=")">
#{nurseStationId}
</foreach>
</if>
<if test="nurseStationCode != null and nurseStationCode != ''">
and nurse_station_code = #{nurseStationCode}
</if>
<if test="nurseStationName != null and nurseStationName != ''">
and nurse_station_name like concat('%', #{nurseStationName}, '%')
</if>
</where>
</select>
<select id="getNurseStationCode" parameterType="NurseStation" resultType="NurseStation">
select id,
area_code,
user_id,
nurse_station_code,
nurse_station_name,
nurse_station_type,
agency_introduce,
nurse_station_description,
longitude,
latitude,
phone,
address,
duty_person,
duty_phone,
station_picture_url,
station_introduce_pciture_url,
sort,
create_by,
create_time,
update_by,
update_time
from nurse_station
<where>
<if test="nurseStationCode != null and nurseStationCode != ''">
and nurse_station_code = #{nurseStationCode}
</if>
</where>
</select>
<insert id="insertNurseStationImportList" parameterType="java.util.List">
insert into nurse_station(
area_code,
user_id,
nurse_station_code,
nurse_station_name,
nurse_station_type,
agency_introduce,
nurse_station_description,
longitude,
latitude,
phone,
address,
duty_person,
duty_phone,
station_picture_url,
station_introduce_pciture_url,
sort,
create_by,
create_time,
update_by,
update_time
) values
<foreach item="NurseStation" index="index" collection="list" separator=",">
(
#{NurseStation.areaCode},
#{NurseStation.userId},
#{NurseStation.nurseStationCode},
#{NurseStation.nurseStationName},
#{NurseStation.nurseStationType},
#{NurseStation.agencyIntroduce},
#{NurseStation.nurseStationDescription},
#{NurseStation.longitude},
#{NurseStation.latitude},
#{NurseStation.phone},
#{NurseStation.address},
#{NurseStation.dutyPerson},
#{NurseStation.dutyPhone},
#{NurseStation.stationPictureUrl},
#{NurseStation.stationIntroducePcitureUrl},
#{NurseStation.sort},
#{NurseStation.createBy},
#{NurseStation.createTime},
#{NurseStation.updateBy},
#{NurseStation.updateTime}
)
</foreach>
</insert>
<select id="getNurseItemCode" parameterType="NurseStationItem" resultType="NurseStationItem">
select id,
nurse_station_id,
nurse_type_id,
user_id,
item_picture_url,
nurse_item_code,
nurse_item_name,
nurse_item_content,
advance_appoint_duration,
sort,
create_by,
create_time,
update_by,
update_time
from nurse_station_item
<where>
<if test="nurseItemCode != null and nurseItemCode != ''">
and nurse_item_code = #{nurseItemCode}
</if>
</where>
</select>
<update id="updateNurseStationItemByHead" parameterType="NurseStationItem">
update nurse_station_item
set item_picture_url = #{itemPictureUrl}
where nurse_item_code = #{nurseItemCode}
</update>
<select id="getNurseStationName" resultType="int">
SELECT
COUNT( 1 )
FROM
nurse_station
<where>
<if test="areaCode != null ">
and area_code = #{areaCode}
</if>
<if test="nurseStationName != null and nurseStationName != ''">
and nurse_station_name = #{nurseStationName}
</if>
</where>
</select>
<select id="getSysDictNurseTypeCode" resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationVO">
SELECT sdt.dict_name,
sdd.dict_label nurseTypeName,
sdd.dict_value nurseTypeCode
FROM sys_dict_type sdt
LEFT JOIN sys_dict_data sdd ON sdd.dict_type = sdt.dict_type
WHERE sdt.dict_type = 'nurse_type_code'
</select>
<select id="selectNurseStationLabelByIds" resultType="int">
SELECT COUNT(1) from nurse_station_label where nurse_station_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="getNurseStationType" parameterType="NurseType"
resultType="NurseType">
SELECT
nt.nurse_type_name,
nt.nurse_type_code
FROM
nurse_type nt
<where>
<if test="nurseTypeCodeList != null and nurseTypeCodeList.size()>0 ">
and nt.nurse_type_code in
<foreach item="nurseTypeCode" collection="nurseTypeCodeList" open="(" separator="," close=")">
#{nurseTypeCode}
</foreach>
</if>
</where>
</select>
<select id="selectStationLabelByStationId" parameterType="Long"
resultType="NurseStationLabel">
select id,
nurse_station_id,
user_id,
label_code,
label_description,
sort,
create_by,
create_time,
update_by,
update_time
from nurse_station_label
where
<if test="nurseStationId != null ">
nurse_station_id = #{nurseStationId}
</if>
</select>
<select id="getNurseStationByUserId" parameterType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO"
resultType="com.xinelu.manage.domain.vo.nursestation.NurseStationSysUserVO">
SELECT
su.user_id,
su.nurse_station_ids
FROM
sys_user su
<where>
<if test="userId != null ">
and su.user_id = #{userId}
</if>
</where>
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
ns.id nurseStationId,
ns.nurse_station_name,
ns.agency_introduce,
ns.station_picture_url,
ns.station_introduce_pciture_url
FROM
nurse_station ns
<where>
<if test="nurseStationIdsList != null and nurseStationIdsList.size()>0 ">
and ns.id in
<foreach item="nurseStationIds" collection="nurseStationIdsList" open="(" separator="," close=")">
#{nurseStationIds}
</foreach>
</if>
</where>
order by ns.create_time desc
</select>
<select id="getAllNurseStationInfo" resultType="com.xinelu.manage.domain.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">
and nurse_station_name in
<foreach item="nurseStationName" collection="nurseStationNameList" open="(" separator="," close=")">
#{nurseStationName}
</foreach>
</if>
</where>
</select>
<select id="getNurseStationCount" resultType="int">
SELECT count( 1 ) nurseStationCount FROM nurse_station
<where>
<if test="idList != null and idList.size() > 0">
and id in
<foreach item="id" collection="idList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<select id="getNurseStationById" parameterType="long" resultType="nurseStation">
<include refid="selectNurseStationVo"/>
where id = #{stationId}
</select>
<update id="updateStationWeChatCodeUrl">
update nurse_station
set station_wechat_code_url = #{stationWeChatCodeUrl},
update_time = now()
where id = #{stationId}
</update>
</mapper>

View File

@ -0,0 +1,357 @@
<?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.applet.mapper.sysarea.SysAreaMapper">
<resultMap type="SysArea" id="SysAreaResult">
<result property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="areaCode" column="area_code"/>
<result property="areaName" column="area_name"/>
<result property="areaLevel" column="area_level"/>
<result property="parentCode" column="parent_code"/>
<result property="remoteSigns" column="remote_signs"/>
<result property="sort" column="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="selectSysAreaVo">
select id,
parent_id,
area_code,
area_name,
area_level,
parent_code,
remote_signs,
sort,
create_by,
create_time,
update_by,
update_time
from sys_area
</sql>
<select id="selectSysAreaList" parameterType="SysArea" resultMap="SysAreaResult">
<include refid="selectSysAreaVo"/>
<where>
<if test="parentId != null ">
and parent_id = #{parentId}
</if>
<if test="areaCode != null and areaCode != ''">
and area_code = #{areaCode}
</if>
<if test="areaName != null and areaName != ''">
and area_name like concat( #{areaName}, '%')
</if>
<if test="parentCode != null and parentCode != ''">
and parent_code = #{parentCode}
</if>
<if test="remoteSigns != null">
and remote_signs = #{remoteSigns}
</if>
<if test="areaLevel != null ">
and area_level = #{areaLevel}
</if>
<if test="sort != null ">
and sort = #{sort}
</if>
</where>
order by sort
</select>
<select id="selectSysAreaById" resultType="com.xinelu.manage.domain.sysarea.SysArea"
resultMap="SysAreaResult">
<include refid="selectSysAreaVo"/>
<where>
<if test="id != null ">
and id = #{id}
</if>
<if test="areaCode != null and areaCode != ''">
and area_code = #{areaCode}
</if>
</where>
</select>
<insert id="insertSysArea" parameterType="SysArea" useGeneratedKeys="true"
keyProperty="id">
insert into sys_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,
</if>
<if test="areaCode != null">area_code,
</if>
<if test="areaName != null">area_name,
</if>
<if test="areaLevel != null">area_level,
</if>
<if test="parentCode != null">parent_code,
</if>
<if test="remoteSigns != null">remote_signs,
</if>
<if test="sort != null">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="areaCode != null">#{areaCode},
</if>
<if test="areaName != null">#{areaName},
</if>
<if test="areaLevel != null">#{areaLevel},
</if>
<if test="parentCode != null">#{parentCode},
</if>
<if test="remoteSigns != null">#{remoteSigns},
</if>
<if test="sort != null">#{sort},
</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="updateSysArea" parameterType="SysArea">
update sys_area
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id =
#{parentId},
</if>
<if test="areaCode != null">area_code =
#{areaCode},
</if>
<if test="areaName != null">area_name =
#{areaName},
</if>
<if test="areaLevel != null">area_level =
#{areaLevel},
</if>
<if test="parentCode != null">parent_code =
#{parentCode},
</if>
<if test="remoteSigns != null">remote_signs =
#{remoteSigns},
</if>
<if test="sort != null">sort =
#{sort},
</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="deleteSysAreaById" parameterType="Long">
delete
from sys_area
where id = #{id}
</delete>
<delete id="deleteSysAreaByIds" parameterType="String">
delete from sys_area where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getCityInfoList"
resultType="com.xinelu.manage.domain.vo.sysarea.AreaInfoVO">
SELECT id,
parent_id,
area_code,
area_name,
area_level,
sort
FROM sys_area
WHERE parent_code = #{areaCode}
AND remote_signs &lt;&gt; #{remoteSigns}
</select>
<select id="getStreetInfoList"
resultType="com.xinelu.manage.domain.vo.sysarea.AreaInfoVO">
SELECT
id,
parent_id,
area_code,
area_name,
area_level,
sort
FROM
sys_area
<where>
<if test="parentIdList != null and parentIdList.size() > 0">
parent_id IN
<foreach item="parentId" collection="parentIdList" open="(" separator="," close=")">
#{parentId}
</foreach>
</if>
</where>
</select>
<select id="getSubordinateRegionsFindSuperiorRegions" parameterType="String"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
street.area_name street_name,
street.area_code street_code
FROM sys_area province,
sys_area city,
sys_area region,
sys_area street
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND street.parent_code = region.area_code
AND street.area_code = #{areaCode}
UNION ALL
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
'' street_name,
'' street_code
FROM sys_area province,
sys_area city,
sys_area region
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND region.area_code = #{areaCode} limit 1;
</select>
<select id="getNurseStationAreaByList" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
SELECT
province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
street.area_name street_name,
street.area_code street_code
FROM
sys_area province,
sys_area city,
sys_area region,
sys_area street
WHERE
city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND street.parent_code = region.area_code
<if test="areaCodeList != null and areaCodeList.size() > 0">
and street.area_code in
<foreach item="areaCode" collection="areaCodeList" open="(" separator="," close=")">
#{areaCode}
</foreach>
</if>
</select>
<select id="getNurseStationGoodsAreaByList" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
SELECT
province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
'' street_name,
'' street_code
FROM
sys_area province,
sys_area city,
sys_area region
WHERE
city.parent_code = province.area_code
AND region.parent_code = city.area_code
<if test="areaCodeList != null and areaCodeList.size() > 0">
and region.area_code in
<foreach item="areaCode" collection="areaCodeList" open="(" separator="," close=")">
#{areaCode}
</foreach>
</if>
</select>
<select id="getNurseStationAreaByCode" parameterType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO"
resultType="com.xinelu.manage.domain.vo.sysarea.SysAreaVO">
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
street.area_name street_name,
street.area_code street_code
FROM sys_area province,
sys_area city,
sys_area region,
sys_area street
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND street.parent_code = region.area_code
and street.area_code = #{areaCode}
UNION ALL
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
'' street_name,
'' street_code
FROM sys_area province,
sys_area city,
sys_area region
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND region.area_code = #{areaCode} limit 1;
</select>
<select id="selectParentName" resultType="com.xinelu.manage.domain.vo.sysarea.ParentAreaVO">
SELECT sa.id,
sa.parent_code,
(select area_name FROM sys_area where area_code = sa.parent_code) parentName,
sa.area_code,
sa.area_name,
sa.area_level,
sa.sort,
sa.remote_signs
FROM sys_area sa
WHERE sa.id = #{id}
</select>
</mapper>