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

 Conflicts:
	xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java
	xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java
	xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java
This commit is contained in:
haown 2023-11-10 17:35:08 +08:00
commit 58263e19d6
20 changed files with 105 additions and 57 deletions

View File

@ -144,15 +144,12 @@ public class ResidentServiceApplyController extends BaseController {
@ApiOperation("服务评价列表")
@GetMapping("/evaluateRecord/{identity}")
public R<List<OrderEvaluateVo>> 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<List<OrderEvaluateVo>> 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();

View File

@ -239,8 +239,6 @@ public class PatientInfoBody extends BaseEntity {
/**
* 绑定城市(1德州 2东营)
*/
@NotNull(message = "绑定城市不能为空")
@NotBlank(message = "绑定城市不能为空")
@ApiModelProperty(value = "绑定城市(1德州 2东营)")
private String cityCode;

View File

@ -495,7 +495,7 @@ public class ResidentPatientInfoServiceImpl implements IResidentPatientInfoServi
couponReceive.setPatientId(patientId);
couponReceive.setCouponId(couponInfo.getId());
couponReceive.setReceiveSource(CouponReceiveTypeEnum.NEW_PEOPLE_WELFARE.getInfo());
couponReceive.setUseStatus(CouponUseStatusEnum.NOT_USED.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());

View File

@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/login", "/register", "/captchaImage").anonymous()
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/nurseApplet/**", "/nurseApp/**", "/specialDisease/getUserInfo", "/monitor/payTask/handCloseOrder", "/newApp/login/**", "/system/hospitalPerson/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/nurseApplet/**", "/nurseApp/**", "/specialDisease/getUserInfo", "/monitor/payTask/handCloseOrder", "/newApp/login/**", "/system/hospitalPerson/**", "/evaluate/**", "/webSocket/**").permitAll()
.antMatchers(antMatchers.split(",")).permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()

View File

@ -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);
}
}
}

View File

@ -172,7 +172,7 @@ public class PatientCenterController extends BaseController {
throw new ServiceException(bindingResult.getAllErrors().get(0).getDefaultMessage());
}
if (Objects.isNull(goodsOrder.getIntegralExchangeSill()) || goodsOrder.getIntegralExchangeSill() <= 0) {
return AjaxResult.error("当前积分数值不足,无法兑换!");
return AjaxResult.error("当前健康豆数值不足,无法兑换!");
}
if (Objects.isNull(goodsOrder.getIntegralExchangeCount()) || goodsOrder.getIntegralExchangeCount() <= 0) {
return AjaxResult.error("兑换商品数量不正确,无法兑换!");

View File

@ -44,7 +44,7 @@ public interface NurseAppLoginService {
* @param patientId 会员id
* @return 结果
*/
AjaxResult nurseAppPersonal(Long patientId);
AjaxResult nurseAppPersonal(Long patientId, String region);
/**
* App查询预约服务订单

View File

@ -13,6 +13,7 @@ import com.xinelu.applet.vo.nurseapplogin.PatientAndDiseaseVO;
import com.xinelu.applet.vo.nursepersonapplogin.OrderAndItemVO;
import com.xinelu.applet.vo.specialdisease.WeekDaysVO;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.enums.AppointmentTimeIntervalEnum;
import com.xinelu.common.enums.ConfirmRefundStatusEnum;
import com.xinelu.common.enums.GooodsOrderStatusEnum;
@ -20,6 +21,7 @@ import com.xinelu.common.enums.OrderStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.common.utils.http.HttpService;
import com.xinelu.common.utils.http.HttpUtils;
import com.xinelu.common.utils.spring.SpringUtils;
import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
@ -180,7 +182,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 +207,7 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
} else {
patientDisease.setAreaName("");
}
patientDisease.setCityCode(region);
// 更新签约编号
setSignInfo(patientDisease);
//查询所有商品订单
@ -219,6 +222,7 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
patientDisease.setWaitPayCount(waitPayCount);
patientDisease.setWaitReceivedGoodsCount(waitReceivedGoodsCount);
patientDisease.setReceivedGoodsCount(receivedGoodsCount);
return AjaxResult.success(patientDisease);
}
@ -234,6 +238,10 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
JSONObject signInfo = jsonObject.getJSONObject("data");
if (signInfo.containsKey("signNo")) {
signNo = signInfo.getString("signNo");
// 查询居民健康积分
getResidentScore(patientDisease);
}
} else {
signNo = null;
@ -250,6 +258,17 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
}
}
// 查询居民健康积分
private void getResidentScore(PatientAndDiseaseVO patientDisease) {
String result = HttpUtils.sendGet(SpringUtils.getFdUrl(patientDisease.getCityCode()) + "/patient/score/record/total/" + patientDisease.getCardNo());
JSONObject jsonObject = JSONObject.parseObject(result);
if (!jsonObject.get("code").toString().equals("1")) {
log.error("查询居民健康积分出错:{}", jsonObject.get("msg").toString());
} else {
patientDisease.setScore(jsonObject.getString("data"));
}
}
/**
* App查询预约服务订单
*
@ -287,4 +306,4 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
}
return AjaxResult.success();
}
}
}

View File

@ -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<PatientOrder> data = resultHttp.getData();
data.forEach(item -> item.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo()));
List<PatientOrder> 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<PatientOrder> 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<PatientOrder> data = resultHttp.getData();
data.forEach(item -> item.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo()));
List<PatientOrder> 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<PatientOrder> 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;
}
}
}

View File

@ -302,29 +302,29 @@ public class PatientCenterServiceImpl implements PatientCenterService {
GoodsAttributeDetails goodsAttributeDetails = nursingStationGoodsMapper.selectGoodsAttributeDetailsGoodsStockById(goodsOrder.getGoodsAttributeDetailsId());
//判断当前商品是否可兑换商品
if (Objects.nonNull(goodsAttributeDetails) && CouponAndIntegralFlagEnum.NOT_CONVERTIBLE.getInfo().equals(goodsAttributeDetails.getIntegralExchangeFlag())) {
return AjaxResult.error("当前商品非积分兑换商品,无法兑换!");
return AjaxResult.error("当前商品非健康豆兑换商品,无法兑换!");
}
//判断积分兑换数值是否正确
boolean integralExchangeSill = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeSill());
boolean equalIntegralExchangeSill = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeSill().equals(goodsAttributeDetails.getIntegralExchangeSill());
if (BooleanUtils.isTrue(integralExchangeSill) || BooleanUtils.isTrue(equalIntegralExchangeSill)) {
return AjaxResult.error("当前商品兑换需要使用的积分数值不正确,无法兑换!");
return AjaxResult.error("当前商品兑换需要使用的健康豆数量不正确,无法兑换!");
}
//判断积分兑换商品数目是否正确
boolean integralExchangeCount = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeCount());
boolean equalIntegralExchangeCount = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeCount().equals(goodsAttributeDetails.getIntegralExchangeCount());
if (BooleanUtils.isTrue(integralExchangeCount) || BooleanUtils.isTrue(equalIntegralExchangeCount)) {
return AjaxResult.error("当前积分兑换商品的数量不正确,无法兑换!");
return AjaxResult.error("当前健康豆兑换商品的数量不正确,无法兑换!");
}
//判断库存是否充足
if (Objects.isNull(goodsAttributeDetails.getGoodsStock()) || goodsAttributeDetails.getGoodsStock() == 0) {
return AjaxResult.error("当前商品库存不足,无法购买");
return AjaxResult.error("当前商品库存不足,无法兑换");
}
//判读用户账户积分是否充足
AtomicInteger patientIntegral = new AtomicInteger(Objects.isNull(patientInfo.getIntegral()) ? 0 : patientInfo.getIntegral());
AtomicInteger exchangeIntegralSkill = new AtomicInteger(Objects.isNull(goodsOrder.getIntegralExchangeSill()) ? 0 : goodsOrder.getIntegralExchangeSill());
if (patientIntegral.get() < exchangeIntegralSkill.get()) {
return AjaxResult.error("当前用户的账户积分数值不足,无法兑换!");
return AjaxResult.error("当前用户的健康豆数目值不足,无法兑换!");
}
//判断商品库存数量是否满足兑换数量
AtomicInteger goodsStock = new AtomicInteger(goodsAttributeDetails.getGoodsStock());

View File

@ -140,6 +140,7 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
resultMap.put("message", "通知验签失败");
return JSON.toJSONString(resultMap);
}
log.info(accountFlag + "微信通知的请求体信息 ===> {}", body);
String nonce = request.getHeader("Wechatpay-Nonce");
String timestamp = request.getHeader("Wechatpay-Timestamp");
String signature = request.getHeader("Wechatpay-Signature");
@ -147,7 +148,12 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
NotificationRequest notificationRequest = new NotificationRequest.Builder().withSerialNumber(serialNo)
.withNonce(nonce).withTimestamp(timestamp).withSignature(signature).withBody(body).build();
NotificationHandler handler = new NotificationHandler(xylVerifier, xylWeChatPaymentConfig.getXylPaymentKey().getBytes(StandardCharsets.UTF_8));
Notification notification = handler.parse(notificationRequest);
Notification notification = null;
try {
notification = handler.parse(notificationRequest);
} catch (Exception e) {
log.warn("微信支付回调异常,异常信息为:{}", e.getMessage());
}
if (Objects.isNull(notification)) {
log.error(accountFlag + "微信通知验签失败,请求体 ====> {}", body);
response.setStatus(500);

View File

@ -395,12 +395,12 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
patientIntegralChange.setChangeIntegral(stockIntegralNum);
patientIntegralChange.setChangeTime(LocalDateTime.now());
patientIntegralChange.setChangeType(IntegralChangeType.COMMODITY_EXCHANGE.getInfo());
patientIntegralChange.setChangeRemark("积分兑换商品订单新增积分变更");
patientIntegralChange.setChangeRemark("健康豆兑换商品订单新增健康豆变更");
patientIntegralChange.setChangeIntegralChannel(StringUtils.isBlank(goodsOrderInfo.getOrderChannel()) ? "" : goodsOrderInfo.getOrderChannel());
patientIntegralChange.setCreateTime(LocalDateTime.now());
int integralChange = patientIntegralChangeMapper.insertPatientIntegralChange(patientIntegralChange);
if (integralChange <= 0) {
log.error("积分兑换商品-生成积分变更记录表信息失败,积分变更信息:{}", integralChange);
log.error("健康豆兑换商品-生成健康豆变更记录表信息失败,健康豆变更信息:{}", integralChange);
throw new ServiceException("确认退款失败,请联系管理员!");
}
return AjaxResult.success();

View File

@ -172,4 +172,10 @@ public class PatientAndDiseaseVO implements Serializable {
* 基础疾病信息
*/
private Integer[] diseaseList;
/**
* 居民健康行为积分-总分
*/
private String score;
}

View File

@ -64,5 +64,6 @@ public class MessageSearchDto {
@ApiModelProperty(value = "通知适用人群编号集合")
private List<String> crowdNoList;
@ApiModelProperty("城市编码(1德州 2东营)")
private String cityCode;
}

View File

@ -76,7 +76,7 @@ public interface ChatRecordMapper {
*/
int deleteChatRecordByIds(Long[] ids);
Integer updateReadStatus(MarkReadDto markReadDto);
Integer updateReadStatus(ChatRecord chatRecord);
int deleteMegs(@Param("ids") List<Long> ids);

View File

@ -25,6 +25,7 @@ import com.xinelu.manage.dto.chatrecord.MessageSearchDto;
import com.xinelu.manage.mapper.chatrecord.ChatRecordMapper;
import com.xinelu.manage.service.chatrecord.IChatRecordService;
import com.xinelu.manage.service.chatrecordread.IChatRecordReadService;
import com.xinelu.manage.service.chatrecordread.IChatRecordReadService;
import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import com.xinelu.manage.vo.chatrecord.MessageCenterVo;
import com.xinelu.manage.vo.chatrecord.MessageVo;
@ -59,6 +60,8 @@ public class ChatRecordServiceImpl implements IChatRecordService {
@Resource
private IChatRecordReadService chatRecordReadService;
@Resource
private IPatientInfoService patientInfoService;
@Resource
private HttpService httpService;
/**

View File

@ -85,4 +85,14 @@ public class AppointmentOrderVO implements Serializable {
* 订单类型院内陪护COMPANION_IN_HOSPITAL其它OTHER
*/
private String orderType;
/**
* 住址经度
*/
private String homeLongitude;
/**
* 住址纬度
*/
private String homeLatitude;
}

View File

@ -154,6 +154,8 @@
ao.order_check_status,
ao.order_type,
pi.patient_name,
pi.home_longitude,
pi.home_latitude,
nsp.nurse_person_name,
aod.id detailsId,
aod.order_no,

View File

@ -357,17 +357,17 @@
</if>
</update>
<update id="updateReadStatus" parameterType="com.xinelu.manage.dto.chatrecord.MarkReadDto">
<update id="updateReadStatus" parameterType="ChatRecord">
update chat_record
<trim prefix="SET" suffixOverrides=",">
<if test="readStatus != null and readStatus != ''">
read_status = =#{readStatus},
read_status = #{readStatus},
</if>
<if test="readTime != null">
read_time = #{readTime},
</if>
</trim>
where del_flag = 0 and read_status = '0' and recipient_id = #{recipientId}
where del_flag = 0 and read_status = '0' and consultation_id = #{consultationId} and recipient_id = #{recipientId}
</update>
<!-- 更新通知 -->

View File

@ -367,6 +367,7 @@
<select id="getCouponReceiveByReceiveSource" resultType="java.lang.Integer">
select
count(1)
from patient_coupon_receive
where
patient_id = #{patientId}
and receive_source = #{receiveSource}