|
@ -89,7 +89,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
//请求内网服务
|
|
|
public static String entranceUrl = "http://192.168.101.2:10024/dsyy/";
|
|
|
|
|
|
private final static String updateUrl="http://127.0.0.1:10023/dsyy/updateBySql";
|
|
|
private final static String updateUrl="http://192.168.101.2:10023/dsyy/updateBySql";
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
@Autowired
|
|
@ -1006,6 +1006,53 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 处方签名
|
|
|
* @param prescriptionId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SOF_SignDataWithExtraInfo(String prescriptionId) throws Exception {
|
|
|
String url = entranceUrl +"SOF_SignDataWithExtraInfo";
|
|
|
String result = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("prescriptionId",prescriptionId);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
result = rs.getString("obj");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 病历签名
|
|
|
* @param prescriptionId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SOF_SignDataWithExtraInfoEmr(String prescriptionId) throws Exception {
|
|
|
String url = entranceUrl +"SOF_SignDataWithExtraInfoEmr";
|
|
|
String result = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("prescriptionId",prescriptionId);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
result = rs.getString("obj");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询ca用户信息
|
|
|
* @param idcard
|
|
@ -1029,154 +1076,192 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 数据哈希计算接口
|
|
|
*
|
|
|
* @param contentJson
|
|
|
* 电子病历保存
|
|
|
* @param prescriptionId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject computeDigestForAlg(String contentJson) throws Exception {
|
|
|
String url = entranceUrl +"computeDigestForAlg";
|
|
|
JSONObject object = new JSONObject();
|
|
|
public String dzblSave(String prescriptionId) throws Exception {
|
|
|
String url = entranceUrl +"dzblSave";
|
|
|
String result = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("content",contentJson);
|
|
|
params.put("prescriptionId",prescriptionId);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
object = rs.getJSONObject("message");
|
|
|
if (StringUtils.isNoneBlank(rs.getString("obj"))){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(rs.getString("obj"));
|
|
|
if (jsonObject.getString("RESULT_CODE").equalsIgnoreCase("true")){
|
|
|
logger.info("病历保存成功"+rs.toJSONString());
|
|
|
}
|
|
|
}
|
|
|
result = rs.getString("obj");
|
|
|
}
|
|
|
return object;
|
|
|
logger.info("病历保存日志=="+rs.toJSONString());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 数据签名接口
|
|
|
* @param templateId 模板ID签名数据摘要数据类型
|
|
|
* @param urId 签名流水ID
|
|
|
* @param patientName 患者姓名
|
|
|
* @param patientAge 患者年龄
|
|
|
* @param patientSex 患者性别
|
|
|
* @param patientCardType 证件类型
|
|
|
* @param recipeTime 开具时间
|
|
|
* @param hashValue Hash原文(从签名指纹接口结果中得到的)
|
|
|
* @param hashType Hash算法(从签名指纹接口结果中得到的)
|
|
|
* 查询病历文书
|
|
|
*
|
|
|
* @param patientId
|
|
|
* @param eventNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject synRecipeInfo(String templateId,String urId,String patientName,String patientAge,
|
|
|
String patientSex,String patientCardType,String recipeTime,
|
|
|
String hashValue,String hashType,String openId,String patientCard) throws Exception {
|
|
|
String url = entranceUrl +"synRecipeInfo";
|
|
|
JSONObject object = new JSONObject();
|
|
|
public JSONArray selectHistoryEmrFromEntrance(String patientId,String eventNo) throws Exception {
|
|
|
JSONArray array =dsyyEntranceService.selectHistoryEmrFromEntrance(patientId,eventNo);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
String PATIENT = object.getString("PATIENT");
|
|
|
String OPID = object.getString("OPID");
|
|
|
String res = selectHistoryEmrRecord(PATIENT,OPID);
|
|
|
if (StringUtils.isNoneBlank(res)){
|
|
|
jsonArray.add(object);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询历次就诊门诊病历文书
|
|
|
* @param patientId 病人id
|
|
|
* @param eventNo 就诊次数
|
|
|
* @return
|
|
|
*/
|
|
|
public String selectHistoryEmrRecord(String patientId,String eventNo) throws Exception {
|
|
|
String url = entranceUrl +"selectEmrInfoId";
|
|
|
String object = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("templateId",templateId);
|
|
|
params.put("urId",urId);
|
|
|
params.put("patientName",patientName);
|
|
|
params.put("patientAge",patientAge);
|
|
|
params.put("patientSex",patientSex);
|
|
|
params.put("patientCardType",patientCardType);
|
|
|
params.put("recipeTime",recipeTime);
|
|
|
params.put("hashValue",hashValue);
|
|
|
params.put("hashType",hashType);
|
|
|
params.put("openId",openId);
|
|
|
params.put("patientCard",patientCard);
|
|
|
params.put("patientId",patientId);
|
|
|
params.put("visitNo",eventNo);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
object = rs.getJSONObject("message");
|
|
|
object = rs.getString("obj");
|
|
|
}
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
//=====================合理用药内网调用接口=======================
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 处方签名
|
|
|
* @param prescriptionDO
|
|
|
* 合理用药审核
|
|
|
*
|
|
|
*
|
|
|
* @param outpatient
|
|
|
* @param prescriptionOnly
|
|
|
* @param payType
|
|
|
* @param doctor
|
|
|
* @param patient
|
|
|
* @param diagnosisDOS
|
|
|
* @param infos
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
|
|
|
JSONObject object = new JSONObject();
|
|
|
String baseSign="";
|
|
|
object.put("infos",infoDOS);
|
|
|
object.put("registerSn",outpatientDO.getRegisterNo());
|
|
|
object.put("diagnosiss",diagnosisDOS);
|
|
|
JSONObject jsonObject = computeDigestForAlg(object.toJSONString());
|
|
|
String hashValue = null;
|
|
|
String hashType = null;
|
|
|
if (jsonObject.getString("status").equalsIgnoreCase("0")){
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
hashValue= data.getString("hashValue");
|
|
|
hashType = data.getString("hashType");
|
|
|
}
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).orElse(null);
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(outpatientDO.getDoctor());
|
|
|
if (patientDO!=null&&doctorDO!=null){
|
|
|
String patientName = patientDO.getName();
|
|
|
Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
|
|
|
String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
|
|
|
String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
|
|
|
String openId = doctorDO.getOpenid();
|
|
|
String idcard = patientDO.getIdcard();
|
|
|
if (hashType!=null&&hashValue!=null){
|
|
|
JSONObject object1 = synRecipeInfo("hash_004",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
|
|
|
if (object1.getString("status").equalsIgnoreCase("0")){
|
|
|
logger.info("西药处方签名成功"+object1);
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(object1.getString("data"));
|
|
|
if (jsonObject1!=null){
|
|
|
baseSign=jsonObject1.getString("stamp");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public String dsyyCheckInfo(String outpatient,String prescriptionOnly,String payType,String doctor,String patient,String diagnosisDOS, String infos) throws Exception {
|
|
|
String url = entranceUrl +"dsyyCheckInfo";
|
|
|
String jsonObject = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("outpatient",outpatient);
|
|
|
params.put("prescriptionOnly",prescriptionOnly);
|
|
|
params.put("payType",payType);
|
|
|
params.put("doctor",doctor);
|
|
|
params.put("patient",patient);
|
|
|
params.put("diagnosisDOS",diagnosisDOS);
|
|
|
params.put("infos",infos);
|
|
|
logger.info("params=="+params);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
if(rs.getInteger("status")==200){
|
|
|
jsonObject = rs.getString("message");
|
|
|
}
|
|
|
return baseSign;
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 病历签名
|
|
|
* @param prescriptionDO
|
|
|
* 处方在医生站系统成功保存后调用
|
|
|
*
|
|
|
*
|
|
|
* @param outpatient
|
|
|
* @param prescriptionOnly
|
|
|
* @param payType
|
|
|
* @param doctor
|
|
|
* @param patient
|
|
|
* @param diagnosisDOS
|
|
|
* @param infos
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionDO prescriptionDO) throws Exception {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
|
|
|
WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionDO.getId());
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("emr",prescriptionEmrDO);
|
|
|
object.put("registerSn",outpatientDO.getRegisterNo());
|
|
|
object.put("doctorName",outpatientDO.getDoctorName());
|
|
|
object.put("patientName",outpatientDO.getPatientName());
|
|
|
JSONObject jsonObject = computeDigestForAlg(object.toJSONString());
|
|
|
String hashValue = null;
|
|
|
String hashType = null;
|
|
|
if (jsonObject.getString("status").equalsIgnoreCase("0")){
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
hashValue= data.getString("hashValue");
|
|
|
hashType = data.getString("hashType");
|
|
|
public String dsyySaveCheckInfo(String outpatient,String prescriptionOnly,String payType,String doctor,String patient,String diagnosisDOS, String infos) throws Exception {
|
|
|
String url = entranceUrl +"dsyySaveCheckInfo";
|
|
|
String jsonObject = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("outpatient",outpatient);
|
|
|
params.put("prescriptionOnly",prescriptionOnly);
|
|
|
params.put("payType",payType);
|
|
|
params.put("doctor",doctor);
|
|
|
params.put("patient",patient);
|
|
|
params.put("diagnosisDOS",diagnosisDOS);
|
|
|
params.put("infos",infos);
|
|
|
logger.info("params=="+params);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
if(rs.getInteger("status")==200){
|
|
|
jsonObject = rs.getString("message");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).orElse(null);
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(outpatientDO.getDoctor());
|
|
|
if (patientDO!=null&&doctorDO!=null){
|
|
|
String patientName = patientDO.getName();
|
|
|
Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
|
|
|
String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
|
|
|
String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
|
|
|
String openId = doctorDO.getOpenid();
|
|
|
String idcard = patientDO.getIdcard();
|
|
|
if (hashType!=null&&hashValue!=null){
|
|
|
JSONObject object1 = synRecipeInfo("hash_002",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
|
|
|
if (object1.getString("status").equalsIgnoreCase("0")){
|
|
|
logger.info("门诊病历签名成功"+object1);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 处方保存成功后,发送给审方系统进行人工审方
|
|
|
*
|
|
|
*
|
|
|
* @param outpatient
|
|
|
* @param prescriptionOnly
|
|
|
* @param payType
|
|
|
* @param doctor
|
|
|
* @param patient
|
|
|
* @param diagnosisDOS
|
|
|
* @param infos
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String dsyyValidCheckInfo(String outpatient,String prescriptionOnly,String payType,String doctor,String patient,String diagnosisDOS, String infos) throws Exception {
|
|
|
String url = entranceUrl +"dsyyValidCheckInfo";
|
|
|
String jsonObject = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("outpatient",outpatient);
|
|
|
params.put("prescriptionOnly",prescriptionOnly);
|
|
|
params.put("payType",payType);
|
|
|
params.put("doctor",doctor);
|
|
|
params.put("patient",patient);
|
|
|
params.put("diagnosisDOS",diagnosisDOS);
|
|
|
params.put("infos",infos);
|
|
|
logger.info("params=="+params);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
if(rs.getInteger("status")==200){
|
|
|
jsonObject = rs.getString("message");
|
|
|
}
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//========================调用内网服务结束===================
|
|
@ -1903,8 +1988,8 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
//结算更新
|
|
|
System.out.println("sql=="+sql);
|
|
|
String res = updateUrl(sql);
|
|
|
logger.info("结算成功更新日志:"+res);
|
|
|
}
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
String operatorId = "HLWYY";
|
|
|
String operatorName = "互联网医院";
|
|
|
String termNo = "DSYYHLWYY";
|