diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java index 628432c..5415ebf 100644 --- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java +++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java @@ -144,15 +144,12 @@ public class ResidentServiceApplyController extends BaseController { @ApiOperation("服务评价列表") @GetMapping("/evaluateRecord/{identity}") - public R> performanceEvaluateRecord(@PathVariable String identity) { - PatientInfo patientInfo = residentPatientInfoService.getByCardNo(identity); - if (patientInfo != null && !StringUtils.isBlank(patientInfo.getCityCode())) { - String result = (String) httpService.get(SpringUtils.getFdUrl(patientInfo.getCityCode()) + "/performance/recordV2/" + identity, null, String.class); - JSONObject jsonObject = JSONObject.parseObject(result); - if (jsonObject.getInteger("code") == 1) { - if (jsonObject.get("data") != null && jsonObject.getJSONArray("data").size() > 0) { - return R.ok(JSONArray.parseArray(jsonObject.getJSONArray("data").toJSONString()).toJavaList(OrderEvaluateVo.class)); - } + public R> performanceEvaluateRecord(@PathVariable String identity, @RequestHeader("region") String region) { + String result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/performance/recordV2/" + identity, null, String.class); + JSONObject jsonObject = JSONObject.parseObject(result); + if (jsonObject.getInteger("code") == 1) { + if (jsonObject.get("data") != null && jsonObject.getJSONArray("data").size() > 0) { + return R.ok(JSONArray.parseArray(jsonObject.getJSONArray("data").toJSONString()).toJavaList(OrderEvaluateVo.class)); } } return R.ok(); diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml index 042ab35..c00e7e1 100644 --- a/xinelu-admin/src/main/resources/application.yml +++ b/xinelu-admin/src/main/resources/application.yml @@ -249,8 +249,8 @@ xss: # 家医配置 fd: - dz: http://8.131.93.145:54089/fd/mp - dy: http://8.131.93.145:54089/fd/mp + dz: http://8.131.93.145:54007/fd/mp + dy: http://8.131.93.145:54008/fd/mp # 签约附近的机构多少公里内 <=0时不限制 distance: 0 @@ -281,15 +281,15 @@ applet-page-config: # 首页跳转路径 page-url: pages/startup/startup # 个人中心-优惠券页面跳转路径 - coupon-page-url: pages/coupon/coupon + coupon-page-url: pagesB/coupon/coupon # 商品订单页面跳转路径 - goods-order-page-url: pages/CommodityOrder/CommodityOrder + goods-order-page-url: pagesB/CommodityOrder/CommodityOrder # 预约订单页面跳转路径 - appoint-order-page-url: pages/Nursingstationserviceorder/Nursingstationserviceorder + appoint-order-page-url: pagesB/Nursingstationserviceorder/Nursingstationserviceorder # 积分页面跳转路径 - integral-page-url: pages/integral/integral + integral-page-url: pagesB/integral/integral # 护理结构详情页面跳转路径 - nursestation-details-page-url: pages/nursestation/nursestation + nursestation-details-page-url: pagesB/nursestation/nursestation # 新医路微信商户号配置参数 xyl-we-chat-config: diff --git a/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java b/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java index fc17fba..f9cb71c 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java +++ b/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java @@ -212,7 +212,7 @@ public class Constants { /** * 微信小程序ACCESS_TOKEN前缀 */ - public static final String NURSE_STATION_APPLET_ACCESS_TOKEN = "NURSE_STATION_APPLET_ACCESS_TOKEN"; + public static final String NURSE_STATION_APPLET_ACCESS_TOKEN = "NURSE_STATION_APPLET_ACCESS_TOKEN_XYL_"; /** * 护理员微信小程序ACCESS_TOKEN前缀 @@ -259,34 +259,34 @@ public class Constants { */ public static final String ATTRIBUTE_PICTURE_URL = "attributePitureUrl"; - /** - * 筛查预约条码图片地址 - */ - public static final String APPLY_BARCODE_PICTURE_URL = "applyBarcodePitureUrl"; + /** + * 筛查预约条码图片地址 + */ + public static final String APPLY_BARCODE_PICTURE_URL = "applyBarcodePitureUrl"; - /** - * 筛查预约条码图片地址 - */ - public static final String REGISTER_BARCODE_PICTURE_URL = "registerBarcodePitureUrl"; + /** + * 筛查预约条码图片地址 + */ + public static final String REGISTER_BARCODE_PICTURE_URL = "registerBarcodePitureUrl"; - /** - * 血小板筛查图片地址 - */ - public static final String PLATELET_PICTURE_URL = "plateletPitureUrl"; + /** + * 血小板筛查图片地址 + */ + public static final String PLATELET_PICTURE_URL = "plateletPitureUrl"; - /** - * 眼底病变筛查左眼图片地址 - */ - public static final String LEFT_EYE_PICTURE_URL = "leftEyePitureUrl"; - /** - * 眼底病变筛查右眼图片地址 - */ - public static final String RIGHT_EYE_PICTURE_URL = "rightEyePitureUrl"; + /** + * 眼底病变筛查左眼图片地址 + */ + public static final String LEFT_EYE_PICTURE_URL = "leftEyePitureUrl"; + /** + * 眼底病变筛查右眼图片地址 + */ + public static final String RIGHT_EYE_PICTURE_URL = "rightEyePitureUrl"; - /** - * 阿尔兹海默症结果文件地址 - */ - public static final String ALZHEIMER_FILE_URL = "alzheimerFileUrl"; + /** + * 阿尔兹海默症结果文件地址 + */ + public static final String ALZHEIMER_FILE_URL = "alzheimerFileUrl"; /** * 护理站模板信息下载 */ diff --git a/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java b/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java index 277d2ce..c8f2738 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java +++ b/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java @@ -118,6 +118,11 @@ public class SysUser extends BaseEntity { */ private Long hospitalPersonId; + /** + * 医院主键 + */ + private Long hospitalId; + /** * 部门对象 */ @@ -347,6 +352,14 @@ public class SysUser extends BaseEntity { this.hospitalPersonId = hospitalPersonId; } + public Long getHospitalId() { + return hospitalId; + } + + public void setHospitalId(Long hospitalId) { + this.hospitalId = hospitalId; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/AppletChatUtil.java b/xinelu-common/src/main/java/com/xinelu/common/utils/AppletChatUtil.java index 4a61a1d..d79a8ec 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/utils/AppletChatUtil.java +++ b/xinelu-common/src/main/java/com/xinelu/common/utils/AppletChatUtil.java @@ -39,20 +39,10 @@ import java.util.concurrent.TimeUnit; @Component public class AppletChatUtil { - private static RedisTemplate redisTemplate; - - private static AppletChatConfig appletChatConfig; - @Resource - public void redisTemplate(RedisTemplate redisTemplate) { - AppletChatUtil.redisTemplate = redisTemplate; - } - + private RedisTemplate redisTemplate; @Resource - public void appletChatConfig(AppletChatConfig appletChatConfig) { - AppletChatUtil.appletChatConfig = appletChatConfig; - } - + private AppletChatConfig appletChatConfig; /** * 返回成功状态码 @@ -164,7 +154,7 @@ public class AppletChatUtil { * @param filePathWeChatCodeUrl 文件保存路径 * @return java.lang.String 二维码地址 */ - public static String createAppletCode(Long weChatCodeId, boolean failFlag, String fileName, String appletPageUrl, String filePathWeChatCodeUrl) { + public String createAppletCode(Long weChatCodeId, boolean failFlag, String fileName, String appletPageUrl, String filePathWeChatCodeUrl) { if (BooleanUtils.isTrue(failFlag)) { //删除原有Redis中的key值 String accessTokenKey = Constants.NURSE_STATION_APPLET_ACCESS_TOKEN + "accessToken"; @@ -250,7 +240,7 @@ public class AppletChatUtil { * * @return 小程序的AccessToken */ - public static String getAppletAccessToken() { + public String getAppletAccessToken() { String accessToken; String accessTokenKey = Constants.NURSE_STATION_APPLET_ACCESS_TOKEN + "accessToken"; //从Redis中取出accessToken diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/PatientInfoBody.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/PatientInfoBody.java index 1ebf219..88c2ab9 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/PatientInfoBody.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/PatientInfoBody.java @@ -239,8 +239,6 @@ public class PatientInfoBody extends BaseEntity { /** * 绑定城市(1:德州 2:东营) */ - @NotNull(message = "绑定城市不能为空") - @NotBlank(message = "绑定城市不能为空") @ApiModelProperty(value = "绑定城市(1:德州 2:东营)") private String cityCode; diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/ResidentServiceApplyBody.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/ResidentServiceApplyBody.java index 3b66212..b3fcb35 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/ResidentServiceApplyBody.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/ResidentServiceApplyBody.java @@ -1,5 +1,6 @@ package com.xinelu.familydoctor.applet.pojo.body; +import com.fasterxml.jackson.annotation.JsonFormat; import com.xinelu.familydoctor.applet.pojo.dto.ResidentServiceFormApplyDto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -47,19 +48,20 @@ public class ResidentServiceApplyBody extends ResidentServiceFormApplyDto{ * 预约时间 */ @ApiModelProperty(value = "预约时间", required = true) + @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date bookingTime; /** * 预约机构编号 */ @ApiModelProperty(value = "预约机构编号", required = true) - private String orgNo; + private String hospitalId; /** * 预约机构名称 */ @ApiModelProperty(value = "预约机构名称", required = true) - private String orgName; + private String hospitalName; /** * 预约团队编号 diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java index 70b2eba..bb5a5f9 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentPatientInfoServiceImpl.java @@ -4,36 +4,39 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.xinelu.common.config.AppletChatConfig; 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.utils.bean.BeanUtils; import com.xinelu.common.utils.http.HttpService; import com.xinelu.common.utils.http.HttpUtils; import com.xinelu.common.utils.http.SslUtils; -import com.xinelu.common.utils.spring.SpringUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.familydoctor.applet.mapper.ResidentPatientInfoMapper; import com.xinelu.familydoctor.applet.pojo.body.PatientInfoBody; 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.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.mapper.coupon.CouponMapper; +import com.xinelu.manage.mapper.patientcouponreceive.PatientCouponReceiveMapper; import com.xinelu.manage.mapper.receiveAddressInfo.ReceiveAddressInfoMapper; +import com.xinelu.manage.vo.patientcouponreceive.PatientCouponReceiveInfoVO; 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.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -58,6 +61,10 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi private RedisTemplate redisTemplate; @Resource private ReceiveAddressInfoMapper receiveAddressInfoMapper; + @Resource + private PatientCouponReceiveMapper patientCouponReceiveMapper; + @Resource + private CouponMapper couponMapper; /** * @return com.xinelu.familydoctor.applet.pojo.entity.PatientInfo @@ -192,10 +199,9 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi } else { patientInfo.setDisease("0"); } - patientInfo.setLoginFlag(Long.valueOf(1)); + patientInfo.setLoginFlag(1L); patientInfo.setBindOpenid(body.getOpenid()); updatePatientInfo(patientInfo); - // 新增 } else { patientInfo = residentPatientInfoMapper.isRegisterByCardNo(body.getCardNo()); @@ -216,7 +222,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi patientInfo.setUpdateBy(body.getCardNo()); patientInfo.setHeadPictureUrl(body.getHeadPictureUrl()); patientInfo.setDelFlag(0); - patientInfo.setLoginFlag(Long.valueOf(1)); + patientInfo.setLoginFlag(1L); if (body.getDiseaseList() != null) { patientInfo.setDisease(body.getDiseaseList().stream().collect(Collectors.joining(","))); } else { @@ -229,6 +235,10 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi } // 注册 } else { + List list = residentPatientInfoMapper.getList(body.getOpenid(), null); + if(list != null && list.size() >= 8) { + throw new ServiceException("同一个微信最多绑定8个居民"); + } PatientInfo entity = new PatientInfo(); BeanUtils.copyBeanProp(entity, body); // 已绑定openid,将该值置空 @@ -245,7 +255,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi entity.setIsChecked("0"); entity.setCreateTime(new Date()); entity.setCreateBy(body.getCardNo()); - entity.setLoginFlag(Long.valueOf(1)); + entity.setLoginFlag(1L); entity.setDelFlag(0); entity.setBindOpenid(body.getOpenid()); residentPatientInfoMapper.insertPatientInfo(entity); @@ -264,6 +274,15 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi } 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); + } } /** 新增收货人地址信息 */ @@ -450,4 +469,50 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi HashMap.put("cityCode", cityCode); 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 couponList = couponMapper.selectCouponList(coupon); + if (CollectionUtils.isEmpty(couponList)) { + return ; + } + //组装优惠券信息 + List 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.WAIT_RECEIVE.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("完善用户信息失败,请联系管理员!"); + } + } + } } diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java index 27e4388..853c8e0 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java @@ -88,6 +88,8 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe // 审批状态0:待批准 1:已同意 2:已拒绝 entity.setApprovalStatus("0"); entity.setBookingNo(IdUtils.simpleUUID()); + entity.setOrgNo(body.getHospitalId()); + entity.setOrgName(body.getHospitalName()); if(StringUtils.isBlank(entity.getServiceWay())) { entity.setServiceWay("2"); } @@ -101,7 +103,7 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe messagePushBody.setBusType("10"); messagePushBody.setOpenid(patientInfo.getBindOpenid()); messagePushBody.setReceiveName(patientInfo.getPatientName()); - messagePushBody.setText1(body.getOrgName()); + messagePushBody.setText1(body.getHospitalName()); messagePushBody.setText2(body.getFormName().length() >= 20? body.getFormName().substring(0,17) + "...": body.getFormName()); messagePushBody.setText3(body.getFormName()); messagePushBody.setSendTitle("服务预约"); diff --git a/xinelu-framework/src/main/java/com/xinelu/framework/aspectj/DataScopeAspect.java b/xinelu-framework/src/main/java/com/xinelu/framework/aspectj/DataScopeAspect.java index dfe0c21..df52e43 100644 --- a/xinelu-framework/src/main/java/com/xinelu/framework/aspectj/DataScopeAspect.java +++ b/xinelu-framework/src/main/java/com/xinelu/framework/aspectj/DataScopeAspect.java @@ -1,6 +1,7 @@ package com.xinelu.framework.aspectj; 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.entity.SysRole; import com.xinelu.common.core.domain.entity.SysUser; @@ -86,20 +87,21 @@ public class DataScopeAspect { break; } else if (DATA_SCOPE_CUSTOM.equals(dataScope)) { 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())); } 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)) { - sqlString.append(StringUtils.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", - deptAlias, user.getDeptId(), user.getDeptId())); + //sqlString.append(StringUtils.format( + // " OR {}.hospital_id IN ( SELECT hospital_id FROM hospital_info WHERE hospital_id = {} or find_in_set( {} , ancestors ) )", + // deptAlias, user.getHospitalId(), user.getHospitalId())); + sqlString.append(StringUtils.format(" OR {}.hospital_id = {} ", deptAlias, user.getHospitalId())); } else if (DATA_SCOPE_SELF.equals(dataScope)) { 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 { // 数据权限为仅本人且没有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.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) + ")"); + } } } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java index 93cd3ea..09840b6 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java @@ -3,11 +3,17 @@ package com.xinelu.applet.controller.appletscreeningproject; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.R; import com.xinelu.manage.domain.screeningproject.ScreeningProject; -import com.xinelu.manage.service.screeningproject.IScreeningProjectService; +import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO; +import com.xinelu.manage.service.screeningrecord.IScreeningRecordService; +import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.Resource; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,12 +28,29 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "项目控制器-小程序") public class AppletScreeningProjectController extends BaseController { @Resource - private IScreeningProjectService projectService; + private IScreeningRecordService screeningRecordService; @ApiOperation("筛查项目列表") @GetMapping("list") - public R> list(ScreeningProject project) { - List list = projectService.findList(project); - return R.ok(list); + public R> list(ScreeningRecordDTO query) { + // 查询居民预约过的项目 + List projectList = new ArrayList<>(); + + query.setScreeningType("1"); + List recordList = screeningRecordService.list(query); + if (CollectionUtils.isNotEmpty(recordList)) { + // 按照项目进行分组 + Map> groupByProject = recordList.stream() + .collect(Collectors.groupingBy(ScreeningRecordVo::getProjectId)); + for (String projectId : groupByProject.keySet()) { + ScreeningProject project = new ScreeningProject(); + project.setProjectId(projectId); + project.setProjectName(groupByProject.get(projectId).get(0).getProjectName()); + project.setHospitalId(groupByProject.get(projectId).get(0).getHospitalId()); + project.setHospitalName(groupByProject.get(projectId).get(0).getHospitalName()); + projectList.add(project); + } + } + return R.ok(projectList); } } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java index 9fc7d4d..9d502c7 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java @@ -20,13 +20,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; /** @@ -102,13 +96,14 @@ public class ChatRecordController extends BaseController { @ApiOperation(value = "获取指定类型的消息记录", notes = "1:通知公告 2:健康推送 4:消息通知") @GetMapping("/getMegList") - public TableDataInfo getMegList(MessageSearchDto messageDto) { + public TableDataInfo getMegList(MessageSearchDto messageDto, @RequestHeader("region") String region) { if (messageDto.getPatientId() == null) { throw new ServiceException("居民业务主键不能为空"); } if (StringUtils.isBlank(messageDto.getMessageCategory())) { throw new ServiceException("消息类型不能为空"); } + messageDto.setCityCode(region); startPage(); return getDataTable(chatRecordService.getMegList(messageDto)); } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/nurseapplogin/NurseAppLoginController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/nurseapplogin/NurseAppLoginController.java index b10cc3b..fd5c2ed 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/nurseapplogin/NurseAppLoginController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/nurseapplogin/NurseAppLoginController.java @@ -9,12 +9,10 @@ import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.custominterface.Query; import com.xinelu.common.exception.ServiceException; +import com.xinelu.common.utils.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -91,11 +89,11 @@ public class NurseAppLoginController extends BaseController { */ @MobileRequestAuthorization @GetMapping("/appPersonal") - public AjaxResult nurseAppPersonal(Long patientId) { + public AjaxResult nurseAppPersonal(Long patientId, @RequestHeader("region") String region) { if (Objects.isNull(patientId)) { return AjaxResult.error("用户信息不能为空!"); } - return nurseAppLoginService.nurseAppPersonal(patientId); + return nurseAppLoginService.nurseAppPersonal(patientId, region); } /** @@ -128,4 +126,4 @@ public class NurseAppLoginController extends BaseController { } return nurseAppLoginService.updateAppointmentOrder(appointmentOrderId, cancelAppointmentReason); } -} \ No newline at end of file +} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/NurseAppLoginService.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/NurseAppLoginService.java index 19bba40..60c80a1 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/NurseAppLoginService.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/NurseAppLoginService.java @@ -44,7 +44,7 @@ public interface NurseAppLoginService { * @param patientId 会员id * @return 结果 */ - AjaxResult nurseAppPersonal(Long patientId); + AjaxResult nurseAppPersonal(Long patientId, String region); /** * App查询预约服务订单 diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/impl/NurseAppLoginServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/impl/NurseAppLoginServiceImpl.java index b237c4c..cb70fb4 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/impl/NurseAppLoginServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nurseapplogin/impl/NurseAppLoginServiceImpl.java @@ -180,7 +180,7 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService { * @return 结果 */ @Override - public AjaxResult nurseAppPersonal(Long patientId) { + public AjaxResult nurseAppPersonal(Long patientId, String region) { PatientAndDiseaseVO patientDisease = nurseAppLoginMapper.getPatientDiseaseByPatientId(patientId); if (Objects.nonNull(patientDisease) && Objects.nonNull(patientDisease.getBirthDate())) { patientDisease.setAge(AgeUtil.getAgeMonth(String.valueOf(patientDisease.getBirthDate()))); @@ -205,6 +205,7 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService { } else { patientDisease.setAreaName(""); } + patientDisease.setCityCode(region); // 更新签约编号 setSignInfo(patientDisease); //查询所有商品订单 @@ -287,4 +288,4 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService { } return AjaxResult.success(); } -} \ No newline at end of file +} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nursingorder/impl/NursingOrderServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nursingorder/impl/NursingOrderServiceImpl.java index 9e7ee64..ac58321 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nursingorder/impl/NursingOrderServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/nursingorder/impl/NursingOrderServiceImpl.java @@ -162,28 +162,35 @@ public class NursingOrderServiceImpl implements INursingOrderService { if (CollectionUtils.isNotEmpty(goodsOrderAndConsultationOrder)) { patientOrders.addAll(goodsOrderAndConsultationOrder); } - String result = HttpUtils.sendGet(SpringUtils.getFdUrl(nurseOrder.getRegion()) + "/performance/recordV2/" + nurseOrder.getCardNo()); - if (StringUtils.isBlank(result)) { - log.info("获取家医小程序用户订单信息失败,result = " + result); - } - PatientOrderVO resultHttp = JSON.parseObject(result, PatientOrderVO.class); - if (Objects.nonNull(resultHttp) && CollectionUtils.isNotEmpty(resultHttp.getData()) && Objects.nonNull(resultHttp.getData().get(0).getOrderNo())) { - List data = resultHttp.getData(); - data.forEach(item -> item.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo())); - List orderEvaluate = nursingOrderMapper.getOrderEvaluateByPatientId(nurseOrder.getParentId()); - if (CollectionUtils.isNotEmpty(orderEvaluate) && EVALUATED.equals(nurseOrder.getOrderStatus())) { - for (PatientOrder patientOrder : orderEvaluate) { - PatientOrder dataFirst = data.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getOrderNo()) && patientOrder.getOrderNo().equals(item.getOrderNo())).findFirst().orElse(new PatientOrder()); - dataFirst.setCompositeScore(patientOrder.getCompositeScore()); - patientOrders.add(dataFirst); + PatientOrderVO resultHttp = new PatientOrderVO(); + if (Objects.nonNull(nurseOrder.getRegion())) { + try { + String result = HttpUtils.sendGet(SpringUtils.getFdUrl(nurseOrder.getRegion()) + "/performance/recordV2/" + nurseOrder.getCardNo()); + if (StringUtils.isBlank(result)) { + log.info("获取家医小程序用户订单信息失败,result = " + result); } + resultHttp = JSON.parseObject(result, PatientOrderVO.class); + } catch (Exception e) { + log.error("查询家医履约评价记录异常: " + e.getMessage()); } - if (CollectionUtils.isNotEmpty(orderEvaluate) && NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) { - Collection subtract = CollectionUtils.subtract(data, orderEvaluate); - patientOrders.addAll(subtract); - } - if (CollectionUtils.isEmpty(orderEvaluate) && NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) { - patientOrders.addAll(data); + if (Objects.nonNull(resultHttp) && CollectionUtils.isNotEmpty(resultHttp.getData()) && Objects.nonNull(resultHttp.getData().get(0).getOrderNo())) { + List data = resultHttp.getData(); + data.forEach(item -> item.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo())); + List orderEvaluate = nursingOrderMapper.getOrderEvaluateByPatientId(nurseOrder.getParentId()); + if (CollectionUtils.isNotEmpty(orderEvaluate) && EVALUATED.equals(nurseOrder.getOrderStatus())) { + for (PatientOrder patientOrder : orderEvaluate) { + PatientOrder dataFirst = data.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getOrderNo()) && patientOrder.getOrderNo().equals(item.getOrderNo())).findFirst().orElse(new PatientOrder()); + dataFirst.setCompositeScore(patientOrder.getCompositeScore()); + patientOrders.add(dataFirst); + } + } + if (CollectionUtils.isNotEmpty(orderEvaluate) && NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) { + Collection subtract = CollectionUtils.subtract(data, orderEvaluate); + patientOrders.addAll(subtract); + } + if (CollectionUtils.isEmpty(orderEvaluate) && NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) { + patientOrders.addAll(data); + } } } TableDataInfo rspData = new TableDataInfo(); @@ -197,4 +204,4 @@ public class NursingOrderServiceImpl implements INursingOrderService { rspData.setMsg("查询成功"); return rspData; } -} \ No newline at end of file +} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/patientcenter/impl/PatientCenterServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/patientcenter/impl/PatientCenterServiceImpl.java index aa306de..e0cd745 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/patientcenter/impl/PatientCenterServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/patientcenter/impl/PatientCenterServiceImpl.java @@ -6,7 +6,6 @@ import com.xinelu.applet.dto.patientcenter.PatientCenterCouponDTO; import com.xinelu.applet.mapper.nurseapplogin.NurseAppLoginMapper; import com.xinelu.applet.mapper.nursingstationgoods.NursingStationGoodsMapper; import com.xinelu.applet.mapper.patientcenter.PatientCenterMapper; -import com.xinelu.manage.service.messagepush.MessagePushService; import com.xinelu.applet.service.patientcenter.PatientCenterService; import com.xinelu.applet.vo.coupon.CouponVO; import com.xinelu.applet.vo.patientcenter.PatientCenterCouponVO; @@ -43,6 +42,7 @@ import com.xinelu.manage.mapper.patientintegralchange.PatientIntegralChangeMappe import com.xinelu.manage.mapper.patientsignininfo.PatientSignInInfoMapper; import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper; import com.xinelu.manage.mapper.systemsettingsinfo.SystemSettingsInfoMapper; +import com.xinelu.manage.service.messagepush.MessagePushService; import com.xinelu.manage.vo.patientcouponreceive.PatientCouponReceiveInfoVO; import com.xinelu.manage.vo.patientinfo.PatientInfoVO; import lombok.extern.slf4j.Slf4j; @@ -108,7 +108,8 @@ public class PatientCenterServiceImpl implements PatientCenterService { private SubscribeMessageRecordMapper subscribeMessageRecordMapper; @Resource private MessagePushService messagePushService; - + @Resource + private AppletChatUtil appletChatUtil; /** * 用户第一次签到次数 */ @@ -262,10 +263,10 @@ public class PatientCenterServiceImpl implements PatientCenterService { String appletPageUrl = appletPageConfig.getPageUrl(); //邀请人二维码存放路径 String filePathWeChatCodeUrl = xinYiLuConfig.getPersonalWeChatCodeUrl(); - String appletCodePicture = AppletChatUtil.createAppletCode(inviteId, false, fileName, appletPageUrl, filePathWeChatCodeUrl); + String appletCodePicture = appletChatUtil.createAppletCode(inviteId, false, fileName, appletPageUrl, filePathWeChatCodeUrl); if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) { //第一次调用获取小程序二维码信息失败,重新递归调用一次,第二次失败直接返回提示信息 - appletCodePicture = AppletChatUtil.createAppletCode(inviteId, true, fileName, appletPageUrl, filePathWeChatCodeUrl); + appletCodePicture = appletChatUtil.createAppletCode(inviteId, true, fileName, appletPageUrl, filePathWeChatCodeUrl); if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) { return AjaxResult.error("获取小程序二维码信息失败,请联系管理员!"); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalinfo/HospitalInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalinfo/HospitalInfoController.java index f3cb280..e89662b 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalinfo/HospitalInfoController.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalinfo/HospitalInfoController.java @@ -54,6 +54,12 @@ public class HospitalInfoController extends BaseController { @PreAuthorize("@ss.hasPermi('system:hospital:list')") @GetMapping("/list") public TableDataInfo list(HospitalInfo hospitalInfo) { + if (!getLoginUser().getUser().isAdmin()) { + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo != null) { + hospitalInfo.setId(hospitalPersonInfo.getHospitalId()); + } + } startPage(); List list = hospitalInfoService.selectHospitalInfoList(hospitalInfo); return getDataTable(list); @@ -65,7 +71,6 @@ public class HospitalInfoController extends BaseController { @ApiOperation("查询医院信息管理列表") @GetMapping("/getList") public AjaxResult getList(HospitalInfo hospitalInfo) { - // TODO 根据用户权限获取医院列表,机构管理员只能看自己机构,超级管理员查看所有 if (!getLoginUser().getUser().isAdmin()) { HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId()); if (hospitalPersonInfo != null) { diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalpersoninfo/HospitalPersonInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalpersoninfo/HospitalPersonInfoController.java index 72b016b..855bd7d 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalpersoninfo/HospitalPersonInfoController.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/hospitalpersoninfo/HospitalPersonInfoController.java @@ -15,13 +15,18 @@ import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import com.xinelu.manage.vo.hospitalpersoninfo.HospitalPersonInfoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - +import java.util.List; import javax.annotation.Resource; 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 diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java index fcdf38c..26c9bee 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java @@ -63,4 +63,7 @@ public class MessageSearchDto { @ApiModelProperty(value = "通知适用人群编号集合", hidden = true) private List crowdNoList; + + @ApiModelProperty("城市编码(1:德州 2:东营)") + private String cityCode; } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/patientcouponreceive/PatientCouponReceiveMapper.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/patientcouponreceive/PatientCouponReceiveMapper.java index c013787..dd337e3 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/patientcouponreceive/PatientCouponReceiveMapper.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/patientcouponreceive/PatientCouponReceiveMapper.java @@ -127,4 +127,12 @@ public interface PatientCouponReceiveMapper { * @return 会员用户优惠券领取记录 */ 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); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java index 5efd0b3..0863080 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java @@ -255,7 +255,7 @@ public class ChatRecordServiceImpl implements IChatRecordService { return chatRecordMapper.selectMegList(messageDto); // 健康推送 } else if(messageDto.getMessageCategory().equals("2")) { - String result = (String) httpService.get(SpringUtils.getFdUrl(patientInfo.getCityCode()) + "/resident/signinfo/detail/" + patientInfo.getCardNo(), null, String.class); + String result = (String) httpService.get(SpringUtils.getFdUrl(messageDto.getCityCode()) + "/resident/signinfo/detail/" + patientInfo.getCardNo(), null, String.class); JSONObject jsonObject = JSONObject.parseObject(result); if (!"1".equals(jsonObject.get("code"))) { throw new ServiceException(jsonObject.get("msg").toString()); diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitaldepartmentinfo/impl/HospitalDepartmentInfoServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitaldepartmentinfo/impl/HospitalDepartmentInfoServiceImpl.java index 43ee2d9..eda5d55 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitaldepartmentinfo/impl/HospitalDepartmentInfoServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitaldepartmentinfo/impl/HospitalDepartmentInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.xinelu.manage.service.hospitaldepartmentinfo.impl; +import com.xinelu.common.annotation.DataScope; import com.xinelu.common.constant.Constants; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.exception.ServiceException; @@ -55,6 +56,7 @@ public class HospitalDepartmentInfoServiceImpl implements IHospitalDepartmentInf * @return 科室信息管理 */ @Override + @DataScope(deptAlias = "d") public List selectHospitalDepartmentInfoList(HospitalDepartmentInfo hospitalDepartmentInfo) { return hospitalDepartmentInfoMapper.selectHospitalDepartmentInfoList(hospitalDepartmentInfo); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java index ee8ddfb..4608c0c 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.xinelu.manage.service.hospitalpersoninfo.impl; +import com.xinelu.common.annotation.DataScope; import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.constant.Constants; import com.xinelu.common.core.domain.AjaxResult; @@ -72,6 +73,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService * @return 健康咨询-科室人员信息 */ @Override + @DataScope(deptAlias = "hpi", userAlias = "u") public List selectHospitalPersonInfoList(HospitalPersonInfoVO hospitalPersonInfo) { return hospitalPersonInfoMapper.selectHospitalPersonInfoList(hospitalPersonInfo); } @@ -138,6 +140,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService sysUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword())); sysUser.setNickName(hospitalPersonInfo.getPersonName()); sysUser.setHospitalPersonId(hospitalPersonInfo.getId()); + sysUser.setHospitalId(hospitalPersonInfo.getHospitalId()); sysUser.setStatus("0"); sysUser.setDelFlag("0"); userMapper.insertUser(sysUser); @@ -169,6 +172,32 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService hospitalPersonInfo.setUpdateTime(LocalDateTime.now()); hospitalPersonInfo.setUpdateBy(SecurityUtils.getUsername()); hospitalPersonInfoMapper.updateHospitalPersonInfo(hospitalPersonInfo); + // 修改sys_user表 + SysUser sysUser = new SysUser(); + sysUser.setHospitalPersonId(hospitalPersonInfo.getId()); + List 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去查询对应的资质证书 使用流来获取所有的证书路径 List hospitalPersonCertificateList = hospitalPersonCertificateMapper.selectHospitalPersonCertificateByIds(Collections.singletonList(hospitalPersonInfo.getId())); //数据库中的 diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/nursestation/impl/NurseStationServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/nursestation/impl/NurseStationServiceImpl.java index f5bd2b9..11a70f5 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/nursestation/impl/NurseStationServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/nursestation/impl/NurseStationServiceImpl.java @@ -69,6 +69,8 @@ public class NurseStationServiceImpl implements INurseStationService { private AppletPageConfig appletPageConfig; @Resource private XinELuConfig xinYiLuConfig; + @Resource + private AppletChatUtil appletChatUtil; /** * 护理站营业时间默认值 @@ -457,18 +459,18 @@ public class NurseStationServiceImpl implements INurseStationService { case Constants.PERSON_CERTIFICATE_URL: uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPersonCertificateUrl(); break; - case Constants.PLATELET_PICTURE_URL: - uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPlateletPitureUrl(); - break; - case Constants.LEFT_EYE_PICTURE_URL: - uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getLeftEyePitureUrl(); - break; - case Constants.RIGHT_EYE_PICTURE_URL: - uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getRightEyePitureUrl(); - break; - case Constants.ALZHEIMER_FILE_URL: - uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getAlzheimerFileUrl(); - break; + case Constants.PLATELET_PICTURE_URL: + uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPlateletPitureUrl(); + break; + case Constants.LEFT_EYE_PICTURE_URL: + uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getLeftEyePitureUrl(); + break; + case Constants.RIGHT_EYE_PICTURE_URL: + uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getRightEyePitureUrl(); + break; + case Constants.ALZHEIMER_FILE_URL: + uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getAlzheimerFileUrl(); + break; default: break; } @@ -476,12 +478,12 @@ public class NurseStationServiceImpl implements INurseStationService { return AjaxResult.success(); } //上传 - String pictureName = ""; - if (StringUtils.isNotBlank(type) && StringUtils.equals(type, Constants.ALZHEIMER_FILE_URL)) { - pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.FILE_EXTENSION); - } else { - pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION); - } + String pictureName = ""; + if (StringUtils.isNotBlank(type) && StringUtils.equals(type, Constants.ALZHEIMER_FILE_URL)) { + pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.FILE_EXTENSION); + } else { + pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION); + } if (StringUtils.isBlank(pictureName)) { throw new ServiceException("图片上传失败,请联系管理员!"); @@ -617,10 +619,10 @@ public class NurseStationServiceImpl implements INurseStationService { String appletPageUrl = appletPageConfig.getNurseStationDetailsPageUrl(); //机构二维码存放路径 String filePathWeChatCodeUrl = xinYiLuConfig.getStationWechatCodeUrl(); - String appletCodePicture = AppletChatUtil.createAppletCode(nurseStationId, false, fileName, appletPageUrl, filePathWeChatCodeUrl); + String appletCodePicture = appletChatUtil.createAppletCode(nurseStationId, false, fileName, appletPageUrl, filePathWeChatCodeUrl); if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) { //第一次调用获取小程序二维码信息失败,重新递归调用一次,第二次失败直接返回提示信息 - appletCodePicture = AppletChatUtil.createAppletCode(nurseStationId, true, fileName, appletPageUrl, filePathWeChatCodeUrl); + appletCodePicture = appletChatUtil.createAppletCode(nurseStationId, true, fileName, appletPageUrl, filePathWeChatCodeUrl); if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) { return AjaxResult.error("获取小程序二维码信息失败,请联系管理员!"); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/goodsorder/AppGoodsOrderVO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/goodsorder/AppGoodsOrderVO.java index 585e351..960d581 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/goodsorder/AppGoodsOrderVO.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/goodsorder/AppGoodsOrderVO.java @@ -33,6 +33,12 @@ public class AppGoodsOrderVO { @ApiModelProperty(value = "患者名称") private String patientName; + @ApiModelProperty(value = "医生主键") + private Long doctorId; + + @ApiModelProperty(value = "医生姓名") + private String doctorName; + /** * 患者身份证号 */ @@ -105,4 +111,5 @@ public class AppGoodsOrderVO { **/ @ApiModelProperty(value = "健康咨询内容") private String healthConsultationContent; + } diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/goodsOrder/GoodsOrderMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/goodsOrder/GoodsOrderMapper.xml index 2ec10c3..ab1590e 100644 --- a/xinelu-nurse-manage/src/main/resources/mapper/manage/goodsOrder/GoodsOrderMapper.xml +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/goodsOrder/GoodsOrderMapper.xml @@ -767,7 +767,7 @@ - and parent_id = #{parentId} + and d.parent_id = #{parentId} - and hospital_id = #{hospitalId} + and d.hospital_id = #{hospitalId} - and hospital_name like concat('%', #{hospitalName}, '%') + and d.hospital_name like concat('%', #{hospitalName}, '%') - and department_code = #{departmentCode} + and dd.epartment_code = #{departmentCode} - and department_name like concat('%', #{departmentName}, '%') + and d.department_name like concat('%', #{departmentName}, '%') - and department_phone = #{departmentPhone} + and d.department_phone = #{departmentPhone} - and department_person = #{departmentPerson} + and d.department_person = #{departmentPerson} - and department_address = #{departmentAddress} + and d.department_address = #{departmentAddress} - and department_level = #{departmentLevel} + and d.department_level = #{departmentLevel} - and department_sort = #{departmentSort} + and d.department_sort = #{departmentSort} + + ${params.dataScope} - ORDER BY id DESC + ORDER BY d.id DESC and hpi.status = #{status} + + ${params.dataScope} ORDER BY id DESC diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/patientcouponreceive/PatientCouponReceiveMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/patientcouponreceive/PatientCouponReceiveMapper.xml index 96b3072..0333117 100644 --- a/xinelu-nurse-manage/src/main/resources/mapper/manage/patientcouponreceive/PatientCouponReceiveMapper.xml +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/patientcouponreceive/PatientCouponReceiveMapper.xml @@ -363,4 +363,13 @@ where pcr.patient_id = #{patientId} and pcr.coupon_id = #{couponId} + + diff --git a/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml b/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml index b0f0664..f2b0969 100644 --- a/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -24,6 +24,7 @@ + @@ -49,7 +50,7 @@ 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, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -163,6 +164,7 @@ create_by, remark, hospital_person_id, + hospital_id, create_time )values( #{userId}, @@ -178,6 +180,7 @@ #{createBy}, #{remark}, #{hospitalPersonId}, + #{hospitalId}, sysdate() )