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

This commit is contained in:
纪寒 2023-11-08 17:02:19 +08:00
commit 1cfd0684e8
14 changed files with 203 additions and 48 deletions

View File

@ -118,6 +118,11 @@ public class SysUser extends BaseEntity {
*/ */
private Long hospitalPersonId; private Long hospitalPersonId;
/**
* 医院主键
*/
private Long hospitalId;
/** /**
* 部门对象 * 部门对象
*/ */
@ -347,6 +352,14 @@ public class SysUser extends BaseEntity {
this.hospitalPersonId = hospitalPersonId; this.hospitalPersonId = hospitalPersonId;
} }
public Long getHospitalId() {
return hospitalId;
}
public void setHospitalId(Long hospitalId) {
this.hospitalId = hospitalId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -4,31 +4,37 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.config.AppletChatConfig; import com.xinelu.common.config.AppletChatConfig;
import com.xinelu.common.entity.AppletPhoneVO; import com.xinelu.common.entity.AppletPhoneVO;
import com.xinelu.common.enums.CouponReceiveTypeEnum;
import com.xinelu.common.enums.CouponUseStatusEnum;
import com.xinelu.common.exception.ServiceException; import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.http.HttpService; import com.xinelu.common.utils.http.HttpService;
import com.xinelu.common.utils.http.HttpUtils; import com.xinelu.common.utils.http.HttpUtils;
import com.xinelu.common.utils.http.SslUtils; import com.xinelu.common.utils.http.SslUtils;
import com.xinelu.common.utils.spring.SpringUtils;
import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.familydoctor.applet.mapper.ResidentPatientInfoMapper; import com.xinelu.familydoctor.applet.mapper.ResidentPatientInfoMapper;
import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody; import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody;
import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo; import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
import com.xinelu.familydoctor.applet.pojo.query.PatientInfoQuery;
import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDetailVo;
import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService; import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
import com.xinelu.familydoctor.applet.utils.AppletAccessTokenUtils; import com.xinelu.familydoctor.applet.utils.AppletAccessTokenUtils;
import com.xinelu.manage.domain.coupon.Coupon;
import com.xinelu.manage.domain.patientcouponreceive.PatientCouponReceive;
import com.xinelu.manage.domain.receiveAddressInfo.ReceiveAddressInfo; import com.xinelu.manage.domain.receiveAddressInfo.ReceiveAddressInfo;
import com.xinelu.manage.mapper.coupon.CouponMapper;
import com.xinelu.manage.mapper.patientcouponreceive.PatientCouponReceiveMapper;
import com.xinelu.manage.mapper.receiveAddressInfo.ReceiveAddressInfoMapper; import com.xinelu.manage.mapper.receiveAddressInfo.ReceiveAddressInfoMapper;
import com.xinelu.manage.vo.patientcouponreceive.PatientCouponReceiveInfoVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -55,6 +61,10 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
@Resource @Resource
private ReceiveAddressInfoMapper receiveAddressInfoMapper; private ReceiveAddressInfoMapper receiveAddressInfoMapper;
@Resource
private PatientCouponReceiveMapper patientCouponReceiveMapper;
@Resource
private CouponMapper couponMapper;
/** /**
* @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo * @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo
@ -260,6 +270,15 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
} }
this.insertReceiveAddress(patientInfo); this.insertReceiveAddress(patientInfo);
} }
PatientInfo patient = residentPatientInfoMapper.getLoginByOpenId(body.getOpenid());
//判断是否是第一次完善如果是则发放新人优惠券信息
PatientCouponReceive patientCouponReceive = new PatientCouponReceive();
patientCouponReceive.setReceiveSource(CouponReceiveTypeEnum.NEW_PEOPLE_WELFARE.getInfo());
patientCouponReceive.setPatientId(patient.getId());
int couponReceiveCount = patientCouponReceiveMapper.getCouponReceiveByReceiveSource(patient.getId(), CouponReceiveTypeEnum.NEW_PEOPLE_WELFARE.getInfo());
if (Objects.nonNull(patient.getLoginFlag()) && patient.getLoginFlag() ==1 && couponReceiveCount <= 0) {
issueCoupons(patient);
}
} }
/** 新增收货人地址信息 */ /** 新增收货人地址信息 */
@ -446,4 +465,50 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
HashMap.put("cityCode", cityCode); HashMap.put("cityCode", cityCode);
return HashMap; return HashMap;
} }
/**
* 发放优惠券方法胡
*
* @param patient 会员信息
*/
public void issueCoupons(PatientInfo patient ) {
PatientCouponReceiveInfoVO receiveInfoVO = new PatientCouponReceiveInfoVO();
//查询新人福利的优惠券列表信息
Coupon coupon = new Coupon();
Long patientId = patient.getId();
coupon.setReceiveType(CouponReceiveTypeEnum.NEW_PEOPLE_WELFARE.getInfo());
List<Coupon> couponList = couponMapper.selectCouponList(coupon);
if (CollectionUtils.isEmpty(couponList)) {
return ;
}
//组装优惠券信息
List<PatientCouponReceive> couponReceiveList = Lists.newArrayList();
for (Coupon couponInfo : couponList) {
if (Objects.isNull(couponInfo.getId())) {
continue;
}
PatientCouponReceive couponReceive = new PatientCouponReceive();
couponReceive.setPatientId(patientId);
couponReceive.setCouponId(couponInfo.getId());
couponReceive.setReceiveSource(CouponReceiveTypeEnum.NEW_PEOPLE_WELFARE.getInfo());
couponReceive.setUseStatus(CouponUseStatusEnum.NOT_USED.getInfo());
couponReceive.setExpirationStartTime(LocalDateTime.now());
couponReceive.setExpirationEndTime(LocalDate.now().plusDays(Objects.isNull(couponInfo.getCouponReductionDays()) ? 0 : couponInfo.getCouponReductionDays()).atTime(23, 59, 59));
couponReceive.setReceiveTime(LocalDateTime.now());
couponReceive.setCouponReductionDays(Objects.isNull(couponInfo.getCouponReductionDays()) ? 0 : couponInfo.getCouponReductionDays());
couponReceive.setCreateTime(LocalDateTime.now());
couponReceive.setCouponTitle(StringUtils.isBlank(couponInfo.getCouponTitle()) ? "" : couponInfo.getCouponTitle());
couponReceive.setCouponPrice(Objects.isNull(couponInfo.getCouponPrice()) ? BigDecimal.ZERO : couponInfo.getCouponPrice());
couponReceive.setCouponConsumePrice(Objects.isNull(couponInfo.getCouponConsumePrice()) ? BigDecimal.ZERO : couponInfo.getCouponConsumePrice());
couponReceive.setCouponDescription(StringUtils.isBlank(couponInfo.getCouponDescription()) ? "" : couponInfo.getCouponDescription());
couponReceiveList.add(couponReceive);
}
if (CollectionUtils.isNotEmpty(couponReceiveList)) {
int insertCount = patientCouponReceiveMapper.insertBatchPatientReceive(couponReceiveList);
if (insertCount <= 0) {
log.error("完善用户信息接口-新人送券执行失败,输入参数[{}]", couponReceiveList);
throw new ServiceException("完善用户信息失败,请联系管理员!");
}
}
}
} }

View File

@ -1,6 +1,7 @@
package com.xinelu.framework.aspectj; package com.xinelu.framework.aspectj;
import com.xinelu.common.annotation.DataScope; import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.core.domain.BaseEntity; import com.xinelu.common.core.domain.BaseEntity;
import com.xinelu.common.core.domain.entity.SysRole; import com.xinelu.common.core.domain.entity.SysRole;
import com.xinelu.common.core.domain.entity.SysUser; import com.xinelu.common.core.domain.entity.SysUser;
@ -86,20 +87,21 @@ public class DataScopeAspect {
break; break;
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) { } else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
sqlString.append(StringUtils.format( sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, " OR {}.hospital_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
role.getRoleId())); role.getRoleId()));
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { } else if (DATA_SCOPE_DEPT.equals(dataScope)) {
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); sqlString.append(StringUtils.format(" OR {}.hospital_id = {} ", deptAlias, user.getHospitalId()));
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
sqlString.append(StringUtils.format( //sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", // " OR {}.hospital_id IN ( SELECT hospital_id FROM hospital_info WHERE hospital_id = {} or find_in_set( {} , ancestors ) )",
deptAlias, user.getDeptId(), user.getDeptId())); // deptAlias, user.getHospitalId(), user.getHospitalId()));
sqlString.append(StringUtils.format(" OR {}.hospital_id = {} ", deptAlias, user.getHospitalId()));
} else if (DATA_SCOPE_SELF.equals(dataScope)) { } else if (DATA_SCOPE_SELF.equals(dataScope)) {
if (StringUtils.isNotBlank(userAlias)) { if (StringUtils.isNotBlank(userAlias)) {
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); sqlString.append(StringUtils.format(" OR {}.doctor_id = {} ", userAlias, user.getUserId()));
} else { } else {
// 数据权限为仅本人且没有userAlias别名不查询任何数据 // 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); sqlString.append(StringUtils.format(" OR {}.hospital_id = 0 ", deptAlias));
} }
} }
} }
@ -110,6 +112,10 @@ public class DataScopeAspect {
BaseEntity baseEntity = (BaseEntity) params; BaseEntity baseEntity = (BaseEntity) params;
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
} }
if (StringUtils.isNotNull(params) && params instanceof BaseDomain) {
BaseDomain baseDomain = (BaseDomain) params;
baseDomain.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
}
} }
} }

View File

@ -54,6 +54,12 @@ public class HospitalInfoController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:hospital:list')") @PreAuthorize("@ss.hasPermi('system:hospital:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HospitalInfo hospitalInfo) { public TableDataInfo list(HospitalInfo hospitalInfo) {
if (!getLoginUser().getUser().isAdmin()) {
HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId());
if (hospitalPersonInfo != null) {
hospitalInfo.setId(hospitalPersonInfo.getHospitalId());
}
}
startPage(); startPage();
List<HospitalInfo> list = hospitalInfoService.selectHospitalInfoList(hospitalInfo); List<HospitalInfo> list = hospitalInfoService.selectHospitalInfoList(hospitalInfo);
return getDataTable(list); return getDataTable(list);
@ -65,7 +71,6 @@ public class HospitalInfoController extends BaseController {
@ApiOperation("查询医院信息管理列表") @ApiOperation("查询医院信息管理列表")
@GetMapping("/getList") @GetMapping("/getList")
public AjaxResult getList(HospitalInfo hospitalInfo) { public AjaxResult getList(HospitalInfo hospitalInfo) {
// TODO 根据用户权限获取医院列表机构管理员只能看自己机构,超级管理员查看所有
if (!getLoginUser().getUser().isAdmin()) { if (!getLoginUser().getUser().isAdmin()) {
HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId()); HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId());
if (hospitalPersonInfo != null) { if (hospitalPersonInfo != null) {

View File

@ -15,13 +15,18 @@ import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import com.xinelu.manage.vo.hospitalpersoninfo.HospitalPersonInfoVO; import com.xinelu.manage.vo.hospitalpersoninfo.HospitalPersonInfoVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import java.util.List;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 健康咨询-科室人员信息Controller * 健康咨询-科室人员信息Controller

View File

@ -127,4 +127,12 @@ public interface PatientCouponReceiveMapper {
* @return 会员用户优惠券领取记录 * @return 会员用户优惠券领取记录
*/ */
PatientCouponReceiveInfoVO selectPatientCouponReceive(@Param("patientId") Long patientId, @Param("couponId") Long couponId); PatientCouponReceiveInfoVO selectPatientCouponReceive(@Param("patientId") Long patientId, @Param("couponId") Long couponId);
/**
*
* @param patientId 用户id
* @param receiveSource 优惠券状态
* @return int
*/
int getCouponReceiveByReceiveSource(@Param("patientId") Long patientId, @Param("receiveSource") String receiveSource);
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.hospitaldepartmentinfo.impl; package com.xinelu.manage.service.hospitaldepartmentinfo.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.constant.Constants; import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException; import com.xinelu.common.exception.ServiceException;
@ -55,6 +56,7 @@ public class HospitalDepartmentInfoServiceImpl implements IHospitalDepartmentInf
* @return 科室信息管理 * @return 科室信息管理
*/ */
@Override @Override
@DataScope(deptAlias = "d")
public List<HospitalDepartmentInfo> selectHospitalDepartmentInfoList(HospitalDepartmentInfo hospitalDepartmentInfo) { public List<HospitalDepartmentInfo> selectHospitalDepartmentInfoList(HospitalDepartmentInfo hospitalDepartmentInfo) {
return hospitalDepartmentInfoMapper.selectHospitalDepartmentInfoList(hospitalDepartmentInfo); return hospitalDepartmentInfoMapper.selectHospitalDepartmentInfoList(hospitalDepartmentInfo);
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.hospitalpersoninfo.impl; package com.xinelu.manage.service.hospitalpersoninfo.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.constant.Constants; import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
@ -72,6 +73,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
* @return 健康咨询-科室人员信息 * @return 健康咨询-科室人员信息
*/ */
@Override @Override
@DataScope(deptAlias = "hpi", userAlias = "u")
public List<HospitalPersonInfoVO> selectHospitalPersonInfoList(HospitalPersonInfoVO hospitalPersonInfo) { public List<HospitalPersonInfoVO> selectHospitalPersonInfoList(HospitalPersonInfoVO hospitalPersonInfo) {
return hospitalPersonInfoMapper.selectHospitalPersonInfoList(hospitalPersonInfo); return hospitalPersonInfoMapper.selectHospitalPersonInfoList(hospitalPersonInfo);
} }
@ -138,6 +140,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
sysUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword())); sysUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
sysUser.setNickName(hospitalPersonInfo.getPersonName()); sysUser.setNickName(hospitalPersonInfo.getPersonName());
sysUser.setHospitalPersonId(hospitalPersonInfo.getId()); sysUser.setHospitalPersonId(hospitalPersonInfo.getId());
sysUser.setHospitalId(hospitalPersonInfo.getHospitalId());
sysUser.setStatus("0"); sysUser.setStatus("0");
sysUser.setDelFlag("0"); sysUser.setDelFlag("0");
userMapper.insertUser(sysUser); userMapper.insertUser(sysUser);
@ -169,6 +172,32 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
hospitalPersonInfo.setUpdateTime(LocalDateTime.now()); hospitalPersonInfo.setUpdateTime(LocalDateTime.now());
hospitalPersonInfo.setUpdateBy(SecurityUtils.getUsername()); hospitalPersonInfo.setUpdateBy(SecurityUtils.getUsername());
hospitalPersonInfoMapper.updateHospitalPersonInfo(hospitalPersonInfo); hospitalPersonInfoMapper.updateHospitalPersonInfo(hospitalPersonInfo);
// 修改sys_user表
SysUser sysUser = new SysUser();
sysUser.setHospitalPersonId(hospitalPersonInfo.getId());
List<SysUser> userList = userMapper.selectUserList(sysUser);
if (CollectionUtils.isEmpty(userList)) {
SysUser newUser = new SysUser();
newUser.setUserName(hospitalPersonInfo.getPersonAccount());
newUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
newUser.setNickName(hospitalPersonInfo.getPersonName());
newUser.setHospitalPersonId(hospitalPersonInfo.getId());
newUser.setHospitalId(hospitalPersonInfo.getHospitalId());
newUser.setStatus("0");
newUser.setDelFlag("0");
userMapper.insertUser(newUser);
} else {
SysUser updUser = userList.get(0);
updUser.setUserName(hospitalPersonInfo.getPersonAccount());
updUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
updUser.setNickName(hospitalPersonInfo.getPersonName());
updUser.setHospitalPersonId(hospitalPersonInfo.getId());
updUser.setHospitalId(hospitalPersonInfo.getHospitalId());
updUser.setStatus("0");
updUser.setDelFlag("0");
userMapper.updateUser(updUser);
}
//根据科室人员id去查询对应的资质证书 使用流来获取所有的证书路径 //根据科室人员id去查询对应的资质证书 使用流来获取所有的证书路径
List<HospitalPersonCertificate> hospitalPersonCertificateList = hospitalPersonCertificateMapper.selectHospitalPersonCertificateByIds(Collections.singletonList(hospitalPersonInfo.getId())); List<HospitalPersonCertificate> hospitalPersonCertificateList = hospitalPersonCertificateMapper.selectHospitalPersonCertificateByIds(Collections.singletonList(hospitalPersonInfo.getId()));
//数据库中的 //数据库中的

View File

@ -33,6 +33,12 @@ public class AppGoodsOrderVO {
@ApiModelProperty(value = "患者名称") @ApiModelProperty(value = "患者名称")
private String patientName; private String patientName;
@ApiModelProperty(value = "医生主键")
private Long doctorId;
@ApiModelProperty(value = "医生姓名")
private String doctorName;
/** /**
* 患者身份证号 * 患者身份证号
*/ */
@ -105,4 +111,5 @@ public class AppGoodsOrderVO {
**/ **/
@ApiModelProperty(value = "健康咨询内容") @ApiModelProperty(value = "健康咨询内容")
private String healthConsultationContent; private String healthConsultationContent;
} }

View File

@ -767,7 +767,7 @@
<select id="getConsultationOrders" resultType="com.xinelu.manage.vo.goodsorder.AppGoodsOrderVO"> <select id="getConsultationOrders" resultType="com.xinelu.manage.vo.goodsorder.AppGoodsOrderVO">
select select
c.patient_id as patientId, c.id as consultationInfoId, c.patient_id as patientId, c.id as consultationInfoId,
c.patient_name as patientName, c.card_no as cardNo, c.patient_name as patientName, c.doctor_id as doctorId,c.doctor_name as doctorName, c.card_no as cardNo,
c.phone, c.address,c.appointment_date, c.appointment_start_time, c.appointment_end_time,c.problem_description, c.phone, c.address,c.appointment_date, c.appointment_start_time, c.appointment_end_time,c.problem_description,
gr.id as goodsOrderId,gr.order_no, gr.order_status, gr.total_price, gr.health_consultation_content gr.id as goodsOrderId,gr.order_no, gr.order_status, gr.total_price, gr.health_consultation_content
from goods_order gr left join consultation_info c on gr.consultation_info_id = c.id from goods_order gr left join consultation_info c on gr.consultation_info_id = c.id

View File

@ -23,22 +23,22 @@
</resultMap> </resultMap>
<sql id="selectHospitalDepartmentInfoVo"> <sql id="selectHospitalDepartmentInfoVo">
select id, select d.id,
parent_id, d.parent_id,
hospital_id, d.hospital_id,
hospital_name, d.hospital_name,
department_code, d.department_code,
department_name, d.department_name,
department_phone, d.department_phone,
department_person, d.department_person,
department_address, d.department_address,
department_level, d.department_level,
department_sort, d.department_sort,
create_by, d.create_by,
create_time, d.create_time,
update_by, d.update_by,
update_time d.update_time
from hospital_department_info from hospital_department_info d
</sql> </sql>
<select id="selectHospitalDepartmentInfoList" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo" <select id="selectHospitalDepartmentInfoList" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo"
@ -46,43 +46,45 @@
<include refid="selectHospitalDepartmentInfoVo"/> <include refid="selectHospitalDepartmentInfoVo"/>
<where> <where>
<if test="parentId != null "> <if test="parentId != null ">
and parent_id = #{parentId} and d.parent_id = #{parentId}
</if> </if>
<if test="hospitalId != null "> <if test="hospitalId != null ">
and hospital_id = #{hospitalId} and d.hospital_id = #{hospitalId}
</if> </if>
<if test="hospitalName != null and hospitalName != ''"> <if test="hospitalName != null and hospitalName != ''">
and hospital_name like concat('%', #{hospitalName}, '%') and d.hospital_name like concat('%', #{hospitalName}, '%')
</if> </if>
<if test="departmentCode != null and departmentCode != ''"> <if test="departmentCode != null and departmentCode != ''">
and department_code = #{departmentCode} and dd.epartment_code = #{departmentCode}
</if> </if>
<if test="departmentName != null and departmentName != ''"> <if test="departmentName != null and departmentName != ''">
and department_name like concat('%', #{departmentName}, '%') and d.department_name like concat('%', #{departmentName}, '%')
</if> </if>
<if test="departmentPhone != null and departmentPhone != ''"> <if test="departmentPhone != null and departmentPhone != ''">
and department_phone = #{departmentPhone} and d.department_phone = #{departmentPhone}
</if> </if>
<if test="departmentPerson != null and departmentPerson != ''"> <if test="departmentPerson != null and departmentPerson != ''">
and department_person = #{departmentPerson} and d.department_person = #{departmentPerson}
</if> </if>
<if test="departmentAddress != null and departmentAddress != ''"> <if test="departmentAddress != null and departmentAddress != ''">
and department_address = #{departmentAddress} and d.department_address = #{departmentAddress}
</if> </if>
<if test="departmentLevel != null "> <if test="departmentLevel != null ">
and department_level = #{departmentLevel} and d.department_level = #{departmentLevel}
</if> </if>
<if test="departmentSort != null "> <if test="departmentSort != null ">
and department_sort = #{departmentSort} and d.department_sort = #{departmentSort}
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where> </where>
ORDER BY id DESC ORDER BY d.id DESC
</select> </select>
<select id="selectHospitalDepartmentInfoById" parameterType="Long" <select id="selectHospitalDepartmentInfoById" parameterType="Long"
resultMap="HospitalDepartmentInfoResult"> resultMap="HospitalDepartmentInfoResult">
<include refid="selectHospitalDepartmentInfoVo"/> <include refid="selectHospitalDepartmentInfoVo"/>
where id = #{id} where d.id = #{id}
</select> </select>
<insert id="insertHospitalDepartmentInfo" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo" useGeneratedKeys="true" <insert id="insertHospitalDepartmentInfo" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo" useGeneratedKeys="true"

View File

@ -152,6 +152,8 @@
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and hpi.status = #{status} and hpi.status = #{status}
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where> </where>
ORDER BY id DESC ORDER BY id DESC
</select> </select>

View File

@ -363,4 +363,12 @@
where pcr.patient_id = #{patientId} where pcr.patient_id = #{patientId}
and pcr.coupon_id = #{couponId} and pcr.coupon_id = #{couponId}
</select> </select>
<select id="getCouponReceiveByReceiveSource" resultType="java.lang.Integer">
select
count(1)
where
patient_id = #{patientId}
and receive_source = #{receiveSource}
</select>
</mapper> </mapper>

View File

@ -24,6 +24,7 @@
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
<result property="hospitalPersonId" column="hospital_person_id"/> <result property="hospitalPersonId" column="hospital_person_id"/>
<result property="hospitalId" column="hospital_id"/>
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/> <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/>
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
</resultMap> </resultMap>
@ -49,7 +50,7 @@
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.hospital_person_id, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.hospital_person_id,u.hospital_id,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u from sys_user u
@ -163,6 +164,7 @@
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="hospitalPersonId != null and hospitalPersonId != ''">hospital_person_id,</if> <if test="hospitalPersonId != null and hospitalPersonId != ''">hospital_person_id,</if>
<if test="hospitalId != null and hospitalId != ''">hospital_id,</if>
create_time create_time
)values( )values(
<if test="userId != null and userId != ''">#{userId},</if> <if test="userId != null and userId != ''">#{userId},</if>
@ -178,6 +180,7 @@
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="hospitalPersonId != null and hospitalPersonId != ''">#{hospitalPersonId},</if> <if test="hospitalPersonId != null and hospitalPersonId != ''">#{hospitalPersonId},</if>
<if test="hospitalId != null and hospitalId != ''">#{hospitalId},</if>
sysdate() sysdate()
) )
</insert> </insert>