Commit 894db9ad authored by gaozhaochen's avatar gaozhaochen

update: 敏感数据加密解密处理,卫管中心预约统计

parent c6fc236d
......@@ -89,7 +89,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
return this.getByPhone(split[2]);
// 随身办登陆
case SSB:
return this.getBySSBToken(split[0], split[2]);
return this.getBySSBToken(split[0], split[2], split[1]);
// 香山中医院公众号登陆
// inStr = 公众号标识符@公众号appId@token@hospitalCode
case WOA_NL:
......@@ -174,7 +174,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
}
private UserInfo getBySSBToken(String source, String token) {
private UserInfo getBySSBToken(String source, String token, String appId) {
WDUserInfo wdUser = SsbUtil.getUserInfo(token);
log.error("ssb.login.wdUser = {}", JSONUtil.toJsonStr(wdUser));
if (ObjectUtil.isNull(wdUser) || StrUtil.isBlank(wdUser.getMobile())) {
......@@ -196,6 +196,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
user.setStatus(Constant.BYTE_NO);
user.setPasswd(ENCODER.encode(Constant.DEFAULT_PASSWORD));
user.setPhone(wdUser.getMobile());
user.setAppId(appId);
this.save(user);
// List<WDUserCardInfo> cardList = SsbUtil.getUserCardInfoList(token);
}
......@@ -203,6 +204,7 @@ public class SysUserBaseServiceImpl extends ServiceImpl<SysUserBaseMapper, SysUs
UserInfo info = new UserInfo();
info.setSysUserBase(user);
info.setOpenId(wdUser.getMobile());
info.setAppId(appId);
return info;
}
......
......@@ -52,17 +52,17 @@ public class EncryptionUtil {
}
public static void main(String[] args) {
KeyPair kp = SecureUtil.generateKeyPair(SIGN_TYPE_RSA, DEFAULT_RSA_KEY_SIZE);
PublicKey pbkey = kp.getPublic();
PrivateKey prkey = kp.getPrivate();
String pubkey = (new BASE64Encoder()).encode(pbkey.getEncoded());
String prikey = (new BASE64Encoder()).encode(prkey.getEncoded());
//logger.info("{}生成秘钥成功,公钥:{},私钥:{}",appkey,pubkey,prikey);
Map map = new HashMap();
map.put("pub", pubkey);
map.put("pri", prikey);
}
// public static void main(String[] args) {
// KeyPair kp = SecureUtil.generateKeyPair(SIGN_TYPE_RSA, DEFAULT_RSA_KEY_SIZE);
// PublicKey pbkey = kp.getPublic();
// PrivateKey prkey = kp.getPrivate();
// String pubkey = (new BASE64Encoder()).encode(pbkey.getEncoded());
// String prikey = (new BASE64Encoder()).encode(prkey.getEncoded());
// //logger.info("{}生成秘钥成功,公钥:{},私钥:{}",appkey,pubkey,prikey);
// Map map = new HashMap();
// map.put("pub", pubkey);
// map.put("pri", prikey);
//
// }
}
......@@ -11,6 +11,7 @@ import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.theme.hpgp.vo.IntelligentAnswerVO;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.Sets;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
......@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import java.util.Set;
/**
* @author F_xh
......@@ -32,6 +34,11 @@ import java.util.Map;
public class HpGpIntelligentQAController {
private final static String CONTENT = "Content";
/**
* 打浦桥科室
*/
private final static Set<String> DPQ_DEPARTMENT = Sets.newHashSet("皮肤性病科", "中医科", "儿保科", "全科医疗科");
@SysLog
@ApiOperation("智能问答")
@PostMapping
......@@ -57,10 +64,18 @@ public class HpGpIntelligentQAController {
log.error("孙总接口返回 body = {}", body);
IntelligentAnswerVO answerVO = new IntelligentAnswerVO();
Map<String, Object> result = XmlUtil.xmlToMap(body);
if(result.containsKey(CONTENT)){
if (result.containsKey(CONTENT)) {
answerVO.setAnswer(MapUtil.getStr(result, CONTENT));
if (StrUtil.isNotBlank(current.getHospitalCode())
&& "42502942300".equals(current.getHospitalCode())) {
if (StrUtil.isNotBlank(answerVO.getDeptName())
&& !DPQ_DEPARTMENT.contains(answerVO.getDeptName())) {
String oldDeptName = answerVO.getDeptName();
answerVO.setAnswer(answerVO.getAnswer().replace(oldDeptName, "全科医疗科"));
answerVO.setDeptName("全科医疗科");
}
}
}
return new R<>(answerVO);
}
}
......@@ -30,7 +30,6 @@ public class HpStatisticsController {
@ApiOperation("统计用户使用情况")
@GetMapping("/usage-overview")
@SecurityParameter(inDecode = false)
public R statisticsUsage(@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime) {
log.error("统计用户使用情况:startTime = {}, token = {}", startTime, endTime);
......
......@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author gao
......@@ -42,6 +43,14 @@ public interface HpStatisticsMapper {
* @return
*/
Long countLoginUser(@Param("startTime") String startTime,
@Param("endTime") String endTime);
@Param("endTime") String endTime,
@Param("appId") String appId);
/**
* 统计卫管中心预约人数
*
* @return
*/
Map<String, Long> countHealthManagementCenter();
}
......@@ -2,16 +2,14 @@ package cn.sh.stc.sict.theme.hphy.service.impl;
import cn.sh.stc.sict.theme.hphy.dao.HpAppointmentMapper;
import cn.sh.stc.sict.theme.hphy.dao.HpStatisticsMapper;
import cn.sh.stc.sict.theme.hphy.dao.HphyPatientBaseMapper;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.service.HpStatisticsService;
import cn.sh.stc.sict.theme.hphy.vo.StatisticsUsageVO;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 黄埔医导用户使用情况查询
......@@ -39,10 +37,19 @@ public class HpStatisticsServiceImpl implements HpStatisticsService {
@Override
public StatisticsUsageVO getUsageOverviewStatistics(String startTime, String endTime) {
Long loginUserCount = hpStatisticsMapper.countLoginUser(startTime, endTime);
Long loginUserCount = hpStatisticsMapper.countLoginUser(startTime, endTime, null);
Long newUserCount = hpStatisticsMapper.countNewUser(startTime, endTime);
List<StatisticsUsageVO.HosUsageStatistics> hosUsageStatisticsList = hpStatisticsMapper.queryAppointmentUserGroupByHos(startTime, endTime);
return StatisticsUsageVO.builder().newUserCount(newUserCount).loginUserCount(loginUserCount).hosAppointmentStatistics(hosUsageStatisticsList).build();
// 统计卫管中心数据
Map<String, Long> hmcStatistics = hpStatisticsMapper.countHealthManagementCenter();
Long hmcloginUserCount = hpStatisticsMapper.countLoginUser(startTime, endTime, "wx24c55f38b535cd96");
hmcStatistics.put("卫管中心登录人数", hmcloginUserCount);
return StatisticsUsageVO.builder()
.newUserCount(newUserCount)
.loginUserCount(loginUserCount)
.hosAppointmentStatistics(hosUsageStatisticsList)
.healthManagementCenterStatistics(hmcStatistics)
.build();
}
}
......@@ -5,6 +5,7 @@ import lombok.*;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 统计用户使用详情
......@@ -29,6 +30,9 @@ public class StatisticsUsageVO implements Serializable {
@ApiModelProperty(value = "医院预约人数")
private List<HosUsageStatistics> hosAppointmentStatistics;
@ApiModelProperty(value = "卫管中心入口数据统计")
private Map<String, Long> healthManagementCenterStatistics;
@Data
public static class HosUsageStatistics implements Serializable {
private static final long serialVersionUID = -1088663393589514198L;
......
......@@ -53,10 +53,22 @@
</if>
<if test="endTime != null and endTime != '' ">
AND create_time &lt;= #{endTime}
</if>
<if test="appId != null and appId != '' ">
AND create_by like concat('%',#{appId},'%')
</if>
AND `title` LIKE '%用户登录%'
AND `exception` = ''
</where>
</select>
<select id="countHealthManagementCenter" resultType="java.util.Map">
SELECT
COUNT(1) AS '卫管中心总预约次' ,
COUNT(IF(length(exception) = 0 OR exception IS NULL ,TRUE,NULL) ) AS '卫管中心成功预约次' ,
COUNT(IF(length(exception) >0,TRUE,NULL) ) AS '卫管中心失败预约次'
FROM `sys_log`
WHERE title = '预约' AND create_by like '%wx24c55f38b535cd96%'
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment