| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.SaasClientPayMapper; |
| | | import com.kidgrow.oprationcenter.model.SaasClientPay; |
| | | import com.kidgrow.oprationcenter.service.ISaasClientPayService; |
| | | import com.kidgrow.oprationcenter.vo.SaasClientPayExcel; |
| | | import com.kidgrow.oprationcenter.vo.SaasClientPayVo; |
| | | //import com.kidgrow.recordcenter.feign.ChildService; |
| | | import com.kidgrow.usercenter.feign.SysDoctorService; |
| | | import com.kidgrow.usercenter.model.SysDoctor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanCopier; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Autowired |
| | | private SysDoctorService sysDoctorService; |
| | | // @Autowired |
| | | // private ChildService childService; |
| | | @Override |
| | | public PageResult<SaasClientPay> findList(Map<String, Object> params){ |
| | | public PageResult<SaasClientPayVo> findList(Map<String, Object> params){ |
| | | Long doctorId = MapUtils.getLong(params, "doctorId"); |
| | | if (doctorId!=null) { |
| | | ResultBody byId = sysDoctorService.findById(doctorId); |
| | | if (byId.getCode()==0) { |
| | | Object data = byId.getData(); |
| | | SysDoctor sysDoctor = JSON.parseObject(JSON.toJSONString(data), SysDoctor.class); |
| | | if (sysDoctor!=null) { |
| | | params.put("createUserId",sysDoctor.getUserId()); |
| | | } |
| | | } |
| | | params.remove("doctorId"); |
| | | } |
| | | Page<SaasClientPay> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<SaasClientPay> list = baseMapper.findList(page, params); |
| | | return PageResult.<SaasClientPay>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | List<SaasClientPayVo> listVo=null; |
| | | if (!list.isEmpty()) { |
| | | listVo=new ArrayList<>(); |
| | | for (SaasClientPay saasClientPay : list) { |
| | | SaasClientPayVo vo=new SaasClientPayVo(); |
| | | BeanCopier beanCopier = BeanCopier.create(SaasClientPay.class, SaasClientPayVo.class, false); |
| | | beanCopier.copy(saasClientPay,vo,null); |
| | | double v = Double.parseDouble(vo.getPayPrice().toString())/100; |
| | | vo.setPrice(v+""); |
| | | // if (StringUtils.isNotBlank(vo.getChildId())) { |
| | | // Map<String,Object> map=new HashMap<>(); |
| | | // map.put("id",vo.getChildId()); |
| | | // ResultBody byId = childService.findById(map); |
| | | // if(byId.getCode()==0){ |
| | | // Child parse = JSON.parseObject(JSON.toJSONString(byId.getData()), Child.class); |
| | | // if(parse!=null){ |
| | | // vo.setChildName(parse.getChildName()); |
| | | // vo.setChildSex(parse.getChildSex()); |
| | | // vo.setChildBirthday(parse.getChildBirthday()); |
| | | // } |
| | | // } |
| | | // } |
| | | listVo.add(vo); |
| | | } |
| | | } |
| | | return PageResult.<SaasClientPayVo>builder().data(listVo).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | |
| | | public SaasClientPay findByObject(SaasClientPay saasClientPay){ |
| | | return baseMapper.findByObject(saasClientPay); |
| | | } |
| | | |
| | | /** |
| | | * 查看一个科室的某个诊断的支付状态 |
| | | * @param hospitalId |
| | | * @param departmentId |
| | | * @param diaId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SaasClientPay findModelByObject(Long hospitalId,Long departmentId,String diaId) { |
| | | SaasClientPay saasClientPay = new SaasClientPay(); |
| | | saasClientPay.setCreateHospitalDepartid(departmentId.toString()); |
| | | saasClientPay.setCreateHospitalId(hospitalId); |
| | | saasClientPay.setDiaId(diaId); |
| | | return baseMapper.findByObject(saasClientPay); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTypeList(List<String> list) { |
| | | for (String s : list) { |
| | | SaasClientPay saasClientPay = this.baseMapper.selectById(s); |
| | | if(saasClientPay!=null){ |
| | | saasClientPay.setType(true); |
| | | this.saveOrUpdate(saasClientPay); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<SaasClientPayExcel> export(Map<String, Object> params) { |
| | | List<SaasClientPay> list = baseMapper.findList(new Page<>(1, -1), params); |
| | | List<SaasClientPayExcel> listVo=null; |
| | | if (!list.isEmpty()) { |
| | | listVo=new ArrayList<>(); |
| | | for (SaasClientPay saasClientPay : list) { |
| | | SaasClientPayExcel vo=new SaasClientPayExcel(); |
| | | BeanCopier beanCopier = BeanCopier.create(SaasClientPay.class, SaasClientPayExcel.class, false); |
| | | beanCopier.copy(saasClientPay,vo,null); |
| | | Double v = Double.parseDouble(saasClientPay.getPayPrice().toString())/100; |
| | | vo.setPayPrice(v); |
| | | Double vc = Double.parseDouble(saasClientPay.getPayCustom().toString())/100; |
| | | vo.setPayCustom(vc); |
| | | Double vk = Double.parseDouble(saasClientPay.getPayKidgrow().toString())/100; |
| | | vo.setPayKidgrow(vk); |
| | | // if (StringUtils.isNotBlank(saasClientPay.getChildId())) { |
| | | // Map<String,Object> map=new HashMap<>(); |
| | | // map.put("id",saasClientPay.getChildId()); |
| | | // ResultBody byId = childService.findById(map); |
| | | // if(byId.getCode()==0){ |
| | | // Child parse = JSON.parseObject(JSON.toJSONString(byId.getData()), Child.class); |
| | | // if(parse!=null){ |
| | | // vo.setChildName(parse.getChildName()); |
| | | // vo.setChildSex(parse.getChildSex()); |
| | | // vo.setChildBirthday(parse.getChildBirthday()); |
| | | // } |
| | | // } |
| | | // } |
| | | listVo.add(vo); |
| | | } |
| | | } |
| | | return listVo; |
| | | } |
| | | } |