|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
@@ -13,14 +14,8 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.http.HttpClientUtils;
|
|
|
import com.ruoyi.common.utils.http.HttpUtils;
|
|
|
-import com.ruoyi.system.domain.OdsQssHsjcxx;
|
|
|
-import com.ruoyi.system.domain.UserInfo;
|
|
|
-import com.ruoyi.system.domain.UserInfoOne;
|
|
|
-import com.ruoyi.system.domain.UserNucleicTime;
|
|
|
-import com.ruoyi.system.mapper.SysDictTypeMapper;
|
|
|
-import com.ruoyi.system.mapper.UserInfoMapper;
|
|
|
-import com.ruoyi.system.mapper.UserInfoOneMapper;
|
|
|
-import com.ruoyi.system.mapper.UserNucleicTimeMapper;
|
|
|
+import com.ruoyi.system.domain.*;
|
|
|
+import com.ruoyi.system.mapper.*;
|
|
|
import com.ruoyi.system.service.IUserInfoService;
|
|
|
import com.ruoyi.system.service.OdsQssHsjcxxService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -28,6 +23,7 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.text.ParseException;
|
|
@@ -52,6 +48,8 @@ public class UserInfoServiceImpl implements IUserInfoService {
|
|
|
private UserNucleicTimeMapper userNucleicTimeMapper;
|
|
|
@Autowired
|
|
|
private UserInfoOneMapper userInfoOneMapper;
|
|
|
+ @Autowired
|
|
|
+ private KeyPeopleInfoMapper keyPeopleInfoMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询导入人员信息
|
|
@@ -124,6 +122,180 @@ public class UserInfoServiceImpl implements IUserInfoService {
|
|
|
return userInfoMapper.deleteUserInfoById(id);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Async
|
|
|
+ public String date(UserInfo userInfoP) throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println("接口开始========");
|
|
|
+ long start1 = System.currentTimeMillis();
|
|
|
+
|
|
|
+
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ //获取人员信息
|
|
|
+ KeyPeopleInfo keyPeopleInfo = new KeyPeopleInfo();
|
|
|
+ keyPeopleInfo.setDeptId(user.getDeptId().toString());
|
|
|
+ List<KeyPeopleInfo> keyPeopleInfoList = keyPeopleInfoMapper.selectKeyPeopleInfoList(keyPeopleInfo);
|
|
|
+
|
|
|
+ String startTime = userInfoP.getStartTime();
|
|
|
+ String endTime = userInfoP.getEndTime();
|
|
|
+ String detectionNumber = userInfoP.getDetectionNumber();
|
|
|
+
|
|
|
+ //计算开始时间结束时间相隔天数
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = simpleDateFormat.parse(startTime);
|
|
|
+ Date date2 = simpleDateFormat.parse(endTime);
|
|
|
+ String detectionScope = String.valueOf(DateUtils.differentDaysByMillisecond(date1, date2));
|
|
|
+ userInfoP.setDetectionScope(detectionScope);
|
|
|
+
|
|
|
+ List<String> idCardList = keyPeopleInfoList.stream().map(KeyPeopleInfo::getIdCard).collect(Collectors.toList());
|
|
|
+ //从第三方数据库查询人员核酸计录
|
|
|
+ List<OdsQssHsjcxx> OdsQssHsjcxxList = qdsQssHsjcxxService.thirdNucleicAcid(startTime, endTime, idCardList);
|
|
|
+
|
|
|
+ Map<String, List<OdsQssHsjcxx>> OdsQssHsjcxxMapSorted = new HashMap<>();
|
|
|
+ if (OdsQssHsjcxxList != null && OdsQssHsjcxxList.size() > 0) {
|
|
|
+ OdsQssHsjcxxMapSorted = OdsQssHsjcxxList.stream().sorted(Comparator.comparing(OdsQssHsjcxx::getCjsj).reversed()).collect(Collectors.groupingBy(OdsQssHsjcxx::getSfzhm));
|
|
|
+ }
|
|
|
+ //把采集时间降序
|
|
|
+ List<UserNucleicTime> UserNucleicTimeList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ int count = 0;
|
|
|
+ List<UserInfo> userList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (KeyPeopleInfo peopleInfo : keyPeopleInfoList) {
|
|
|
+ UserInfo userInfo = new UserInfo();
|
|
|
+ userInfo.setDeptId(user.getDeptId().toString());
|
|
|
+ userInfo.setPhoneNum(peopleInfo.getPhoneNum());
|
|
|
+ userInfo.setName(peopleInfo.getName());
|
|
|
+ userInfo.setIdCard(peopleInfo.getIdCard());
|
|
|
+
|
|
|
+ //采集地点
|
|
|
+ StringBuilder collectPlace = new StringBuilder();
|
|
|
+ //核酸采集时间
|
|
|
+ StringBuilder nucleicCollectTime = new StringBuilder();
|
|
|
+ //核酸结果时间
|
|
|
+ StringBuilder nucleicResultsTime = new StringBuilder();
|
|
|
+ //核酸结果
|
|
|
+ StringBuilder nucleicResults = new StringBuilder();
|
|
|
+
|
|
|
+
|
|
|
+ userInfo.setJobStyle(userInfoP.getJobStyle());
|
|
|
+ userInfo.setFocusCrowdStyle(userInfoP.getFocusCrowdStyle());
|
|
|
+ userInfo.setDetectionFrequency(detectionNumber + "/" + detectionScope);
|
|
|
+ userInfo.setDetectionNumber(detectionNumber);
|
|
|
+ userInfo.setDetectionScope(detectionScope);
|
|
|
+ userInfo.setStartTime(startTime);
|
|
|
+ userInfo.setEndTime(endTime);
|
|
|
+ //判断结果是否合格,默认合格
|
|
|
+ Boolean bl = true;
|
|
|
+
|
|
|
+ index = 0;
|
|
|
+ count = 0;
|
|
|
+ String PhoneNum = "";
|
|
|
+ if (OdsQssHsjcxxMapSorted.size() > 0) {
|
|
|
+ //身份证号码
|
|
|
+ String idCard = userInfo.getIdCard();
|
|
|
+ List<OdsQssHsjcxx> odsQssHsjcxxes = OdsQssHsjcxxMapSorted.get(idCard);
|
|
|
+ if (odsQssHsjcxxes != null && odsQssHsjcxxes.size() > 0) {
|
|
|
+ //String time = null;
|
|
|
+
|
|
|
+ for (OdsQssHsjcxx odsQssHsjcxx : odsQssHsjcxxes) {
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(PhoneNum)){
|
|
|
+ PhoneNum = odsQssHsjcxx.getSjhm();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(collectPlace.toString())) {
|
|
|
+ collectPlace.append("<br>");
|
|
|
+ }
|
|
|
+ collectPlace.append(odsQssHsjcxx.getJcdd());
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
|
|
|
+ nucleicCollectTime.append("<br>");
|
|
|
+ }
|
|
|
+ nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
|
|
|
+ nucleicResultsTime.append("<br>");
|
|
|
+ }
|
|
|
+ nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(nucleicResults.toString())) {
|
|
|
+ nucleicResults.append("<br>");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(odsQssHsjcxx.getJcjg())){
|
|
|
+ nucleicResults.append(odsQssHsjcxx.getJcjg());
|
|
|
+ }else if("0".equals(odsQssHsjcxx.getJcjg()) || "negative".equals(odsQssHsjcxx.getJcjg())){
|
|
|
+ nucleicResults.append("阴性");
|
|
|
+ }else if("1".equals(odsQssHsjcxx.getJcjg()) || "positive".equals(odsQssHsjcxx.getJcjg())){
|
|
|
+ nucleicResults.append("阳性");
|
|
|
+ }else{
|
|
|
+ nucleicResults.append(odsQssHsjcxx.getJcjg());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ index = odsQssHsjcxxes.size();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ if (index < Integer.parseInt(detectionNumber)) {
|
|
|
+ bl = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ userInfo.setPhoneNum(PhoneNum);
|
|
|
+ userInfo.setCollectPlace(collectPlace.toString());
|
|
|
+ userInfo.setNucleicCollectTime(nucleicCollectTime.toString());
|
|
|
+ userInfo.setNucleicResultsTime(nucleicResultsTime.toString());
|
|
|
+ userInfo.setNucleicResults(nucleicResults.toString());
|
|
|
+ userInfo.setDetectionProgress(index + "/" + detectionNumber);
|
|
|
+ PhoneNum = "";
|
|
|
+ if (bl) {
|
|
|
+ userInfo.setDetectionResult("正常");
|
|
|
+ } else {
|
|
|
+ userInfo.setDetectionResult("异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ userList.add(userInfo);
|
|
|
+ }
|
|
|
+ if (OdsQssHsjcxxList != null && OdsQssHsjcxxList.size() > 0) {
|
|
|
+ for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
|
|
|
+ for (UserInfo userInfo : userList) {
|
|
|
+ if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm())) {
|
|
|
+ UserNucleicTime userNucleicTime = new UserNucleicTime();
|
|
|
+ userNucleicTime.setInfoId(userInfo.getId());
|
|
|
+ userNucleicTime.setIdCard(odsQssHsjcxx.getSfzhm());
|
|
|
+ userNucleicTime.setCollectPlace(odsQssHsjcxx.getJcdd());
|
|
|
+ userNucleicTime.setNucleicCollectTime(odsQssHsjcxx.getCjsj());
|
|
|
+ userNucleicTime.setNucleicResultsTime(odsQssHsjcxx.getJgcjss());
|
|
|
+ userNucleicTime.setJobStyle(userInfoP.getJobStyle());
|
|
|
+ userNucleicTime.setFocusCrowdStyle(userInfoP.getFocusCrowdStyle());
|
|
|
+ userNucleicTime.setName(userInfo.getName());
|
|
|
+ userNucleicTime.setPhoneNum(userInfo.getPhoneNum());
|
|
|
+ userNucleicTime.setDeptId(user.getDeptId().toString());
|
|
|
+ UserNucleicTimeList.add(userNucleicTime);
|
|
|
+ userNucleicTime.setDateSource("批量导入");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量保存
|
|
|
+ userInfoMapper.insertUserInfoList(userList);
|
|
|
+ userNucleicTimeMapper.insertUserNucleicTimeList(UserNucleicTimeList);
|
|
|
+
|
|
|
+ long end1 = System.currentTimeMillis();
|
|
|
+ System.out.println("---------------接口耗时" + (end1 - start1) + "---------------");
|
|
|
+
|
|
|
+ return "操作成功";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 核酸比对人员导入
|
|
|
*
|
|
@@ -141,6 +313,12 @@ public class UserInfoServiceImpl implements IUserInfoService {
|
|
|
@Async
|
|
|
public String importUser(List<UserInfo> userList, String jobStyle, String focusCrowdStyle, String detectionNumber,
|
|
|
String detectionScope, String startTime, String endTime, SysUser user) throws Exception {
|
|
|
+
|
|
|
+ if (userList == null) {
|
|
|
+ return "表格格式错误,请按照表格模板格式上传人员名单";
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println("接口开始========");
|
|
|
long start1 = System.currentTimeMillis();
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
@@ -185,6 +363,8 @@ public class UserInfoServiceImpl implements IUserInfoService {
|
|
|
int count = 0;
|
|
|
String PhoneNum = "";
|
|
|
for (UserInfo userInfo : userList) {
|
|
|
+
|
|
|
+ System.out.println("我在循环");
|
|
|
userInfo.setDeptId(user.getDeptId().toString());
|
|
|
//采集地点
|
|
|
StringBuilder collectPlace = new StringBuilder();
|
|
@@ -459,5 +639,10 @@ public class UserInfoServiceImpl implements IUserInfoService {
|
|
|
return userInfoOneMapper.selectUserInfoOneList(userInfoOne);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int deleteUserInfoOneByIds(Long[] ids) {
|
|
|
+ return userInfoOneMapper.deleteUserInfoOneByIds(ids);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|