|
|
|
@ -2,10 +2,14 @@ package org.springblade.modules.business.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
import io.swagger.annotations.*; |
|
|
|
import io.swagger.annotations.*; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.bouncycastle.crypto.InvalidCipherTextException; |
|
|
|
import org.bouncycastle.crypto.InvalidCipherTextException; |
|
|
|
import org.springblade.common.cache.DeptCache; |
|
|
|
import org.springblade.common.cache.DeptCache; |
|
|
|
import org.springblade.common.cache.DictBizCache; |
|
|
|
import org.springblade.common.cache.DictBizCache; |
|
|
|
@ -15,6 +19,7 @@ import org.springblade.common.constant.BusinessConstant; |
|
|
|
import org.springblade.common.constant.CommonConstant; |
|
|
|
import org.springblade.common.constant.CommonConstant; |
|
|
|
import org.springblade.common.enums.ApmRecordStatusEnum; |
|
|
|
import org.springblade.common.enums.ApmRecordStatusEnum; |
|
|
|
import org.springblade.common.enums.ErrorMsgEnum; |
|
|
|
import org.springblade.common.enums.ErrorMsgEnum; |
|
|
|
|
|
|
|
import org.springblade.common.utils.Sm2Utils; |
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
@ -37,6 +42,7 @@ import org.springblade.modules.business.wrapper.ApmRecordWrapper; |
|
|
|
import org.springblade.modules.system.entity.Dept; |
|
|
|
import org.springblade.modules.system.entity.Dept; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
@ -188,7 +194,7 @@ public class ApmRecordController extends BladeController { |
|
|
|
}) |
|
|
|
}) |
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
@ApiOperation(value = "分页", notes = "分页") |
|
|
|
@ApiOperation(value = "分页", notes = "分页") |
|
|
|
public R<IPage<ApmRecordListVO>> selectPage2(Query query, Long createDept, String startTime, String endTime, String cupCardNo, String project, String apmStatus) throws InvalidCipherTextException, IOException { |
|
|
|
public R<IPage<ApmRecordListVO>> selectPage2(Query query, Long createDept, String startTime, String endTime, String cupCardNo, String project, String apmStatus, HttpServletRequest request) throws InvalidCipherTextException, IOException { |
|
|
|
/*BladeUser user = AuthUtil.getUser(); |
|
|
|
/*BladeUser user = AuthUtil.getUser(); |
|
|
|
if (Func.isNotEmpty(user) && !BusinessConstant.ROLE_NAME_HOSPITAL.equals(user.getRoleName())) { |
|
|
|
if (Func.isNotEmpty(user) && !BusinessConstant.ROLE_NAME_HOSPITAL.equals(user.getRoleName())) { |
|
|
|
createDept = null; |
|
|
|
createDept = null; |
|
|
|
@ -203,6 +209,37 @@ public class ApmRecordController extends BladeController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return R.data(page);*/ |
|
|
|
return R.data(page);*/ |
|
|
|
|
|
|
|
System.out.println("我的预约传参是:"+cupCardNo); |
|
|
|
|
|
|
|
String cardNo = null; |
|
|
|
|
|
|
|
// 获取指定请求头
|
|
|
|
|
|
|
|
String interfaceToken = request.getHeader("interfaceToken"); |
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(interfaceToken)){ |
|
|
|
|
|
|
|
System.out.println("我的预约获取到的interfaceToken是:" + interfaceToken); |
|
|
|
|
|
|
|
String info1 = Sm2Utils.decrypt(interfaceToken,"411d0cc222bfd3c72830f1b0e92d1da42ffd50d74b6f495ebab6ded09d48ab57"); |
|
|
|
|
|
|
|
String info = Sm2Utils.decrypt(info1,"3c57e96dac2d6d0dfd92e400ebb609e584b148b755968d898bd25f226aa5b636"); |
|
|
|
|
|
|
|
System.out.println("我的预约token解密后的内容是:"+info); |
|
|
|
|
|
|
|
// 创建ObjectMapper实例
|
|
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 解析JSON字符串
|
|
|
|
|
|
|
|
JsonNode rootNode = objectMapper.readTree(info); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取data字段的值(这是一个JSON字符串)
|
|
|
|
|
|
|
|
String dataJson = rootNode.get("data").asText(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 解析data字段的JSON字符串
|
|
|
|
|
|
|
|
JsonNode dataNode = objectMapper.readTree(dataJson); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取certNo的值
|
|
|
|
|
|
|
|
cardNo = dataNode.get("certNo").asText(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("我的预约获取到的身份证号是:"+cardNo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if(!cupCardNo.equals(cardNo)){ |
|
|
|
|
|
|
|
return R.fail(ErrorMsgEnum.PARAMS_CHECK_FAIL.getValue()); |
|
|
|
|
|
|
|
}*/ |
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
if (Func.isNotEmpty(user) && !BusinessConstant.ROLE_NAME_HOSPITAL.equals(user.getRoleName())) { |
|
|
|
if (Func.isNotEmpty(user) && !BusinessConstant.ROLE_NAME_HOSPITAL.equals(user.getRoleName())) { |
|
|
|
createDept = null; |
|
|
|
createDept = null; |
|
|
|
@ -267,66 +304,47 @@ public class ApmRecordController extends BladeController { |
|
|
|
@PostMapping("/save2") |
|
|
|
@PostMapping("/save2") |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperation(value = "新增", notes = "传入apmConfig") |
|
|
|
@ApiOperation(value = "新增", notes = "传入apmConfig") |
|
|
|
public R save2(@RequestBody Map<String, Object> apmRecordListStr) throws InvalidCipherTextException, UnsupportedEncodingException { |
|
|
|
public R save2(@RequestBody Map<String, Object> apmRecordListStr, HttpServletRequest request) throws InvalidCipherTextException, UnsupportedEncodingException, JsonProcessingException { |
|
|
|
/*List<Map<String, Object>> apmRecordMapList = (List<Map<String, Object>>) apmRecordListStr.get("data"); |
|
|
|
List<Map<String, Object>> apmRecordMapList = (List<Map<String, Object>>) apmRecordListStr.get("data"); |
|
|
|
|
|
|
|
|
|
|
|
List<ApmRecord> apmRecordList = new ArrayList<>(); |
|
|
|
List<ApmRecord> apmRecordList = new ArrayList<>(); |
|
|
|
Date apmDay = null; |
|
|
|
Date apmDay = null; |
|
|
|
String cardNo = null; |
|
|
|
String cardNo = null; |
|
|
|
for (Map<String, Object> item : apmRecordMapList) { |
|
|
|
for (Map<String, Object> item : apmRecordMapList) { |
|
|
|
ApmRecord record = BeanUtil.copy(item, ApmRecord.class); |
|
|
|
ApmRecord record = BeanUtil.copy(item, ApmRecord.class); |
|
|
|
record.setApmDay(DateUtil.parse(item.get("apmDay").toString(), DateUtil.PATTERN_DATE)); |
|
|
|
|
|
|
|
record.setCreateDept(Long.parseLong(item.get("createDept").toString())); |
|
|
|
|
|
|
|
if(item.get("cupName") != null){ |
|
|
|
|
|
|
|
record.setCupName(Sm2Utils.decrypt(item.get("cupName").toString(),sm2PrivatekeyProperties.getSave())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(item.get("cupCardNo") != null){ |
|
|
|
|
|
|
|
record.setCupCardNo(Sm2Utils.decrypt(item.get("cupCardNo").toString(),sm2PrivatekeyProperties.getSave())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(item.get("cupPhone") != null){ |
|
|
|
|
|
|
|
record.setCupPhone(Sm2Utils.decrypt(item.get("cupPhone").toString(),sm2PrivatekeyProperties.getSave())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (apmDay == null) { |
|
|
|
|
|
|
|
apmDay = record.getApmDay(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cardNo == null) { |
|
|
|
|
|
|
|
cardNo = record.getCupCardNo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!DateUtil.format(apmDay, DateUtil.PATTERN_DATE).equals(DateUtil.format(record.getApmDay(), DateUtil.PATTERN_DATE))) { |
|
|
|
System.out.println("提交我的预约传参是:"+record.getCupCardNo()); |
|
|
|
return R.fail("预约失败, 一次只能预约同一天的体检项目"); |
|
|
|
// 获取指定请求头
|
|
|
|
} |
|
|
|
String interfaceToken = request.getHeader("interfaceToken"); |
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(interfaceToken)){ |
|
|
|
|
|
|
|
System.out.println("提交我的预约获取到的interfaceToken是:" + interfaceToken); |
|
|
|
|
|
|
|
String info1 = Sm2Utils.decrypt(interfaceToken,"1ba5264f7cea5dcc213864bcf4c60bb772638ab9e9f93ecc1e3f854a0139d310"); |
|
|
|
|
|
|
|
String info = Sm2Utils.decrypt(info1,"3c57e96dac2d6d0dfd92e400ebb609e584b148b755968d898bd25f226aa5b636"); |
|
|
|
|
|
|
|
System.out.println("提交我的预约token解密后的内容是:"+info); |
|
|
|
|
|
|
|
// 创建ObjectMapper实例
|
|
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
|
|
|
|
if (!cardNo.equals(record.getCupCardNo())) { |
|
|
|
// 解析JSON字符串
|
|
|
|
return R.fail("预约失败, 一次只能预约同一个人"); |
|
|
|
JsonNode rootNode = objectMapper.readTree(info); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
record.setApmTime(DateUtil.now()); |
|
|
|
// 获取data字段的值(这是一个JSON字符串)
|
|
|
|
record.setApmStatus(BusinessConstant.RECORD_STATUS_UNREGISTER); |
|
|
|
String dataJson = rootNode.get("data").asText(); |
|
|
|
apmRecordList.add(record); |
|
|
|
|
|
|
|
} |
|
|
|
// 解析data字段的JSON字符串
|
|
|
|
|
|
|
|
JsonNode dataNode = objectMapper.readTree(dataJson); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取certNo的值
|
|
|
|
|
|
|
|
cardNo = dataNode.get("certNo").asText(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("提交我的预约取到的身份证号是:"+cardNo); |
|
|
|
|
|
|
|
|
|
|
|
String checkMsg = ""; |
|
|
|
|
|
|
|
synchronized(this){ |
|
|
|
|
|
|
|
checkMsg = recordService.checkApmRecordSave(apmRecordList); |
|
|
|
|
|
|
|
if (Func.isBlank(checkMsg)) { |
|
|
|
|
|
|
|
recordService.saveBatch(apmRecordList); |
|
|
|
|
|
|
|
int blacklistOutdate = DictBizCache.getDictValueWithOffset(BusinessConstant.DICT_KEY_BLACKLIST_OUTDATE); |
|
|
|
|
|
|
|
int timesToBlacklist = DictBizCache.getDictValueWithOffset(BusinessConstant.DICT_KEY_RENEGED_TIMES_TO_BLACKLIST); |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("blacklistOutDate", blacklistOutdate); |
|
|
|
|
|
|
|
result.put("timesToBlacklist", timesToBlacklist); |
|
|
|
|
|
|
|
return R.data(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return R.fail(checkMsg);*/ |
|
|
|
|
|
|
|
List<Map<String, Object>> apmRecordMapList = (List<Map<String, Object>>) apmRecordListStr.get("data"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApmRecord> apmRecordList = new ArrayList<>(); |
|
|
|
/*if(!record.getCupCardNo().equals(cardNo)){ |
|
|
|
Date apmDay = null; |
|
|
|
return R.fail(ErrorMsgEnum.PARAMS_CHECK_FAIL.getValue()); |
|
|
|
String cardNo = null; |
|
|
|
}*/ |
|
|
|
for (Map<String, Object> item : apmRecordMapList) { |
|
|
|
|
|
|
|
ApmRecord record = BeanUtil.copy(item, ApmRecord.class); |
|
|
|
|
|
|
|
record.setApmDay(DateUtil.parse(item.get("apmDay").toString(), DateUtil.PATTERN_DATE)); |
|
|
|
record.setApmDay(DateUtil.parse(item.get("apmDay").toString(), DateUtil.PATTERN_DATE)); |
|
|
|
record.setCreateDept(Long.parseLong(item.get("createDept").toString())); |
|
|
|
record.setCreateDept(Long.parseLong(item.get("createDept").toString())); |
|
|
|
if (apmDay == null) { |
|
|
|
if (apmDay == null) { |
|
|
|
|