|
@ -50,6 +50,7 @@ import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.httpclient.util.EncodingUtil;
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -841,7 +842,7 @@ public class DsyyEntranceService {
|
|
|
public WlyyOutpatientVO selectOutpatientInfo(String patient,String conNo) throws Exception {
|
|
|
WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
|
|
|
JSONArray array = new JSONArray();
|
|
|
BasePatientDO patientDO = patientDao.findById(patient).orElse(null);
|
|
|
BasePatientDO patientDO = patientDao.findById(patient).get();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
if (patientMappingDO!=null){
|
|
|
patient = patientMappingDO.getMappingCode();
|
|
@ -1906,7 +1907,7 @@ public class DsyyEntranceService {
|
|
|
if (StringUtils.isNoneBlank(hismzlsh)){
|
|
|
object.put("hismzlsh",hismzlsh);
|
|
|
}
|
|
|
object.put("trade_type","5");
|
|
|
// object.put("trade_type","5");
|
|
|
object.put("accountType","01");
|
|
|
object.put("sfxsjs","Y");
|
|
|
condition = object.toJSONString();
|
|
@ -2854,8 +2855,8 @@ public class DsyyEntranceService {
|
|
|
"<CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>" +
|
|
|
"<CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>" +
|
|
|
"<MR_CODE>EMR10.00.18_36</MR_CODE>" +
|
|
|
"<TOPIC>嘉和提供</TOPIC>" +
|
|
|
"<HOSPITAL_NO>医院编码</HOSPITAL_NO>" +
|
|
|
"<TOPIC>互联网医院专用</TOPIC>" +
|
|
|
"<HOSPITAL_NO>42661889-5</HOSPITAL_NO>" +
|
|
|
"<DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>" +
|
|
|
"<DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>" +
|
|
|
"<FILE_FLAG>1</FILE_FLAG>" +
|
|
@ -2935,6 +2936,130 @@ public class DsyyEntranceService {
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
public JSONArray selectEmrInfoIdAndVisitNo(String patientId,String visitNo) throws Exception {
|
|
|
String url = "HTTP://10.95.8.41:51221";
|
|
|
String xml = "{\n" +
|
|
|
" \"serverCode\": \"JHIDS-USD-HLWMZBL-012\",\n" +
|
|
|
" \"sysCode\": \"HLW\",\n" +
|
|
|
" \"pageSize\": \"10\",\n" +
|
|
|
" \"pageNo\": \"1\",\n" +
|
|
|
" \t\"orders\": [\n" +
|
|
|
"\t\n" +
|
|
|
"\t],\n" +
|
|
|
"\t\"condition\": [\n" +
|
|
|
"\t\t{\n" +
|
|
|
"\t\t\t\"column\": \"PATIENT_ID\",\n" +
|
|
|
"\t\t\t\"type\": \"eq\",\n" +
|
|
|
"\t\t\t\"value\": \""+patientId+"\"\n" +
|
|
|
"\t\t},\n" +
|
|
|
" \t{\n" +
|
|
|
"\t\t\t\"column\": \"VISIT_ID\",\n" +
|
|
|
"\t\t\t\"type\": \"eq\",\n" +
|
|
|
"\t\t\t\"value\": \""+visitNo+"\"\n" +
|
|
|
"\t\t}\n" +
|
|
|
"\t]\n" +
|
|
|
"}";
|
|
|
logger.info("xml"+xml);
|
|
|
String response = httpClientUtil.postHeadBodyText(url,xml);
|
|
|
logger.info("response===="+response);
|
|
|
JSONArray jsonArray =new JSONArray();
|
|
|
Object json = JSON.parse(response);
|
|
|
if (json instanceof JSONObject) {
|
|
|
JSONObject jsonObject = (JSONObject) json;
|
|
|
if (jsonObject.getString("code").equalsIgnoreCase("401")){
|
|
|
throw new Exception(jsonObject.getString("message"));
|
|
|
}
|
|
|
} else if (json instanceof JSONArray) {
|
|
|
JSONArray array = (JSONArray) json;
|
|
|
array = JSONArray.parseArray(response);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
String EMRPDF=object.getString("EMRPDF");
|
|
|
byte[] emrByte = Base64.decodeBase64(EMRPDF);
|
|
|
String emrDecode = new String(emrByte, "GBK");
|
|
|
object.put("EMRPDFHTMl", emrDecode);
|
|
|
}
|
|
|
jsonArray = array;
|
|
|
|
|
|
}
|
|
|
WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
|
|
|
httpLogDO.setCode("selectEmrInfo");
|
|
|
httpLogDO.setName("查下电子病历");
|
|
|
httpLogDO.setRequest(xml);
|
|
|
httpLogDO.setResponse(response);
|
|
|
httpLogDO.setStatus("1");
|
|
|
wlyyHttpLogDao.save(httpLogDO);
|
|
|
return jsonArray;
|
|
|
}
|
|
|
|
|
|
|
|
|
public String dzblIcd10Save(String prescriptionId)throws Exception{
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
|
|
|
if (prescriptionDO==null){
|
|
|
throw new Exception("该处方不存在");
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode());
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).get();
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor()).get();
|
|
|
BasePatientDO patientDO = patientDao.findById(prescriptionDO.getPatientCode()).get();
|
|
|
Integer visitId=0;
|
|
|
if (outpatientDO.getRegisterNo() != null && outpatientDO.getRegisterNo().length() >= 3) {
|
|
|
String str = outpatientDO.getRegisterNo().substring(outpatientDO.getRegisterNo().length() - 3);
|
|
|
visitId = Integer.parseInt(str);
|
|
|
}
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = diagnosisDao.findByPrescriptionId(prescriptionId,1);
|
|
|
String diagnosis = "";
|
|
|
for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
|
|
|
diagnosis+=diagnosisDO.getName()+"|"+diagnosisDO.getCode()+"|";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(diagnosis)){
|
|
|
diagnosis = diagnosis.substring(0,diagnosis.length()-1);
|
|
|
}
|
|
|
String sexName="未知";
|
|
|
if (patientDO.getSex()==1){
|
|
|
sexName="男";
|
|
|
}else if (patientDO.getSex()==2){
|
|
|
sexName="女";
|
|
|
}
|
|
|
String info="";
|
|
|
List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
|
|
|
for (int i=0;i<infoDOS.size();i++){
|
|
|
WlyyPrescriptionInfoDO infoDO = infoDOS.get(i);
|
|
|
info+=(i+1)+"|"+infoDO.getDrugName()+"|"+infoDO.getDosage()+"|"+infoDO.getUnit()+"|"+infoDO.getSupplyName()+"|"+
|
|
|
infoDO.getUsageName()+"|"+infoDO.getDays()+"|"+infoDO.getQuantity()+"|"+infoDO.getPackUnit()+"|";
|
|
|
info = info.substring(0,info.length()-1);
|
|
|
}
|
|
|
String condition = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
|
|
|
" <MESSAGE>\n" +
|
|
|
" <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
|
|
|
" <VISIT_ID>"+visitId+"</VISIT_ID>\n" +
|
|
|
" <NAME>"+outpatientDO.getPatientName()+"</NAME>\n" +
|
|
|
" <NAME_PHONETIC>CS</NAME_PHONETIC>\n" +
|
|
|
" <SEX>"+sexName+"</SEX>\n" +
|
|
|
" <ID_NO>"+patientDO.getIdcard()+"</ID_NO>\n" +
|
|
|
" <CITIZENSHIP>中国</CITIZENSHIP>\n" +
|
|
|
" <DATE_OF_BIRTH>"+patientDO.getBirthday()+"</DATE_OF_BIRTH>\n" +
|
|
|
" <CARD_NO>"+outpatientDO.getCardNo()+"</CARD_NO>\n" +
|
|
|
" <CREATE_DATE></CREATE_DATE>\n" +
|
|
|
" <AGE>"+DateUtil.getAgeForIdcard(patientDO.getIdcard())+"岁</AGE>\n" +
|
|
|
" <VISIT_DEPT>"+outpatientDO.getDept()+"</VISIT_DEPT>\n" +
|
|
|
" <VISIT_DATE>"+DateUtil.dateToStrLong(outpatientDO.getRegisterDate())+"</VISIT_DATE>\n" +
|
|
|
" <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
|
|
|
" <DOCTOR_IN_CHARGE>"+doctorMappingDO.getMappingCode()+"</DOCTOR_IN_CHARGE>\n" +
|
|
|
" <HOSPITAL_NO>42661889-5</HOSPITAL_NO>\n" +
|
|
|
" </MESSAGE>";
|
|
|
String pInput=condition;
|
|
|
logger.info("电子病历诊断保存入参"+pInput);
|
|
|
ServiceLocator locator = new ServiceLocator();
|
|
|
java.net.URL endpoint = new java.net.URL("http://10.95.8.41/csp/jhip/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH1228%E4%BA%92%E8%81%94%E7%BD%91%E4%BF%9D%E5%AD%98%E6%8E%A5%E8%AF%8A%E4%BF%A1%E6%81%AFBS");
|
|
|
String returnStr = locator.getServiceSoap(endpoint).send(pInput);
|
|
|
logger.info("电子病历诊断保存出参"+returnStr);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(returnStr).toString();
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 电子病历保存
|
|
@ -2943,6 +3068,7 @@ public class DsyyEntranceService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String dzblSave(String prescriptionId)throws Exception{
|
|
|
dzblIcd10Save(prescriptionId);
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).get();
|
|
|
if (prescriptionDO==null){
|
|
|
throw new Exception("该处方不存在");
|
|
@ -2988,6 +3114,9 @@ public class DsyyEntranceService {
|
|
|
String condition = "<MESSAGE>\n" +
|
|
|
" <PATIENT_ID>"+patientMappingDO.getMappingCode()+"</PATIENT_ID>\n" +
|
|
|
" <HIS_REGISTER_PK>"+outpatientDO.getRegisterNo()+"</HIS_REGISTER_PK>\n" +
|
|
|
" <FILE_VISIT_TYPE>0</FILE_VISIT_TYPE>"+
|
|
|
" <IS_MR_CREATE>0</IS_MR_CREATE>"+
|
|
|
" <SYNC_WAY>I</SYNC_WAY>"+
|
|
|
" <VISIT_ID>"+visitId+"</VISIT_ID>\n"+
|
|
|
" <IS_MR_CREATE>1</IS_MR_CREATE>\n" +
|
|
|
" <SYNC_WAY>1</SYNC_WAY>\n"+
|
|
@ -2995,13 +3124,13 @@ public class DsyyEntranceService {
|
|
|
" <CREATE_USER_NAME>"+prescriptionDO.getDoctorName()+"</CREATE_USER_NAME>\n" +
|
|
|
" <CREATE_DATE_TIME>"+DateUtil.dateToStrLong(prescriptionDO.getCreateTime())+"</CREATE_DATE_TIME>\n" +
|
|
|
" <MR_CODE>EMR10.00.18_36</MR_CODE>\n" +
|
|
|
" <TOPIC>嘉和提供</TOPIC>\n" +
|
|
|
" <HOSPITAL_NO>医院编码</HOSPITAL_NO>\n" +
|
|
|
" <TOPIC>互联网医院专用</TOPIC>\n" +
|
|
|
" <HOSPITAL_NO>42661889-5</HOSPITAL_NO>\n" +
|
|
|
" <DEPT_CODE>"+prescriptionDO.getDept()+"</DEPT_CODE>\n" +
|
|
|
" <DEPT_NAME>"+prescriptionDO.getDeptName()+"</DEPT_NAME>\n" +
|
|
|
" <FILE_FLAG>1</FILE_FLAG>\n" +
|
|
|
" <SHCZZT_FLAG>"+doctorMappingDO.getMappingCode()+"</SHCZZT_FLAG>\n" +
|
|
|
" <CA_SIGN_PIC>"+stamp+"</CA_SIGN_PIC>\n" +
|
|
|
" <CA_SIGN_PIC></CA_SIGN_PIC>\n" +
|
|
|
" <Structured_medical>\n" +
|
|
|
" <主诉>"+prescriptionEmrDO.getComplaint()+"</主诉>\n" +
|
|
|
" <流行病学史>"+prescriptionEmrDO.getPopularHistory()+"</流行病学史>\n" +
|
|
@ -3256,8 +3385,6 @@ public class DsyyEntranceService {
|
|
|
public String checkPrescription(String serviceCode,String xml,String name){
|
|
|
|
|
|
String url = "http://10.95.8.71:2002/face?charset=utf-8&post_type=1&serviceCode="+serviceCode;
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("xml",xml);
|
|
|
logger.info("xml"+xml);
|
|
|
String response = httpClientUtil.postBodyText(url,xml);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|