feat(all): getEmrCaTimeStamp 成功

pull/544/head
dazer007 2025-03-13 16:56:54 +08:00
parent 9d9c6cf215
commit 38502914f5
7 changed files with 345 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import com.neuhis.his.domain.vo.bjca.BjCaResult;
import com.neuhis.his.domain.vo.bjca.CaResultVo;
import com.neuhis.his.domain.vo.bjca.CaStartVo;
import com.neuhis.his.service.IBjCaService;
import com.neuhis.his.service.his.IEmrCaService;
import com.neuhis.his.service.winlis.ILasSapSampleregService;
import com.neuhis.his.service.winlis.IWinLisService;
import com.ruoyi.common.core.domain.AjaxResult;
@ -33,6 +34,8 @@ public class AppBjCaController {
@Resource
private IWinLisService winLisService;
@Resource
private IEmrCaService emrCaService;
@Resource
private ILasSapSampleregService lasSapSampleregService;
/**
* startAutoSign[id]
@ -72,4 +75,13 @@ public class AppBjCaController {
//return AjaxResult.success(lasSapSampleregService.selectWaitingCaSignList("202503", 10));
return AjaxResult.success(winLisService.winlistCaTask("202503", 10));
}
@GetMapping("/getEmrCaTimeStamp")
@ApiOperation(value = "获取Emr的CA签名", notes = "获取Emr的CA签名签名结果、证书、时间戳")
public AjaxResult getEmrCaTimeStamp() {
String oriDataBase64 = "1/C+tLXEu7zV37ywvNLK9Lvyt6i2qLzgu6TIy6GiytrIqM6vzdDIy6O6DQogICAgICDE+rrDIcrXz8i40NC7xPoow8cp0aHU8dTaztLUur7N1e+ho7C01dXPzNH0ytChos73sLLK0NK9saPV/rLftci55raoo6jS7LXYss7V1c/M0fTK0NK9saPWp7i2t7bOp9a00NCjqaOsuPm+3cT6tcSyocfp0OjSqqOs1NrXodS61e/BxtbQyea8sLzssumhotPD0qmhorrEssShotbOwca8sMbky/uzrNK9saPWp7i2t7bOp7XE0r3Bxrf+zvHP7sS/o6zQ6M/yxPq78sT6tcS80sr0o6i84LukyMuhosrayKjOr83QyMujqcu1w/fH6b/2o6zV97XDzazS4sjPv8nHqdfWuvOjrLe9v8nWtNDQoaMNCsjnufvE+sHLveLJ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EGqpnd8J1zSxAnYMAwskI1P5Aznb5auDd2JwIhAJFD+EQ4CDDmMyG1GMnXnNC72+yEoWDjWMysGYypQVj6";
return AjaxResult.success(emrCaService.generateBjCaTimestamp(oriDataBase64, signature));
}
}

View File

@ -0,0 +1,79 @@
package com.neuhis.his.domain.entity.his;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* CA mdc_rcd_in_record_sign
*
* @author ruoyi
* @date 2025-03-13
*/
@Getter
@Setter
@NoArgsConstructor
public class MdcRcdInRecordSign extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 住院病历ID */
@Excel(name = "住院病历ID")
private Long inpatientRecordId;
/** 签名人Code */
@Excel(name = "签名人Code")
private String operCode;
/** 签名人姓名 */
@Excel(name = "签名人姓名")
private String operName;
/** 签名时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "签名时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date signTime;
/** 签名人级别Code */
@Excel(name = "签名人级别Code")
private String profLevelId;
/** 住院病历日志ID */
@Excel(name = "住院病历日志ID")
private Long inpatientRecordLogId;
/** 病历签名密文 */
@Excel(name = "病历签名密文")
private String privateInfo;
/** 授权人code */
@Excel(name = "授权人code")
private String authorizeCode;
/** CA签名证书Cert */
@Excel(name = "CA签名证书Cert")
private String cert;
/** 时间戳密文 */
@Excel(name = "时间戳密文")
private String timeciphertext;
/** 附属账号 */
@Excel(name = "附属账号")
private String traineeName;
/** 签名节ID */
@Excel(name = "签名节ID")
private String sectionId;
/** 签名原文BASE64后 */
@Excel(name = "签名原文BASE64后")
private String oringinText;
}

View File

@ -0,0 +1,52 @@
package com.neuhis.his.mapper.his;
import com.neuhis.his.domain.entity.his.MdcRcdInRecordSign;
import java.util.Date;
import java.util.List;
/**
* CAMapper
*
* @author ruoyi
* @date 2025-03-13
*/
public interface MdcRcdInRecordSignMapper
{
/**
* CA
*
* @param id CA
* @return CA
*/
MdcRcdInRecordSign selectMdcRcdRecordSignById(Long id);
/**
* CA
*
* @param mdcRcdInRecordSign CA
* @return CA
*/
List<MdcRcdInRecordSign> selectMdcRcdRecordSignList(MdcRcdInRecordSign mdcRcdInRecordSign);
/**
*
*/
List<MdcRcdInRecordSign> getEmrUnTimestampList(Date startTime, Date endTime, int limit);
/**
* CA
*
* @param mdcRcdInRecordSign CA
* @return
*/
int insertMdcRcdRecordSign(MdcRcdInRecordSign mdcRcdInRecordSign);
/**
* CA
*
* @param mdcRcdInRecordSign CA
* @return
*/
int updateMdcRcdRecordSign(MdcRcdInRecordSign mdcRcdInRecordSign);
}

View File

@ -0,0 +1,27 @@
package com.neuhis.his.service.his;
import com.neuhis.his.domain.entity.his.MdcRcdInRecordSign;
import java.util.Date;
import java.util.List;
/**
* EMR CA
*
* @author dazer
* @date 2025/3/13 12:22
**/
public interface IEmrCaService {
/**
* ERM
*/
List<MdcRcdInRecordSign> getEmrUnTimestampList(Date startTime, Date endTime, int limit);
/**
* CA
* @param oriDataBase64 /BASE64
* @param signature //
*/
String generateBjCaTimestamp(String oriDataBase64, String signature);
String generateBjCaTimestamp(MdcRcdInRecordSign recordSign);
}

View File

@ -0,0 +1,55 @@
package com.neuhis.his.service.impl.his;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil;
import com.neuhis.his.domain.entity.his.MdcRcdInRecordSign;
import com.neuhis.his.mapper.his.MdcRcdInRecordSignMapper;
import com.neuhis.his.service.IBjCaService;
import com.neuhis.his.service.his.IEmrCaService;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* EMR CA
*
* @author dazer
* @date 2025/3/13 15:31
**/
@Service
@DataSource(value = DataSourceType.SLAVE)
@Slf4j
public class EmrCaServiceImpl implements IEmrCaService {
@Resource
private MdcRcdInRecordSignMapper mdcRcdInRecordSignMapper;
@Autowired
private IBjCaService bjCaService;
@Override
public List<MdcRcdInRecordSign> getEmrUnTimestampList(Date startTime, Date endTime, int limit) {
return mdcRcdInRecordSignMapper.getEmrUnTimestampList(startTime, endTime, limit);
}
@Override
public String generateBjCaTimestamp(String oriDataBase64, String signature) {
if (StrUtil.isEmpty(oriDataBase64) || StrUtil.isEmpty(signature) || !Base64.isBase64(oriDataBase64)) {
return "";
}
return bjCaService.createAndGetTssInfo(oriDataBase64, signature);
}
@Override
public String generateBjCaTimestamp(MdcRcdInRecordSign recordSign) {
if (recordSign == null) {
return "";
}
return generateBjCaTimestamp(recordSign.getOringinText(), recordSign.getCert());
}
}

View File

@ -19,10 +19,14 @@ nhit.dc.ca.bjxt01.user_id:2122e89265cc291a00f8d20800bfd24c0f7f72db9225cb69a208dc
# \u7B2C\u4E09\u65B9\u8D26\u53F7\u79D8\u94A5
#nhit.dc.ca.bjxt01.app-secret=MDAwNjY1MTZmMjczNDk4MDk2MzJhMTQ4OWYyZTdlNGE=
### \u54B8\u9633\u75C5\u5386
### \u5317\u4EACCA\u534F\u540C\u7B7E\u540D-CA\u4EBA\u5458\u7ED9
nhit.dc.ca.bjxt01.app-id=APP_95BF9D123FCF498A83C344ED42473675
nhit.dc.ca.bjxt01.app-secret=MzI1ODNlYTI2ZjkwNDkzZjg3MDhjOTMwMDBlZDYwOTQ=
### \u54B8\u9633\u75C5\u5386-\u5317\u4EACCA\u534F\u540C\u7B7E\u540D BJCAXT\uFF0C\u751F\u4EA7
#nhit.dc.ca.bjxt01.app-id=APP_9EE2EE50DD2F44B5B6449C8DF1E4115B
#nhit.dc.ca.bjxt01.app-secret=ZmJlMmE3YTYyNmUyNDI2YTgwMDAxODliYzkyZDhjZDM=
# \u67E5\u8BE2\u7528\u6237\u4FE1\u606F
nhit.dc.ca.bjxt01.server-query-user-info=/service/v1/queryUserInfo

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.neuhis.his.mapper.his.MdcRcdInRecordSignMapper">
<resultMap type="com.neuhis.his.domain.entity.his.MdcRcdInRecordSign" id="MdcRcdRecordSignResult">
<result property="id" column="id" />
<result property="inpatientRecordId" column="inpatient_record_id" />
<result property="operCode" column="oper_code" />
<result property="operName" column="oper_name" />
<result property="signTime" column="sign_time" />
<result property="profLevelId" column="prof_level_id" />
<result property="inpatientRecordLogId" column="inpatient_record_log_id" />
<result property="privateInfo" column="private_info" />
<result property="authorizeCode" column="authorize_code" />
<result property="cert" column="cert" />
<result property="timeciphertext" column="timeciphertext" />
<result property="traineeName" column="trainee_name" />
<result property="sectionId" column="section_id" />
<result property="oringinText" column="oringin_text" />
</resultMap>
<sql id="selectMdcRcdRecordSignVo">
select id, inpatient_record_id, oper_code, oper_name, sign_time, prof_level_id, inpatient_record_log_id, private_info, authorize_code, cert, timeciphertext, trainee_name, section_id, oringin_text from mdc_rcd_in_record_sign
</sql>
<select id="selectMdcRcdRecordSignList" parameterType="com.neuhis.his.domain.entity.his.MdcRcdInRecordSign" resultMap="MdcRcdRecordSignResult">
<include refid="selectMdcRcdRecordSignVo"/>
<where>
<if test="inpatientRecordId != null "> and inpatient_record_id = #{inpatientRecordId}</if>
<if test="operCode != null and operCode != ''"> and oper_code = #{operCode}</if>
<if test="operName != null and operName != ''"> and oper_name like concat('%', #{operName}, '%')</if>
<if test="signTime != null "> and sign_time = #{signTime}</if>
<if test="profLevelId != null and profLevelId != ''"> and prof_level_id = #{profLevelId}</if>
<if test="inpatientRecordLogId != null "> and inpatient_record_log_id = #{inpatientRecordLogId}</if>
<if test="privateInfo != null and privateInfo != ''"> and private_info = #{privateInfo}</if>
<if test="authorizeCode != null and authorizeCode != ''"> and authorize_code = #{authorizeCode}</if>
<if test="cert != null and cert != ''"> and cert = #{cert}</if>
<if test="timeciphertext != null and timeciphertext != ''"> and timeciphertext = #{timeciphertext}</if>
<if test="traineeName != null and traineeName != ''"> and trainee_name like concat('%', #{traineeName}, '%')</if>
<if test="sectionId != null and sectionId != ''"> and section_id = #{sectionId}</if>
<if test="oringinText != null and oringinText != ''"> and oringin_text = #{oringinText}</if>
</where>
</select>
<select id="selectMdcRcdRecordSignById" parameterType="Long" resultMap="MdcRcdRecordSignResult">
<include refid="selectMdcRcdRecordSignVo"/>
where id = #{id}
</select>
<select id="getEmrUnTimestampList" resultType="com.neuhis.his.domain.entity.his.MdcRcdInRecordSign">
select * from mdc_rcd_in_record_sign d where 1 = 1
and d.sign_time <![CDATA[>]]> #{startTime} and d.sign_time <![CDATA[<]]> #{endTime}
and d.TIMECIPHERTEXT is null
and rownum <![CDATA[ <= ]]> #{limit}
order by sign_time desc
</select>
<insert id="insertMdcRcdRecordSign" parameterType="com.neuhis.his.domain.entity.his.MdcRcdInRecordSign">
insert into mdc_rcd_in_record_sign
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="inpatientRecordId != null">inpatient_record_id,</if>
<if test="operCode != null">oper_code,</if>
<if test="operName != null">oper_name,</if>
<if test="signTime != null">sign_time,</if>
<if test="profLevelId != null">prof_level_id,</if>
<if test="inpatientRecordLogId != null">inpatient_record_log_id,</if>
<if test="privateInfo != null">private_info,</if>
<if test="authorizeCode != null">authorize_code,</if>
<if test="cert != null">cert,</if>
<if test="timeciphertext != null">timeciphertext,</if>
<if test="traineeName != null">trainee_name,</if>
<if test="sectionId != null">section_id,</if>
<if test="oringinText != null">oringin_text,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="inpatientRecordId != null">#{inpatientRecordId},</if>
<if test="operCode != null">#{operCode},</if>
<if test="operName != null">#{operName},</if>
<if test="signTime != null">#{signTime},</if>
<if test="profLevelId != null">#{profLevelId},</if>
<if test="inpatientRecordLogId != null">#{inpatientRecordLogId},</if>
<if test="privateInfo != null">#{privateInfo},</if>
<if test="authorizeCode != null">#{authorizeCode},</if>
<if test="cert != null">#{cert},</if>
<if test="timeciphertext != null">#{timeciphertext},</if>
<if test="traineeName != null">#{traineeName},</if>
<if test="sectionId != null">#{sectionId},</if>
<if test="oringinText != null">#{oringinText},</if>
</trim>
</insert>
<update id="updateMdcRcdRecordSign" parameterType="com.neuhis.his.domain.entity.his.MdcRcdInRecordSign">
update mdc_rcd_in_record_sign
<trim prefix="SET" suffixOverrides=",">
<if test="inpatientRecordId != null">inpatient_record_id = #{inpatientRecordId},</if>
<if test="operCode != null">oper_code = #{operCode},</if>
<if test="operName != null">oper_name = #{operName},</if>
<if test="signTime != null">sign_time = #{signTime},</if>
<if test="profLevelId != null">prof_level_id = #{profLevelId},</if>
<if test="inpatientRecordLogId != null">inpatient_record_log_id = #{inpatientRecordLogId},</if>
<if test="privateInfo != null">private_info = #{privateInfo},</if>
<if test="authorizeCode != null">authorize_code = #{authorizeCode},</if>
<if test="cert != null">cert = #{cert},</if>
<if test="timeciphertext != null">timeciphertext = #{timeciphertext},</if>
<if test="traineeName != null">trainee_name = #{traineeName},</if>
<if test="sectionId != null">section_id = #{sectionId},</if>
<if test="oringinText != null">oringin_text = #{oringinText},</if>
</trim>
where id = #{id}
</update>
</mapper>