小程序个人中心代码移植
This commit is contained in:
parent
0c1b72c9a5
commit
d1c73e30d5
@ -65,5 +65,20 @@ public class NurseAppLoginController extends BaseController {
|
||||
}
|
||||
return nurseAppLoginService.getAppStationItemAndConsumableInfo(itemInfoDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP个人中心查询
|
||||
*
|
||||
* @param patientId 用户编号id
|
||||
* @return 结果
|
||||
*/
|
||||
@MobileRequestAuthorization
|
||||
@GetMapping("/appPersonal")
|
||||
public AjaxResult nurseAppPersonal(Long patientId) {
|
||||
if (Objects.isNull(patientId)) {
|
||||
return AjaxResult.error("用户信息不能为空!");
|
||||
}
|
||||
return nurseAppLoginService.nurseAppPersonal(patientId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.applet.mapper.nurseapplogin;
|
||||
|
||||
|
||||
import com.xinelu.applet.vo.nurseapplogin.PatientAndDiseaseVO;
|
||||
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -28,4 +29,12 @@ public interface NurseAppLoginMapper {
|
||||
* @return 数量
|
||||
*/
|
||||
Integer getLoginFlagByPatientId(@Param("patientId") Long patientId);
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户所有订单
|
||||
*
|
||||
* @param patientId id
|
||||
* @return GoodsOrder
|
||||
*/
|
||||
List<GoodsOrder> selectGoodsOrderListByPatient(Long patientId);
|
||||
}
|
||||
|
||||
@ -25,4 +25,12 @@ public interface NurseAppLoginService {
|
||||
* @return 护理项目信息集合
|
||||
*/
|
||||
AjaxResult getAppStationItemAndConsumableInfo(StationItemInfoDTO itemInfoDTO);
|
||||
|
||||
/**
|
||||
* 个人中心
|
||||
*
|
||||
* @param patientId 会员id
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult nurseAppPersonal(Long patientId);
|
||||
}
|
||||
|
||||
@ -11,6 +11,9 @@ import com.xinelu.applet.vo.nurseapplogin.PatientAndDiseaseVO;
|
||||
import com.xinelu.applet.vo.specialdisease.WeekDaysVO;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.AppointmentTimeIntervalEnum;
|
||||
import com.xinelu.common.enums.GooodsOrderStatusEnum;
|
||||
import com.xinelu.common.utils.AgeUtil;
|
||||
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
|
||||
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
|
||||
import com.xinelu.manage.vo.sysarea.SysAreaVO;
|
||||
import com.xinelu.system.domain.SysConfig;
|
||||
@ -138,4 +141,43 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
|
||||
itemInfo.setAppointmentTimeList(appointmentTimeList);
|
||||
return AjaxResult.success(itemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心查询
|
||||
*
|
||||
* @param patientId 会员id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult nurseAppPersonal(Long patientId) {
|
||||
PatientAndDiseaseVO patientDisease = nurseAppLoginMapper.getPatientDiseaseByPatientId(patientId);
|
||||
if (Objects.nonNull(patientDisease) && Objects.nonNull(patientDisease.getBirthDate())) {
|
||||
patientDisease.setAge(AgeUtil.getAgeMonth(String.valueOf(patientDisease.getBirthDate())));
|
||||
}
|
||||
if (Objects.nonNull(patientDisease) && StringUtils.isNotBlank(patientDisease.getAreaCode())) {
|
||||
SysAreaVO codeName = sysAreaMapper.getSubordinateRegionsFindSuperiorRegions(patientDisease.getAreaCode());
|
||||
String provinceName = StringUtils.isBlank(codeName.getProvinceName()) ? "" : codeName.getProvinceName();
|
||||
String cityName = StringUtils.isBlank(codeName.getCityName()) ? "" : codeName.getCityName();
|
||||
String regionName = StringUtils.isBlank(codeName.getRegionName()) ? "" : codeName.getRegionName();
|
||||
String streetName = StringUtils.isBlank(codeName.getStreetName()) ? "" : codeName.getStreetName();
|
||||
patientDisease.setAreaName(provinceName + cityName + regionName + streetName);
|
||||
} else {
|
||||
patientDisease.setAreaName("");
|
||||
}
|
||||
//查询所有商品订单
|
||||
List<GoodsOrder> goodsOrders = nurseAppLoginMapper.selectGoodsOrderListByPatient(patientId);
|
||||
if (CollectionUtils.isEmpty(goodsOrders)) {
|
||||
return AjaxResult.success(patientDisease);
|
||||
}
|
||||
//计算待付款订单、待收货订单、待评价订单、已完成订单数量
|
||||
long waitPayCount = goodsOrders.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getOrderStatus())).filter(item -> GooodsOrderStatusEnum.WAIT_PAY.getInfo().equals(item.getOrderStatus())).count();
|
||||
long waitReceivedGoodsCount = goodsOrders.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getOrderStatus())).filter(item -> GooodsOrderStatusEnum.WAIT_RECEIVED_GOODS.getInfo().equals(item.getOrderStatus())).count();
|
||||
long receivedGoodsCount = goodsOrders.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getOrderStatus())).filter(item -> GooodsOrderStatusEnum.RECEIVED_GOODS.getInfo().equals(item.getOrderStatus())).count();
|
||||
long evaluatedCount = goodsOrders.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getOrderStatus())).filter(item -> GooodsOrderStatusEnum.EVALUATED.getInfo().equals(item.getOrderStatus())).count();
|
||||
patientDisease.setWaitPayCount(waitPayCount);
|
||||
patientDisease.setWaitReceivedGoodsCount(waitReceivedGoodsCount);
|
||||
patientDisease.setReceivedGoodsCount(receivedGoodsCount);
|
||||
patientDisease.setEvaluatedCount(evaluatedCount);
|
||||
return AjaxResult.success(patientDisease);
|
||||
}
|
||||
}
|
||||
@ -75,4 +75,15 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGoodsOrderListByPatient" resultType="com.xinelu.manage.domain.goodsOrder.GoodsOrder">
|
||||
select id,
|
||||
order_status
|
||||
from goods_order
|
||||
<where>
|
||||
<if test="patientId != null">
|
||||
patient_id = #{patientId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user