|
|
@@ -4,29 +4,31 @@ import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.core.config.WxMaConfiguration;
|
|
|
-import com.fs.course.domain.FsCourseRedPacketLog;
|
|
|
-import com.fs.his.domain.FsDoctor;
|
|
|
-import com.fs.his.domain.FsProject;
|
|
|
-import com.fs.his.domain.FsUser;
|
|
|
-import com.fs.his.domain.FsUserWx;
|
|
|
+import com.fs.his.domain.*;
|
|
|
+import com.fs.his.mapper.FsProjectRedDetailMapper;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
import com.fs.his.param.FsPatientBaseInfoListDParam;
|
|
|
+import com.fs.his.param.ProjectRedParam;
|
|
|
import com.fs.his.param.WxSendRedPacketParam;
|
|
|
import com.fs.his.service.IFsDoctorService;
|
|
|
import com.fs.his.service.IFsProjectService;
|
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
|
import com.fs.his.service.IFsUserWxService;
|
|
|
+import com.fs.his.utils.PhoneUtil;
|
|
|
import com.fs.his.vo.FsPatientBaseInfoListDVO;
|
|
|
import com.fs.patient.domain.FsProjectRedPacketRecord;
|
|
|
import com.fs.patient.mapper.FsProjectRedPacketRecordMapper;
|
|
|
@@ -46,6 +48,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.fs.patient.mapper.FsPatientBaseInfoMapper;
|
|
|
import com.fs.patient.domain.FsPatientBaseInfo;
|
|
|
import com.fs.patient.service.IFsPatientBaseInfoService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
/**
|
|
|
@@ -58,6 +61,11 @@ import org.springframework.util.ObjectUtils;
|
|
|
@Service
|
|
|
public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoMapper, FsPatientBaseInfo> implements IFsPatientBaseInfoService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsProjectRedDetailMapper projectRedDetailMapper;
|
|
|
@Autowired
|
|
|
private CompanyUserMapper companyUserMapper;
|
|
|
|
|
|
@@ -172,12 +180,86 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
|
|
|
return baseMapper.deleteFsPatientBaseInfoById(id);
|
|
|
}
|
|
|
|
|
|
+// @Override
|
|
|
+// public R getWxaCodePatientBaseInfoUnLimit(Long patientId,String appId) {
|
|
|
+// log.info("生成用患者信息二维码,请求参数:{},{}",patientId,appId);
|
|
|
+//
|
|
|
+// final WxMaService wxMaService = WxMaConfiguration.getMaService(appId);
|
|
|
+// String scene="patientId="+ patientId ;
|
|
|
+// byte[] file;
|
|
|
+// try {
|
|
|
+// file = wxMaService.getQrcodeService().createWxaCodeUnlimitBytes(
|
|
|
+// scene,
|
|
|
+// "pages_user/healthRegimen",
|
|
|
+// true,
|
|
|
+// "release",//release trial
|
|
|
+// 430,
|
|
|
+// true,
|
|
|
+// null,
|
|
|
+// false);
|
|
|
+//
|
|
|
+// // 上传图片到存储桶
|
|
|
+// String suffix = ".png";
|
|
|
+// CloudStorageService storage = OSSFactory.build();
|
|
|
+// String url;
|
|
|
+// try {
|
|
|
+// url = storage.uploadSuffix(file, suffix);
|
|
|
+// } catch (Exception e) {
|
|
|
+// // 记录错误日志
|
|
|
+// log.error("生成图片失败:{}",e.getMessage(),e);
|
|
|
+// return R.error("生成图片失败");
|
|
|
+// }
|
|
|
+// // 返回成功信息
|
|
|
+// return R.ok().put("url",url);
|
|
|
+//
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// log.error(e.getMessage(), e);
|
|
|
+// return R.error("微信接口调用失败: " + e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R getWxaCodePatientBaseInfoUnLimit(Long patientId,String appId) {
|
|
|
log.info("生成用患者信息二维码,请求参数:{},{}",patientId,appId);
|
|
|
+ String baseInfoKey = null;
|
|
|
+ FsPatientBaseInfo baseInfo = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(patientId);
|
|
|
+ if (baseInfo == null) {
|
|
|
+ return R.error("未找到患者基础信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (baseInfo.getUserId() == null) {
|
|
|
+ baseInfoKey = IdUtil.getSnowflake(0,0).nextIdStr();
|
|
|
+ FsProjectRedDetail detail = new FsProjectRedDetail();
|
|
|
+ detail.setProjectId(baseInfo.getProjectId());
|
|
|
+ detail.setCompanyUserId(baseInfo.getCompanyUserId());
|
|
|
+ detail.setCreateTime(new Date());
|
|
|
+ detail.setSendTime(new Date());
|
|
|
+ detail.setSource("小程序");
|
|
|
+ detail.setStatus(0);
|
|
|
+ //存入缓存
|
|
|
+ redisCache.setCacheObject(baseInfoKey,detail,24, TimeUnit.HOURS);
|
|
|
+ } else {
|
|
|
+ ProjectRedParam param = new ProjectRedParam();
|
|
|
+ param.setProjectId(baseInfo.getProjectId());
|
|
|
+ param.setCompanyUserId(baseInfo.getCompanyUserId());
|
|
|
+ param.setUserId(baseInfo.getUserId());
|
|
|
+ FsProjectRedDetail detail = projectRedDetailMapper.selectFsProjectRedDetailDataByCompanyUserIdAndProjectId(param);
|
|
|
+ if (detail == null) {
|
|
|
+ detail = new FsProjectRedDetail();
|
|
|
+ detail.setProjectId(baseInfo.getProjectId());
|
|
|
+ detail.setCompanyUserId(baseInfo.getCompanyUserId());
|
|
|
+ detail.setUserId(baseInfo.getUserId());
|
|
|
+ detail.setSendTime(new Date());
|
|
|
+ detail.setCreateTime(new Date());
|
|
|
+ detail.setSource("小程序");
|
|
|
+ detail.setStatus(0);
|
|
|
+ projectRedDetailMapper.insertFsProjectRedDetail(detail);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
final WxMaService wxMaService = WxMaConfiguration.getMaService(appId);
|
|
|
- String scene="patientId="+ patientId ;
|
|
|
+ String scene=patientId + "&" +baseInfoKey;
|
|
|
byte[] file;
|
|
|
try {
|
|
|
file = wxMaService.getQrcodeService().createWxaCodeUnlimitBytes(
|
|
|
@@ -310,10 +392,6 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
|
|
|
if (info == null) {
|
|
|
return R.error("患者信息错误,诊断失败");
|
|
|
}
|
|
|
- if (info.getDoctorStatus() == 1) {
|
|
|
- return R.error("患者信息已诊断");
|
|
|
- }
|
|
|
-
|
|
|
FsPatientBaseInfo map = new FsPatientBaseInfo();
|
|
|
map.setId(info.getId());
|
|
|
map.setDoctorStatus(1);
|
|
|
@@ -323,6 +401,7 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
|
|
|
map.setDiagnosisTime(new Date());
|
|
|
map.setDiagnosisResult(param.getDiagnosisResult());
|
|
|
map.setTreatmentTarget(param.getTreatmentTarget());
|
|
|
+ map.setCheckStatus(0);
|
|
|
int i = fsPatientBaseInfoMapper.updateFsPatientBaseInfo(map);
|
|
|
if (i > 0) {
|
|
|
return R.ok();
|
|
|
@@ -387,6 +466,23 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
|
|
|
return fsPatientBaseInfoMapper.updateFsPatientBaseInfo(map);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int check(FsPatientBaseInfo param) {
|
|
|
+ if (param.getId() == null || param.getId() <= 0) {
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
+ FsPatientBaseInfo fsPatientBaseInfo = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(param.getId());
|
|
|
+ if (fsPatientBaseInfo == null) {
|
|
|
+ throw new CustomException("未找到患者基础信息");
|
|
|
+ }
|
|
|
+ FsPatientBaseInfo map = new FsPatientBaseInfo();
|
|
|
+ map.setId(param.getId());
|
|
|
+ map.setCheckStatus(param.getCheckStatus());
|
|
|
+ map.setCheckTime(new Date());
|
|
|
+ map.setReason(param.getReason());
|
|
|
+ return fsPatientBaseInfoMapper.updateFsPatientBaseInfo(map);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private R sendProjectRedPacket(FsProjectSendRewardUParam param,FsUser user,CompanyUser companyUser){
|
|
|
//默认0.1红包数据
|