|
@ -3,6 +3,7 @@ package com.yihu.jw.hospital.prescription.service.entrance;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
@ -17,6 +18,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
|
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.*;
|
|
@ -28,6 +30,8 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.*;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.AES;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.hospital.doctor.CheckInfoVO;
|
|
|
import com.yihu.jw.restmodel.hospital.doctor.PersonInfoVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
@ -38,6 +42,7 @@ import com.yihu.jw.utils.WebserviceUtil;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import com.yihu.utils.security.MD5;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
import nu.xom.*;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -47,6 +52,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
import java.io.IOException;
|
|
|
import java.io.StringReader;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -100,7 +108,14 @@ public class XzzxEntranceService{
|
|
|
private WlyyInspectionDao wlyyInspectionDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao baseDoctorHospitalDao;
|
|
|
@Autowired
|
|
|
private PrescriptionEmrDao prescriptionEmrDao;
|
|
|
|
|
|
|
|
|
private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
|
|
@ -112,9 +127,14 @@ public class XzzxEntranceService{
|
|
|
public static String entranceUrlLocal = "http://localhost:10023/xzzx/";
|
|
|
|
|
|
public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
|
|
|
|
|
|
|
|
|
|
|
|
//合理用药接口地址
|
|
|
public static String checkInfosUrl="http://192.168.102.243:8040/service/api/check.do?tag=1";
|
|
|
//保存天际处方接口地址
|
|
|
public static String saveTianJiPrescription = "http://192.168.102.243:8040/service/api/checkFromXmlToJson.do?tag=2";
|
|
|
//作废处方地址
|
|
|
public static String deleteTianJiPrescription = "http://192.168.102.243:8040/service/api/checkFromXmlToJson.do?tag=2";
|
|
|
//药品说明书地址http://192.168.102.243:8221/drugs/@code@?source=dcdt_web&show_navbar=true
|
|
|
public static String drugUseInfoTianJi = "http://192.168.102.243:8221/drugs/@code@?source=dcdt_web&show_navbar=true";
|
|
|
public String getSelectUrl(){
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("xzzxWebSelectService");
|
|
@ -932,24 +952,785 @@ public class XzzxEntranceService{
|
|
|
if (!StringUtils.isEmpty(admNo)){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(realOrder)){
|
|
|
condition +="<realOrder>"+realOrder+"</realOrder>";
|
|
|
if (!StringUtils.isEmpty(realOrder)){
|
|
|
condition +="<realOrder>"+realOrder+"</realOrder>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(status)){
|
|
|
condition += "<status>"+status+"</status>";
|
|
|
}
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("updatePreStatus params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("UpdatePreStatus",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("updatePreStatus json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取icd10字典
|
|
|
*
|
|
|
* @param spellCode spellCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetICD10Dict(String spellCode)throws Exception{
|
|
|
String api = "GetICD10Dict";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition += "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetICD10Dict params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("GetICD10Dict json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取药品字典
|
|
|
*
|
|
|
* @param spellCode spellCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetDrugDict(String spellCode)throws Exception{
|
|
|
String api = "GetDrugDict";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition += "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetDrugDict params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("GetDrugDict json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 查询药品用药方法
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetMedicineUsed(String spellCode)throws Exception{
|
|
|
String api = "GetMedicineUsed";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition = "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetMedicineUsed params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("GetMedicineUsed json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取药品用药频次字典
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetFrequencyDict()throws Exception{
|
|
|
String api = "GetFrequencyDict";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetFrequencyDict params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("GetFrequencyDict json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取检查部位字典
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetCheckBody(String spellCode)throws Exception{
|
|
|
String api = "GetCheckBody";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition = "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info(" GetCheckBody params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" GetCheckBody json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取检查单据信息
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetExamApply(String spellCode)throws Exception{
|
|
|
String api = "GetExamApply";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition = "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetExamApply params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" GetExamApply json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取检验单据信息
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetLisApply(String spellCode)throws Exception{
|
|
|
String api = "GetLisApply";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(spellCode)){
|
|
|
condition = "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("GetLisApply params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" GetLisApply json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 互联网医院开处方信息更新到his
|
|
|
* @param IoFlag 门诊住院标志
|
|
|
* @param PayCardNo 就诊卡号
|
|
|
* @param NullahNumber 挂号流水号
|
|
|
* @param ApplyDept 执行科室
|
|
|
* @param ApplyDoctor 开单医生
|
|
|
* @param ExecuteDept 执行科室(药房)
|
|
|
* @param prescriptionInfoDOList
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String savePrescriptionToHospital(String IoFlag,String PayCardNo,String NullahNumber,
|
|
|
String ApplyDept,String ApplyDoctor,String ExecuteDept,List<WlyyPrescriptionInfoDO> prescriptionInfoDOList)throws Exception{
|
|
|
String api = "savePrescriptionToHospital";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(IoFlag)){
|
|
|
condition += "<IoFlag>"+IoFlag+"</IoFlag>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(PayCardNo)){
|
|
|
condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(NullahNumber)){
|
|
|
condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ApplyDept)){
|
|
|
condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ApplyDoctor)){
|
|
|
condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ExecuteDept)){
|
|
|
condition += "<ExecuteDept>"+ExecuteDept+"</ExecuteDept>";
|
|
|
}
|
|
|
condition +="<PresDetail>";
|
|
|
for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOList){
|
|
|
String condition1 = "";
|
|
|
condition1 += "<PhysicCode>"+prescriptionInfoDO.getDrugNo()+"</PhysicCode>";
|
|
|
condition1 += "<Doseage>"+prescriptionInfoDO.getDosage()+"</Doseage>";
|
|
|
condition1 += "<DoseUnit>"+prescriptionInfoDO.getUnit()+"</DoseUnit>";
|
|
|
condition1 += "<Frequency>"+prescriptionInfoDO.getUsageCode()+"</Frequency>";
|
|
|
condition1 += "<DayCount>"+prescriptionInfoDO.getDays()+"</DayCount>";
|
|
|
condition1 += "<Usage>"+prescriptionInfoDO.getSupplyCode()+"</Usage>";
|
|
|
condition1 += "<TotalDoseage>"+prescriptionInfoDO.getQuantity()+"</TotalDoseage>";
|
|
|
condition1 += "<TotalUnit>"+prescriptionInfoDO.getPackUnit()+"</TotalUnit>";
|
|
|
condition1 += "<PrescribeMemo>"+"</PrescribeMemo>";
|
|
|
condition1 += "<FryMode>"+"</FryMode>";
|
|
|
condition1 += "<HerbalTakeMethodClass>"+"</HerbalTakeMethodClass>";
|
|
|
condition1 += "<HerbalFryMethod>"+"</HerbalFryMethod>";
|
|
|
condition1 += "<HerbalFryMethod2>"+"</HerbalFryMethod2>";
|
|
|
condition+="<PresInfo>"+condition1+"</PresInfo>";
|
|
|
}
|
|
|
condition+="</PresDetail>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("savePrescriptionToHospital params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" savePrescriptionToHospital json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 互联网医院删除处方信息更新到his
|
|
|
* @param IoFlag 门诊住院标志
|
|
|
* @param PayCardNo 就诊卡号
|
|
|
* @param NullahNumber 挂号流水号
|
|
|
* @param ApplyDept 执行科室
|
|
|
* @param ApplyDoctor 开单医生
|
|
|
* @param ExecuteDept 执行科室(药房)
|
|
|
* @param PresNo 必填,医嘱号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String delHisPrescriptionByHisNo(String IoFlag,String PayCardNo,String NullahNumber,
|
|
|
String ApplyDept,String ApplyDoctor,String ExecuteDept,String PresNo)throws Exception{
|
|
|
String api = "delHisPrescriptionByHisNo";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(IoFlag)){
|
|
|
condition += "<IoFlag>"+IoFlag+"</IoFlag>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(PayCardNo)){
|
|
|
condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(NullahNumber)){
|
|
|
condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ApplyDept)){
|
|
|
condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ApplyDoctor)){
|
|
|
condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ExecuteDept)){
|
|
|
condition += "<ExecuteDept>"+ExecuteDept+"</ExecuteDept>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(PresNo)){
|
|
|
condition += "<PresNo>"+PresNo+"</PresNo>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("delHisPrescriptionByHisNo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("delHisPrescriptionByHisNo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存入门诊断信息到his
|
|
|
* @param ApplyNo
|
|
|
* @param DiagnosisName
|
|
|
* @param DiagnosisCode
|
|
|
* @param ChnSymPtomsCode
|
|
|
* @param ChnSymPtomsName
|
|
|
* @param ChnDiagnosisCode
|
|
|
* @param ChnDiagnosisName
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String saveDiagnosis(String ApplyNo,String DiagnosisName,String DiagnosisCode,
|
|
|
String ChnSymPtomsCode,String ChnSymPtomsName,String ChnDiagnosisCode,String ChnDiagnosisName)throws Exception{
|
|
|
String api = "saveDiagnosis";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(ApplyNo)){
|
|
|
condition += "<ApplyNo>"+ApplyNo+"</ApplyNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(DiagnosisName)){
|
|
|
condition += "<DiagnosisName>"+DiagnosisName+"</DiagnosisName>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(DiagnosisCode)){
|
|
|
condition += "<DiagnosisCode>"+DiagnosisCode+"</DiagnosisCode>";
|
|
|
}
|
|
|
condition+="<ChnSymPtomsCode>"+"</ChnSymPtomsCode>";
|
|
|
condition+="<ChnSymPtomsName>"+"</ChnSymPtomsName>";
|
|
|
condition+="<ChnDiagnosisCode>"+"</ChnDiagnosisCode>";
|
|
|
condition+="<ChnDiagnosisName>"+"</ChnDiagnosisName>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("saveDiagnosis params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" saveDiagnosis json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 发送退号信息到his
|
|
|
* @param ApplyNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String refundConsultation(String ApplyNo,String PayCardNo)throws Exception{
|
|
|
String api = "refundConsultation";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
if (!StringUtils.isEmpty(ApplyNo)){
|
|
|
condition += "<ApplyNo>"+ApplyNo+"</ApplyNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(PayCardNo)){
|
|
|
condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("refundConsultation params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("refundConsultation json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 组装检查检验项目参数
|
|
|
*
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
public String saveInspectToHospital(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,List<WlyyInspectionDO> wlyyInspectionDOS) throws Exception{
|
|
|
String api = "saveInspectToHospital";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
condition = "<IoFlag>"+IoFlag+"</IoFlag>";
|
|
|
StringBuffer inspectionList = new StringBuffer();
|
|
|
condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
|
|
|
condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
|
|
|
condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
|
|
|
condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
|
|
|
for (WlyyInspectionDO wlyyInspectionDO:wlyyInspectionDOS){
|
|
|
inspectionList.append("<PresInfo>");
|
|
|
inspectionList.append("<ClinicCode>"+wlyyInspectionDO.getCode()+"</ClinicCode>");
|
|
|
inspectionList.append("<ClinicNum>"+wlyyInspectionDO.getQuantity()+"</ClinicNum>");
|
|
|
inspectionList.append("<ExecuteDept>"+wlyyInspectionDO.getDept()+"</ExecuteDept>");
|
|
|
inspectionList.append("<CheckResult>"+wlyyInspectionDO.getYwjcResult()+"</CheckResult>");
|
|
|
inspectionList.append("<CheckPart>"+wlyyInspectionDO.getCheckPart()+"</CheckPart>");
|
|
|
inspectionList.append("<SickSynptom>"+"临床症状和体征 "+"</SickSynptom>");
|
|
|
inspectionList.append("<Height>"+"身高"+"</Height>");
|
|
|
inspectionList.append("<Weight>"+"体重"+"</Weight>");
|
|
|
inspectionList.append("<SensitiveName>"+"过敏史"+"</SensitiveName>");
|
|
|
inspectionList.append("<SampleCode>"+"标本类型"+"</SampleCode>");
|
|
|
inspectionList.append("<ChiefComplaint>"+"主诉"+"</ChiefComplaint>");
|
|
|
inspectionList.append("<MedicalHistory>"+wlyyInspectionDO.getInformation()+"</MedicalHistory>");
|
|
|
inspectionList.append("<InspectionPurpose>"+wlyyInspectionDO.getGoal()+"</InspectionPurpose>");
|
|
|
inspectionList.append("<PastHistory>"+"既往史"+"</PastHistory>");
|
|
|
inspectionList.append("<LisCheckResult>"+wlyyInspectionDO.getYwjcResult()+"</LisCheckResult>");
|
|
|
inspectionList.append("<InspectionResult>"+wlyyInspectionDO.getAdresult()+"</InspectionResult>");
|
|
|
inspectionList.append("<InspectionNotice>"+"注意事项"+"</InspectionNotice>");
|
|
|
inspectionList.append("<Memo>"+wlyyInspectionDO.getCode()+"</Memo>");
|
|
|
inspectionList.append("</PresInfo>");
|
|
|
}
|
|
|
condition += "<PresDetail>" +inspectionList.toString()+"</PresDetail>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("saveInspectToHospital params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info(" saveInspectToHospital json:"+json);
|
|
|
return json;
|
|
|
|
|
|
}
|
|
|
/*
|
|
|
*合理用药审核接口入参
|
|
|
*/
|
|
|
public String checkPrescriptionInfoParam(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos,boolean isDelete){
|
|
|
String checkDoctor="<Doctor POSITION=\""+patientAndDoctor.getString("POSITION")+
|
|
|
"\" NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
|
|
|
"\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+
|
|
|
"\" DEPT_NAME=\""+patientAndDoctor.getString("DEPT_NAME")+"\" USER_ID=\""+patientAndDoctor.getString("DOCTOR_ID")+"\" />";
|
|
|
String checkPatient="<Patient NAME=\""+patientAndDoctor.getString("PATIENT_NAME")+
|
|
|
"\" ID=\""+patientAndDoctor.getString("PATIENT_ID")+
|
|
|
"\" VISIT_ID=\"0\" PATIENT_PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
|
|
|
"\" BIRTH=\""+patientAndDoctor.getString("BIRTH")+
|
|
|
"\" HEIGHT=\"\" WEIGHT=\"\" GENDER=\""+patientAndDoctor.getString("GENDER")+
|
|
|
"\" PREGNANT=\"\" LACT=\"否\" HEPATICAL=\"\" RENAL=\"\" PANCREAS=\"\" ALERGY_DRUGS=\"\" IDENTITY_TYPE=\"\" FEE_TYPE=\""+patientAndDoctor.getString("FEE_TYPE")+
|
|
|
"\" SCR=\"\" SCR_UNIT=\"\" GESTATION_AGE=\"\" PRETERM_BIRTH=\"\" DRUG_HISTORY=\"\" FAMILY_DISEASE_HISTORY=\"\" GENETIC_DISEASE=\"\" MEDICARE_01=\"\" MEDICARE_02=\"\" MEDICARE_03=\"\" MEDICARE_04=\"\" MEDICARE_05=\"\" />";
|
|
|
String checkDiagnosises = "<Diagnosises DIAGNOSISES=\""+patientAndDoctor.getString("diagnosises")+"\" >\n" +
|
|
|
"</Diagnosises>\n";
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
if(null!=infos&&infos.size()>0){
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:infos){
|
|
|
int i = 1;
|
|
|
stringBuffer.append("<Advice REPEAT=\"1\" DRUG_LO_NAME=\""+wlyyPrescriptionInfoDO.getDrugName()+
|
|
|
"\" DRUG_LO_ID=\""+wlyyPrescriptionInfoDO.getHisCode()+"\" ADMINISTRATION=\""+wlyyPrescriptionInfoDO.getSupplyName()+
|
|
|
"\" DOSAGE=\""+wlyyPrescriptionInfoDO.getDosage()+
|
|
|
"\" DOSAGE_UNIT=\""+wlyyPrescriptionInfoDO.getUnitName()+
|
|
|
"\" FREQ_COUNT=\""+wlyyPrescriptionInfoDO.getUsageCode()+
|
|
|
"\" FREQ_INTERVAL=\"\" FREQ_INTERVAL_UNIT=\"\" START_DAY=\""+patientAndDoctor.getString("CREATE_DATE")+"\" END_DAY=\"\"" +
|
|
|
" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+"\" DOCTOR_NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
|
|
|
"\" ORDER_NO=\""+i+
|
|
|
"\" ORDER_SUB_NO=\""+1+"\" AUTHORITY_LEVELS=\"\" ALERT_LEVELS=\"\" TITLE=\""+patientAndDoctor.getString("POSITION") +
|
|
|
"\" GROUP_ID=\""+i+"\" USER_ID=\""+patientAndDoctor.getString("DOCTOR_ID")+
|
|
|
"\" PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
|
|
|
"\" PRES_DATE=\""+patientAndDoctor.getString("CREATE_DATE")+
|
|
|
"\" PRES_SEQ_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
|
|
|
"\" PK_ORDER_NO=\"\" COURSE=\""+wlyyPrescriptionInfoDO.getDays()+
|
|
|
"\" PKG_COUNT=\""+wlyyPrescriptionInfoDO.getPackQuantity()+
|
|
|
"\" PKG_UNIT=\""+wlyyPrescriptionInfoDO.getPackUnitName()+"\" BAK_01=\"\" BAK_02=\"\" BAK_03=\""+wlyyPrescriptionInfoDO.getUnitName()+
|
|
|
"\" BAK_04=\""+wlyyPrescriptionInfoDO.getSpecification()+
|
|
|
"\" BAK_05=\""+wlyyPrescriptionInfoDO.getDrugPlace()+"\" />");
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
|
String checkInfos = "<Advices></Advices>";
|
|
|
if (!isDelete){
|
|
|
checkInfos= "<Advices>"+stringBuffer.toString()+"</Advices>";
|
|
|
}
|
|
|
String postBody = "<CheckInput TAG=\"2\" INPATIENT=\"否\">"+checkDoctor+checkPatient+checkDiagnosises+checkInfos+"</CheckInput>";
|
|
|
return postBody;
|
|
|
}
|
|
|
/*
|
|
|
*合理用药审核接口
|
|
|
*/
|
|
|
public String checkPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
|
|
|
String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,false);
|
|
|
logger.info("发送的报文参数:"+postBody);
|
|
|
String res = httpClientUtil.sendPost(checkInfosUrl,postBody);
|
|
|
logger.info("返回的报文参数:"+res);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(postBody);
|
|
|
wlyyHttpLogDO.setResponse(res);
|
|
|
wlyyHttpLogDO.setName("checkPrescriptionInEntrance");
|
|
|
return res;
|
|
|
}
|
|
|
/*
|
|
|
*合理用药保存接口
|
|
|
*/
|
|
|
public String saveCheckPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
|
|
|
String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,false);
|
|
|
logger.info("保存处方的报文参数:"+postBody);
|
|
|
String res = httpClientUtil.sendPost(saveTianJiPrescription,postBody);
|
|
|
logger.info("保存处方的报文参数:"+res);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(postBody);
|
|
|
wlyyHttpLogDO.setResponse(res);
|
|
|
wlyyHttpLogDO.setName("checkPrescriptionInEntrance");
|
|
|
return res;
|
|
|
}
|
|
|
/*
|
|
|
*合理用药作废接口
|
|
|
*/
|
|
|
public String deleteCheckPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
|
|
|
String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,true);
|
|
|
logger.info("作废的报文参数:"+postBody);
|
|
|
logger.info("deleteTianJiPrescription:"+deleteTianJiPrescription);
|
|
|
String res = httpClientUtil.sendPost(deleteTianJiPrescription,postBody);
|
|
|
logger.info("作废的报文参数:"+res);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(postBody);
|
|
|
wlyyHttpLogDO.setResponse(res);
|
|
|
wlyyHttpLogDO.setName("checkPrescriptionInEntrance");
|
|
|
return res;
|
|
|
}
|
|
|
public List<Map<String,Object>> transXmlCommen(String xml){
|
|
|
Document doc = null;
|
|
|
List<Map<String,Object>> returnMap= new ArrayList<>();
|
|
|
try {
|
|
|
doc = (new Builder()).build(new StringReader(xml));
|
|
|
Element root = doc.getRootElement();
|
|
|
Elements elements = root.getChildElements();
|
|
|
for (int i=0;i<elements.size();i++){
|
|
|
Map<String,Object> personInfoMap = new HashMap<>();
|
|
|
Element personInfo = elements.get(i);
|
|
|
for (int j=0;j<personInfo.getAttributeCount();j++){
|
|
|
Attribute attribute = personInfo.getAttribute(j);
|
|
|
personInfoMap.put(attribute.getLocalName(),attribute.getValue());
|
|
|
}
|
|
|
List<Map<String,Object>> checkInfoMapList= new ArrayList<>();
|
|
|
if (personInfo.getChildElements().size()>0){
|
|
|
Elements checkInfos = personInfo.getChildElements();
|
|
|
for(int ci=0;ci<checkInfos.size();ci++){
|
|
|
Element checkInfo = checkInfos.get(ci);
|
|
|
Map<String,Object> checkInfoMap = new HashMap<>();
|
|
|
for (int n = 0;n<checkInfo.getAttributeCount();n++){
|
|
|
Attribute attribute2 = checkInfo.getAttribute(n);
|
|
|
checkInfoMap.put(attribute2.getLocalName(),attribute2.getValue());
|
|
|
}
|
|
|
checkInfoMapList.add(checkInfoMap);
|
|
|
}
|
|
|
}
|
|
|
personInfoMap.put("checkInfoMapList",checkInfoMapList);
|
|
|
returnMap.add(personInfoMap);
|
|
|
}
|
|
|
} catch (ParsingException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
public List<PersonInfoVO> transXml(String xml) throws Exception {
|
|
|
Document doc = (new Builder()).build(new StringReader(xml));
|
|
|
Element root = doc.getRootElement();
|
|
|
Elements presInfos = root.getChildElements("PresInfo");
|
|
|
List<PersonInfoVO> personInfoVOS = new ArrayList<>();
|
|
|
for (int i=0;i<presInfos.size();i++){
|
|
|
PersonInfoVO personInfoVO = new PersonInfoVO();
|
|
|
List<CheckInfoVO> checkInfoVOS = new ArrayList<>();
|
|
|
Element presInfo = presInfos.get(i);
|
|
|
personInfoVO.setDrugLoId(presInfo.getAttributeValue("DRUG_LO_ID"));
|
|
|
personInfoVO.setDrugLoName(presInfo.getAttributeValue("DRUG_LO_NAME"));
|
|
|
personInfoVO.setOrderId(presInfo.getAttributeValue("ORDER_ID"));
|
|
|
personInfoVO.setOrderSubId(presInfo.getAttributeValue("ORDER_SUB_ID"));
|
|
|
Elements checkinfos = presInfo.getChildElements();
|
|
|
if (checkinfos.size()>0){
|
|
|
for (int j=0;j<checkinfos.size();j++){
|
|
|
CheckInfoVO checkInfoVO = new CheckInfoVO();
|
|
|
Element checkinfo = checkinfos.get(j);
|
|
|
checkInfoVO.setColor(checkinfo.getAttributeValue("COLOR"));
|
|
|
checkInfoVO.setName(checkinfo.getAttributeValue("NAME"));
|
|
|
checkInfoVO.setRefResource(checkinfo.getAttributeValue("REF_SOURCE"));
|
|
|
checkInfoVO.setWarningInfo(checkinfo.getAttributeValue("WARNING_INFO"));
|
|
|
checkInfoVO.setWarningLevel(checkinfo.getAttributeValue("WARNING_LEVEL"));
|
|
|
checkInfoVOS.add(checkInfoVO);
|
|
|
}
|
|
|
personInfoVO.setCheckInfoVOS(checkInfoVOS);
|
|
|
}
|
|
|
personInfoVOS.add(personInfoVO);
|
|
|
}
|
|
|
return personInfoVOS;
|
|
|
}
|
|
|
/**
|
|
|
* 同步门诊病历
|
|
|
* @return
|
|
|
*/
|
|
|
public String returnEmrHtmlByHLW(JSONObject jsonObject,WlyyPrescriptionEmrDO prescriptionEmrDO)throws Exception{
|
|
|
String api = "returnEmrHtmlByHLW";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
String htmlDeo = "";
|
|
|
if (null!=prescriptionEmrDO){
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("EMRHTMLDEMO");
|
|
|
if (null!=wlyyHospitalSysDictDO){
|
|
|
htmlDeo = wlyyHospitalSysDictDO.getDictValue();
|
|
|
htmlDeo = htmlDeo.replace("@patientName@",jsonObject.getString("patientName"));
|
|
|
htmlDeo = htmlDeo.replace("@patientAge@",jsonObject.getString("patientAge"));
|
|
|
htmlDeo = htmlDeo.replace("@patientsex@",jsonObject.getString("patientsex"));
|
|
|
htmlDeo = htmlDeo.replace("@deptCode@",jsonObject.getString("deptCode"));
|
|
|
htmlDeo = htmlDeo.replace("@r+outpatientCode@",jsonObject.getString("outpatientCode"));
|
|
|
htmlDeo = htmlDeo.replace("@patientClan@",jsonObject.getString("patientClan"));
|
|
|
htmlDeo = htmlDeo.replace("@Special@",prescriptionEmrDO.getSpecialHistory());
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:MM");
|
|
|
htmlDeo = htmlDeo.replace("@createTime@",sf.format(prescriptionEmrDO.getCreateTime()));
|
|
|
htmlDeo = htmlDeo.replace("@complaint@",prescriptionEmrDO.getComplaint());
|
|
|
htmlDeo = htmlDeo.replace("@medicalHistory@",prescriptionEmrDO.getMedicalHistory());
|
|
|
htmlDeo = htmlDeo.replace("@popularHistory@",prescriptionEmrDO.getPopularHistory());
|
|
|
htmlDeo = htmlDeo.replace("@pastHistory@",prescriptionEmrDO.getPastHistory());
|
|
|
htmlDeo = htmlDeo.replace("@allergicHistory@",prescriptionEmrDO.getAllergicHistory());
|
|
|
htmlDeo = htmlDeo.replace("@physicalExamination@",prescriptionEmrDO.getPhysicalExamination());
|
|
|
htmlDeo = htmlDeo.replace("@assistExamination@",prescriptionEmrDO.getAssistExamination());
|
|
|
condition+="<content>"+htmlDeo+"</content>";
|
|
|
}
|
|
|
}
|
|
|
if ( null!=jsonObject.get("patientid")) {
|
|
|
condition+="<patientid>"+jsonObject.getString("patientid")+"</patientid>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(status)){
|
|
|
condition += "<status>"+status+"</status>";
|
|
|
if ( null!=jsonObject.get("eventno")) {
|
|
|
condition+="<eventno>"+jsonObject.getString("eventno")+"</eventno>";
|
|
|
}
|
|
|
if ( null!=jsonObject.get("type")) {
|
|
|
condition+="<type>"+jsonObject.getString("type")+"</type>";
|
|
|
}
|
|
|
if ( null!=jsonObject.get("templateid")) {
|
|
|
condition+="<templateid>"+jsonObject.getString("templateid")+"</templateid>";
|
|
|
}
|
|
|
if ( null!=jsonObject.get("emrtitle")) {
|
|
|
condition+="<emrtitle>"+jsonObject.getString("emrtitle")+"</emrtitle>";
|
|
|
}
|
|
|
if (null!=jsonObject.get("catalogid")){
|
|
|
condition += "<catalogid>"+jsonObject.getString("catalogid")+"</catalogid>";
|
|
|
}
|
|
|
if (null!=jsonObject.get("operatorname")){
|
|
|
condition += "<operatorname>"+jsonObject.getString("operatorname")+"</operatorname>";
|
|
|
}
|
|
|
if (null!=jsonObject.get("operatorid")){
|
|
|
condition += "<operatorid>"+jsonObject.getString("operatorid")+"</operatorid>";
|
|
|
}
|
|
|
if (null!=jsonObject.get("emrtype")){
|
|
|
condition += "<emrtype>"+jsonObject.getString("emrtype")+"</emrtype>";
|
|
|
}
|
|
|
if (null!=jsonObject.get("id")){
|
|
|
condition += "<id>"+jsonObject.getString("id")+"</id>";
|
|
|
}
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("updatePreStatus params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("UpdatePreStatus",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("updatePreStatus json:"+json);
|
|
|
return json;
|
|
|
logger.info("returnEmrHtmlByHLW params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
logger.info("returnEmrHtmlByHLW json:"+xml);
|
|
|
|
|
|
return xml;
|
|
|
}
|
|
|
//=====================微信模板消息推送===================================
|
|
|
|
|
@ -1119,7 +1900,6 @@ public class XzzxEntranceService{
|
|
|
return array;
|
|
|
}
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@ -1251,6 +2031,39 @@ public class XzzxEntranceService{
|
|
|
return patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
|
|
|
public String updatePatientMapping(String patient,String cardNo){
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
String response="";
|
|
|
String idCard = patientDO.getIdcard();
|
|
|
String url = entranceUrl+"findPatientCard?idCard="+idCard;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object1 = array.getJSONObject(i);
|
|
|
if (object1.getString("CARD_NO").equalsIgnoreCase(cardNo)){
|
|
|
if (patientMappingDO==null){
|
|
|
patientMappingDO = new PatientMappingDO();
|
|
|
patientMappingDO.setIdcard(patientDO.getIdcard());
|
|
|
patientMappingDO.setPatientName(patientDO.getName());
|
|
|
patientMappingDO.setPatient(patientDO.getId());
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDO.setSource("1");
|
|
|
patientMappingDO.setMappingCode(object1.getString("SICKID"));
|
|
|
}else {
|
|
|
patientMappingDO.setMappingCode(object1.getString("SICKID"));
|
|
|
}
|
|
|
patientMappingDO = patientMappingDao.save(patientMappingDO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
return patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取门诊就诊记录列表
|
|
|
* @param patient 居民id
|
|
@ -1351,7 +2164,7 @@ public class XzzxEntranceService{
|
|
|
outpatientVO.setHospitalName("厦门大学附属心血管病医院");
|
|
|
outpatientVO.setHospital("350211A5010");
|
|
|
outpatientVO.setSex(patientDO.getSex()+"");
|
|
|
outpatientVO.setPatient(patient);
|
|
|
outpatientVO.setPatient(patientDO.getId());
|
|
|
outpatientVO.setBirthday(patientDO.getBirthday());
|
|
|
}
|
|
|
}
|
|
@ -1817,6 +2630,502 @@ public class XzzxEntranceService{
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取icd10字典
|
|
|
* @param spellCode 拼音码
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectIcd10Dict(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getICD10Dict?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("add_code","");
|
|
|
object1.put("code",jsonObject.getString("ICD10_CODE"));
|
|
|
object1.put("d_code",jsonObject.getString(""));
|
|
|
object1.put("name",jsonObject.getString("ICD10_NAME"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("valid_flag",jsonObject.getString("VALID_FLAG"));
|
|
|
object1.put("icd10_type",jsonObject.getString("ICD10_TYPE"));
|
|
|
object1.put("icd10_class",jsonObject.getString("ICD10_CLASS"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取药品字典
|
|
|
* @param spellCode 拼音码
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectDrugDict(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getDrugDict?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("charge_code",jsonObject.getString("PHYSIC_CODE"));
|
|
|
object1.put("serial","");
|
|
|
object1.put("group_no","");
|
|
|
object1.put("drugname",jsonObject.getString("PHYSIC_NAME"));
|
|
|
object1.put("dosage",jsonObject.getString("DOSE_UNIT"));
|
|
|
object1.put("MIN_DOSE",jsonObject.getString("MIN_DOSE"));
|
|
|
object1.put("mini_unit",jsonObject.getString("PHYSIC_UNIT"));
|
|
|
object1.put("pack_size",jsonObject.getString("PACK_SPEC"));
|
|
|
object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
|
|
|
object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
|
|
|
object1.put("pack_retprice",jsonObject.getString("RETAIL_PRICE"));
|
|
|
object1.put("stock_amount","");
|
|
|
object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
|
|
|
object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("pack_unit",jsonObject.getString("PRICE_UNIT"));
|
|
|
object1.put("manu_name",jsonObject.getString("SUPPLIER_NAME"));
|
|
|
object1.put("weigh_unit",jsonObject.getString("DOSE_UNIT"));
|
|
|
object1.put("vol_unit","");
|
|
|
object1.put("mini_unit_name",jsonObject.getString("PHYSIC_UNIT"));
|
|
|
object1.put("pack_unit_name",jsonObject.getString("PRICE_UNIT"));
|
|
|
object1.put("weigh_unit_name",jsonObject.getString("DOSE_UNIT"));
|
|
|
object1.put("vol_unit_name","");
|
|
|
object1.put("win_no","");
|
|
|
object1.put("jbyw",jsonObject.getString("BASE_PHYSIC_FLAG"));
|
|
|
object1.put("gwyp","");
|
|
|
object1.put("bz_dosage",jsonObject.getString("DOSEAGE"));
|
|
|
object1.put("bz_supply",jsonObject.getString("USAGE"));
|
|
|
object1.put("bz_supply_name",jsonObject.getString("USAGE"));
|
|
|
object1.put("bz_unit",jsonObject.getString("DOSEAGE_UNIT"));
|
|
|
object1.put("bz_unit_name",jsonObject.getString("DOSEAGE_UNIT"));
|
|
|
object1.put("bz_usage",jsonObject.getString("FREQUENCY"));
|
|
|
object1.put("bz_usage_name",jsonObject.getString("FREQUENCY"));
|
|
|
object1.put("QUANTITY",jsonObject.getString("QUANTITY"));
|
|
|
object1.put("DAY_COUNT",jsonObject.getString("DAY_COUNT"));
|
|
|
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询药品用药方法
|
|
|
* @param spellCode 拼音码
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectMedicineUsed(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getMedicineUsed?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("d_code",jsonObject.getString("ITEM_CODE"));
|
|
|
object1.put("supply_code",jsonObject.getString("TAKE_MEDICINE_WAYS_CODE"));
|
|
|
object1.put("supply_name",jsonObject.getString("TAKE_MEDICINE_WAYS_NAME"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("del_flag","");
|
|
|
object1.put("yb_code","");
|
|
|
object1.put("yb_name",jsonObject.getString("MEMO"));
|
|
|
object1.put("print_name",jsonObject.getString("TAKE_MEDICINE_WAYS_NAME"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取药品用药频次字典
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectFrequencyDict() throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getFrequencyDict";
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("DAILY_TIMES",jsonObject.getString("FREQ_COUNT"));
|
|
|
object1.put("FREQ_CODE",jsonObject.getString("FREQ_DESCRIBE"));
|
|
|
object1.put("FREQ_DESCRIBE_CODE",jsonObject.getString("FREQ_DESCRIBE_CODE"));
|
|
|
object1.put("FREQ_DESCRIBE",jsonObject.getString("FREQ_DESCRIBE"));
|
|
|
object1.put("PHYSIC_NOTUSE_FLAG",jsonObject.getString("PHYSIC_NOTUSE_FLAG"));
|
|
|
object1.put("FREQ_NAME",jsonObject.getString("FREQ_MEMO"));
|
|
|
object1.put("INSUR_FREQ_DESCRIBE",jsonObject.getString("INSUR_FREQ_DESCRIBE"));
|
|
|
object1.put("FREQ_INTERVAL",jsonObject.getString("FREQ_INTERVAL"));
|
|
|
object1.put("FREQ_INTERVAL_UNIT",jsonObject.getString("FREQ_INTERVAL_UNIT"));
|
|
|
object1.put("DEFAULT_SCHEDULE",jsonObject.getString("DEFAULT_SCHEDULE"));
|
|
|
object1.put("EXECUTE_TIME_FLAG",jsonObject.getString("EXECUTE_TIME_FLAG"));
|
|
|
object1.put("DAY_FLAG",jsonObject.getString("DAY_FLAG"));
|
|
|
object1.put("WEEK_FLAG",jsonObject.getString("WEEK_FLAG"));
|
|
|
object1.put("WEEK_1",jsonObject.getString("WEEK_1"));
|
|
|
object1.put("WEEK_2",jsonObject.getString("WEEK_2"));
|
|
|
object1.put("WEEK_3",jsonObject.getString("WEEK_3"));
|
|
|
object1.put("WEEK_4",jsonObject.getString("WEEK_4"));
|
|
|
object1.put("WEEK_5",jsonObject.getString("WEEK_5"));
|
|
|
object1.put("WEEK_6",jsonObject.getString("WEEK_6"));
|
|
|
object1.put("WEEK_7",jsonObject.getString("WEEK_7"));
|
|
|
object1.put("SPELL_CODE",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("VALID_FLAG",jsonObject.getString("VALID_FLAG"));
|
|
|
object1.put("WEEKLY_TIMES","");
|
|
|
object1.put("IS_OP_IP","");
|
|
|
object1.put("HOSP_CODE","");
|
|
|
object1.put("FREQ_SP",jsonObject.getString("MEMO"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询检查部位
|
|
|
* @param spellCode 拼音码
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectCheckBody(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getCheckBody?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("name",jsonObject.getString("NAME"));
|
|
|
object1.put("code",jsonObject.getString("CODE"));
|
|
|
object1.put("data",jsonObject.getString("DATA"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("memo",jsonObject.getString("MEMO"));
|
|
|
object1.put("wb_code",jsonObject.getString("WBZX_CODE"));
|
|
|
object1.put("sequence",jsonObject.getString("SEQUENCE"));
|
|
|
object1.put("valid",jsonObject.getString("VALID"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
/**
|
|
|
* 查询检查项目
|
|
|
* @param spellCode 拼音码或药品名字
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectExamApply(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getExamApply?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("name",jsonObject.getString("ITEM_NAME"));
|
|
|
object1.put("code",jsonObject.getString("ITEM_CODE"));
|
|
|
object1.put("type",jsonObject.getString("ITEM_CLASS"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
|
|
|
object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
|
|
|
object1.put("charge_unit",jsonObject.getString("UNIT"));
|
|
|
object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
|
|
|
object1.put("memo",jsonObject.getString("MEMO"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
/**
|
|
|
* 查询检验项目
|
|
|
* @param spellCode 拼音码或药品名字
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectLisApply(String spellCode) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getLisApply?spellCode="+spellCode;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
JSONObject object1 = new JSONObject();
|
|
|
object1.put("@action","select");
|
|
|
object1.put("name",jsonObject.getString("ITEM_NAME"));
|
|
|
object1.put("code",jsonObject.getString("ITEM_CODE"));
|
|
|
object1.put("type",jsonObject.getString("ITEM_CLASS"));
|
|
|
object1.put("py_code",jsonObject.getString("SPELL_CODE"));
|
|
|
object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
|
|
|
object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
|
|
|
object1.put("charge_unit",jsonObject.getString("UNIT"));
|
|
|
object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
|
|
|
object1.put("memo",jsonObject.getString("MEMO"));
|
|
|
jsonArray.add(object1);
|
|
|
}
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
/**
|
|
|
* 检查检验项目同步his
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String wlyyInspectionS) throws Exception {
|
|
|
String response="";
|
|
|
Map resultMap=new HashMap();
|
|
|
String url = entranceUrl+"saveInspectToHospital?IoFlag="+IoFlag+"&PayCardNo="+PayCardNo+"&NullahNumber="+NullahNumber+
|
|
|
"&ApplyDept="+ApplyDept+
|
|
|
"&ApplyDoctor="+ApplyDoctor+"&wlyyInspectionS="+wlyyInspectionS;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
JSONObject rootObject = JSONObject.parseObject(obj);
|
|
|
if (null!=rootObject&&"0".equalsIgnoreCase(rootObject.getString("code"))){
|
|
|
resultMap.put("success",rootObject.getString("success"));
|
|
|
resultMap.put("code",rootObject.getString("code"));
|
|
|
resultMap.put("msg",rootObject.getString("msg"));
|
|
|
JSONObject dataObj = JSONObject.parseObject(rootObject.getString("data"));
|
|
|
if (null!=dataObj){
|
|
|
JSONObject presDetailobj = JSONObject.parseObject(dataObj.getString("PresDetail"));
|
|
|
resultMap.put("msg",presDetailobj.getString("PresNo"));
|
|
|
logger.info("his医嘱号:"+presDetailobj.getString("PresNo"));
|
|
|
}
|
|
|
}else if(null!=rootObject&&!"0".equalsIgnoreCase(rootObject.getString("code"))){
|
|
|
resultMap.put("success",rootObject.getString("success"));
|
|
|
resultMap.put("code",rootObject.getString("code"));
|
|
|
resultMap.put("msg",rootObject.getString("msg"));
|
|
|
}else {
|
|
|
resultMap.put("success","obj转化失败");
|
|
|
}
|
|
|
}else {
|
|
|
resultMap.put("success","调用entrance接口返回失败");
|
|
|
}
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存处方到entrance
|
|
|
* @param ioFlag 门诊住院标志
|
|
|
* @param payCardNo 就诊卡号
|
|
|
* @param nullahNumber 挂号流水号
|
|
|
* @param applyDept 执行科室
|
|
|
* @param applyDoctor 开单医生
|
|
|
* @param executeDept 执行科室(药房)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject savePrescriptionToEntrance(String ioFlag,String payCardNo,String nullahNumber,String applyDept,String applyDoctor,String executeDept,List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS) throws Exception {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"savePrescriptionToHospital";
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
JSONArray array = new JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
|
|
|
array.add(wlyyPrescriptionInfoDO);
|
|
|
}
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("IoFlag",ioFlag);
|
|
|
params.put("PayCardNo",payCardNo);
|
|
|
params.put("NullahNumber",nullahNumber);
|
|
|
params.put("ApplyDept",applyDept);
|
|
|
params.put("ApplyDoctor",applyDoctor);
|
|
|
params.put("ExecuteDept",executeDept);
|
|
|
params.put("prescriptionInfoDOS", array.toJSONString());
|
|
|
logger.info("prescriptionInfoDOS"+params.get("prescriptionInfoDOS"));
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("开方成功"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
jsonObject = object.getJSONObject("obj");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存诊断到entrance
|
|
|
* @param applyNo 必填,流水号
|
|
|
* @param diagnosisName 必填,诊断名称
|
|
|
* @param diagnosisCode 诊断代码
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject saveDiagnosisToEntrance(String applyNo,String diagnosisName,String diagnosisCode) throws Exception {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"saveDiagnosis";
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("ApplyNo",applyNo);
|
|
|
params.put("DiagnosisName",diagnosisName);
|
|
|
params.put("DiagnosisCode",diagnosisCode);
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("诊断同步"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
jsonObject = object.getJSONObject("obj");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送退号信息到entrance
|
|
|
* @param applyNo 必填,流水号
|
|
|
* @param payCardNo 必填,卡号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject refundConsultationToEntrance(String applyNo,String payCardNo) throws Exception {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"refundConsultation";
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("ApplyNo",applyNo);
|
|
|
params.put("PayCardNo",payCardNo);
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("诊断同步"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
jsonObject = object.getJSONObject("obj");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
/**
|
|
|
* 删除处方信息
|
|
|
* @param realOrder his处方号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject deletePrescriptionToEntrance(String realOrder) throws Exception {
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
|
|
|
if (null!=wlyyPrescriptionDO){
|
|
|
params.put("IoFlag","0");
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
|
|
|
if (null!=wlyyOutpatientDO){
|
|
|
params.put("PayCardNo",wlyyOutpatientDO.getCardNo());
|
|
|
params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
|
|
|
params.put("ApplyDept",wlyyOutpatientDO.getDept());
|
|
|
}
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
|
|
|
if (null!=doctorMappingDO){
|
|
|
params.put("ApplyDoctor",doctorMappingDO.getMappingCode());
|
|
|
}
|
|
|
params.put("ExecuteDept","50100");
|
|
|
params.put("PresNo",realOrder);
|
|
|
}
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"delHisPrescriptionByHisNo";
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("删除处方信息"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
jsonObject = object.getJSONObject("obj");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
/**
|
|
|
* 保存电子病历
|
|
|
* @param prescriptionId 处方id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject saveEmrToEntrance(String prescriptionId) throws Exception {
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
JSONObject paramRequest = new JSONObject();
|
|
|
if (null!=wlyyPrescriptionDO){
|
|
|
paramRequest.put("patientName",wlyyPrescriptionDO.getPatientName());
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyPrescriptionDO.getPatientCode());
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode());
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
|
|
|
if(null!=patientMappingDO){
|
|
|
paramRequest.put("patientid",patientMappingDO.getMappingCode());
|
|
|
}
|
|
|
if(null!=doctorMappingDO){
|
|
|
paramRequest.put("operatorid",doctorMappingDO.getMappingCode());
|
|
|
paramRequest.put("operatorname",wlyyPrescriptionDO.getDoctorName());
|
|
|
}
|
|
|
paramRequest.put("type","2");
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
|
|
|
if (null!=wlyyPrescriptionEmrDO){
|
|
|
paramRequest.put("id",wlyyPrescriptionEmrDO.getId());
|
|
|
params.put("emrInfo",JSON.toJSONString(wlyyPrescriptionEmrDO));
|
|
|
}
|
|
|
if (null!=basePatientDO){
|
|
|
paramRequest.put("patientAge",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
|
|
|
paramRequest.put("patientsex",IdCardUtil.getSexForIdcard(basePatientDO.getIdcard()));
|
|
|
paramRequest.put("patientName",basePatientDO.getName());
|
|
|
paramRequest.put("patientClan","0");
|
|
|
}
|
|
|
if (null!=wlyyOutpatientDO){
|
|
|
paramRequest.put("deptCode",wlyyOutpatientDO.getDept());
|
|
|
paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
|
|
|
paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
|
|
|
}
|
|
|
paramRequest.put("templateid","662");
|
|
|
paramRequest.put("catalogid","50");
|
|
|
paramRequest.put("emrtype","0");
|
|
|
paramRequest.put("emrtitle","互联网医院");
|
|
|
|
|
|
|
|
|
}
|
|
|
params.put("jsonInfo",paramRequest.toJSONString());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"returnEmrHtmlByHLW";
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("保存电子病历"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
jsonObject = object.getJSONObject("obj");
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//=====================hospital应用调用entrance应用============end=================
|
|
|
|
|
|
|
|
@ -2009,9 +3318,228 @@ public class XzzxEntranceService{
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
//组装审药参数并发送到entrance
|
|
|
public String checkInputInfo(String hisId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
|
|
|
JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
|
|
|
//如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
|
|
|
if (StringUtils.isNotEmpty(hisId)){
|
|
|
jsonObject.put("PATIENT_PRES_ID",hisId);
|
|
|
|
|
|
}else {
|
|
|
hisId = UUID.randomUUID().toString();
|
|
|
jsonObject.put("PATIENT_PRES_ID",hisId);
|
|
|
}
|
|
|
if (null!=infos&&infos.size()>0) {
|
|
|
String response = "";
|
|
|
String returnJson = "";
|
|
|
JSONArray array = new JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO infoDO:infos){
|
|
|
array.add(infoDO);
|
|
|
}
|
|
|
String url = entranceUrl + "checkPrescription";
|
|
|
Map<String,String> map = new HashedMap();
|
|
|
map.put("infos",array.toJSONString());
|
|
|
map.put("patientAndDoctor",jsonObject.toString());
|
|
|
response = httpClientUtil.httpPost(url, map);
|
|
|
logger.info("请求entrance的参数:"+map.toString());
|
|
|
logger.info("请求checkPrescription:" + response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
if (object.getInteger("status") == 200) {
|
|
|
wlyyHttpLogDO.setCode("200");
|
|
|
String obj = object.getString("obj");
|
|
|
System.out.println("obj:"+obj);
|
|
|
if (StringUtils.isNotBlank(obj)) {
|
|
|
List<Map<String,Object>> returnList = transXmlCommen(obj);
|
|
|
Map<String,Object> checkIdMap = new HashMap<>();
|
|
|
checkIdMap.put("prescriptionOnly",hisId);
|
|
|
returnList.add(checkIdMap);
|
|
|
returnJson = JSONArray.toJSONString(returnList);
|
|
|
logger.info("返回到互联网医院的解析后的结果:"+returnJson);
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("checkPrescription");
|
|
|
} else {
|
|
|
returnJson = "审方返回接口为空请检查参数是否正确";
|
|
|
logger.info(returnJson);
|
|
|
wlyyHttpLogDO.setCode("error");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("checkPrescription");
|
|
|
}
|
|
|
} else {
|
|
|
returnJson = "entranceUrl接口调用失败";
|
|
|
wlyyHttpLogDO.setCode("error");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("checkPrescription");
|
|
|
}
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
return returnJson;
|
|
|
}else {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
|
}
|
|
|
//组装审药参数并发送到entrance保存处方
|
|
|
public String saveCheckInputInfo(String prescriptionId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
|
|
|
JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
|
|
|
String tjPrescriptionId = "";
|
|
|
//如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
|
|
|
if (StringUtils.isNotEmpty(prescriptionId)) {
|
|
|
tjPrescriptionId = prescriptionId;
|
|
|
jsonObject.put("PATIENT_PRES_ID",tjPrescriptionId);
|
|
|
}
|
|
|
if (null!=infos&&infos.size()>0) {
|
|
|
String response = "";
|
|
|
String returnJson = "";
|
|
|
JSONArray array = new JSONArray();
|
|
|
for (WlyyPrescriptionInfoDO infoDO:infos){
|
|
|
array.add(infoDO);
|
|
|
}
|
|
|
String url = entranceUrl + "saveCheckPrescription";
|
|
|
Map<String,String> map = new HashedMap();
|
|
|
map.put("infos",array.toJSONString());
|
|
|
map.put("patientAndDoctor",jsonObject.toString());
|
|
|
response = httpClientUtil.httpPost(url, map);
|
|
|
logger.info("请求saveCheckPrescription参数:"+map.toString());
|
|
|
logger.info("saveCheckPrescription返回结果:" + response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
if (object.getInteger("status") == 200) {
|
|
|
wlyyHttpLogDO.setCode("200");
|
|
|
String obj = object.getString("obj");
|
|
|
System.out.println("obj:"+obj);
|
|
|
if (StringUtils.isNotBlank(obj)) {
|
|
|
returnJson = obj;
|
|
|
logger.info("返回到互联网医院的解析后的结果:"+returnJson);
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("saveCheckPrescription");
|
|
|
} else {
|
|
|
returnJson = "保存失败";
|
|
|
logger.info(returnJson);
|
|
|
wlyyHttpLogDO.setCode("failed");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("saveCheckPrescription");
|
|
|
}
|
|
|
} else {
|
|
|
returnJson = "entranceUrl接口调用失败";
|
|
|
wlyyHttpLogDO.setCode("error");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("saveCheckPrescription");
|
|
|
}
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
return returnJson;
|
|
|
}else {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
|
}
|
|
|
//作废处方
|
|
|
public String deleteCheckInputInfo(String prescriptionId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception{
|
|
|
JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
|
|
|
String tjPrescriptionId = "";
|
|
|
//如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
|
|
|
if (StringUtils.isNotEmpty(prescriptionId)){
|
|
|
tjPrescriptionId = prescriptionId;
|
|
|
jsonObject.put("PATIENT_PRES_ID",tjPrescriptionId);
|
|
|
}
|
|
|
String response = "";
|
|
|
String returnJson = "";
|
|
|
String url = entranceUrl + "deleteCheckPrescription";
|
|
|
Map<String,String> map = new HashedMap();
|
|
|
map.put("infos","");
|
|
|
map.put("patientAndDoctor",jsonObject.toString());
|
|
|
response = httpClientUtil.httpPost(url, map);
|
|
|
logger.info("请求deleteCheckPrescription参数:"+map.toString());
|
|
|
logger.info("deleteCheckPrescription返回结果:" + response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
if (object.getInteger("status") == 200) {
|
|
|
wlyyHttpLogDO.setCode("200");
|
|
|
String obj = object.getString("obj");
|
|
|
System.out.println("obj:"+obj);
|
|
|
if (StringUtils.isNotBlank(obj)) { ;
|
|
|
returnJson = obj;
|
|
|
logger.info("返回到互联网医院的解析后的结果:"+returnJson);
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(map.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("saveCheckPrescription");
|
|
|
} else {
|
|
|
returnJson = "删除成功";
|
|
|
logger.info(returnJson);
|
|
|
wlyyHttpLogDO.setCode("删除成功");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(map.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("deleteCheckPrescription");
|
|
|
}
|
|
|
} else {
|
|
|
returnJson = "entranceUrl接口调用失败";
|
|
|
wlyyHttpLogDO.setCode("error");
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setRequest(map.toString());
|
|
|
wlyyHttpLogDO.setResponse(returnJson);
|
|
|
wlyyHttpLogDO.setName("deleteCheckPrescription");
|
|
|
}
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
return returnJson;
|
|
|
|
|
|
|
|
|
}
|
|
|
//初始化医患和诊断参数
|
|
|
public JSONObject initEntranceParam(String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//先查询处方获得支付方式
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
if (null != doctorMappingDO && null != baseDoctorDO) {
|
|
|
jsonObject.put("DOCTOR_ID", doctorMappingDO.getMappingCode());
|
|
|
jsonObject.put("POSITION", baseDoctorDO.getJobTitleName());
|
|
|
jsonObject.put("DOCTOR_NAME", baseDoctorDO.getName());
|
|
|
if (null!=baseDoctorHospitalDO&&baseDoctorHospitalDO.size()>0){
|
|
|
jsonObject.put("DEPT_CODE", baseDoctorHospitalDO.get(0).getDeptCode());
|
|
|
jsonObject.put("DEPT_NAME", baseDoctorHospitalDO.get(0).getDeptName());
|
|
|
}
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
BasePatientDO basePatientDO = patientDao.findById(patient);
|
|
|
jsonObject.put("PATIENT_NAME", basePatientDO.getName());
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
if (null != patientMappingDO && null != basePatientDO) {
|
|
|
jsonObject.put("PATIENT_ID", patientMappingDO.getMappingCode());
|
|
|
jsonObject.put("GENDER", basePatientDO.getSex()==1?"男":"女");
|
|
|
jsonObject.put("BIRTH", sdf.format(basePatientDO.getBirthday()));
|
|
|
}
|
|
|
jsonObject.put("FEE_TYPE", "1".equalsIgnoreCase(payType) ? "医保" : "自费");
|
|
|
jsonObject.put("CREATE_DATE", sdf.format(new Date()));
|
|
|
//组装诊断参数
|
|
|
if (null != diagnosisDOS && diagnosisDOS.size() > 0) {
|
|
|
List diagnosises = new ArrayList();
|
|
|
for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : diagnosisDOS) {
|
|
|
diagnosises.add(wlyyPrescriptionDiagnosisDO.getName());
|
|
|
}
|
|
|
jsonObject.put("diagnosises", StringUtils.strip(diagnosises.toString(),"[]"));
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
|