|
@ -0,0 +1,4139 @@
|
|
|
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;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
|
|
|
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
|
|
|
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
|
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.*;
|
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
|
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
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;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
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;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.StringReader;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 心脏中心内网his对接服务
|
|
|
* Created by Trick on 2020/3/18
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class HcyyEntranceService {
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(HcyyEntranceService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private DictHospitalDeptDao dictHospitalDeptDao;
|
|
|
@Autowired
|
|
|
private DictDoctorDutyDao dictDoctorDutyDao;
|
|
|
@Autowired
|
|
|
private WlyyChargeDictDao chargeDictDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorRoleDao doctorRoleDao;
|
|
|
@Autowired
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientWechatDao basePatientWechatDao;
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
@Autowired
|
|
|
private OutpatientDao outpatientDao;
|
|
|
@Autowired
|
|
|
private PatientRegisterDao patientRegisterDao;
|
|
|
@Autowired
|
|
|
private WlyyHttpLogDao wlyyHttpLogDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDiagnosisDao diagnosisDao;
|
|
|
@Autowired
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
@Autowired
|
|
|
private WlyyInspectionDao wlyyInspectionDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao baseDoctorHospitalDao;
|
|
|
@Autowired
|
|
|
private PrescriptionEmrDao prescriptionEmrDao;
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfs_file_url;
|
|
|
@Autowired
|
|
|
private FileUploadService fileUploadService;
|
|
|
|
|
|
|
|
|
private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
|
|
|
|
|
|
//发送微信模板消息
|
|
|
/*@Value("${wechat.url}")*/
|
|
|
private String sendMessageUrl="http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage";
|
|
|
|
|
|
public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
|
|
|
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("hcyyWebSelectService");
|
|
|
|
|
|
String url = list.get(0).getDictCode();
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
public String getOperateUrl(){
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("xzzxWebOperateService");
|
|
|
|
|
|
String url = list.get(0).getDictCode();
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
public String getOperateSmsUrl(){
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("xzzxWebOperateSmsService");
|
|
|
|
|
|
String url = list.get(0).getDictCode();
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
public String getWXTokenUrl(){
|
|
|
WlyyHospitalSysDictDO sysDictDO = wlyyHospitalSysDictDao.findById("getXzToken");
|
|
|
return sysDictDO.getDictCode();
|
|
|
}
|
|
|
|
|
|
public String getXzzxWebServiceInfo(String api, Map<String,String> params,String url)throws Exception{
|
|
|
|
|
|
logger.info("url"+url);
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> xzzxNamespaces = wlyyHospitalSysDictDao.findByDictName("hcyyNamespace");
|
|
|
|
|
|
String xzzxNamespace = xzzxNamespaces.get(0).getDictCode();
|
|
|
|
|
|
logger.info("hcyyNamespace",xzzxNamespace);
|
|
|
|
|
|
return WebserviceUtil.post(url,xzzxNamespace,api,params);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取部门信息
|
|
|
* @return
|
|
|
*/
|
|
|
public String getDeptInfo(String code)throws Exception{
|
|
|
String api = "GetDeptInfo";
|
|
|
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.isNoneBlank(code)){
|
|
|
condition = "<code>"+code+"</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("getDeptInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getDeptInfo json:"+json);
|
|
|
|
|
|
JSONArray depts = JSONArray.parseArray(json).getJSONArray(0);
|
|
|
if(depts!=null&&depts.size()>0){
|
|
|
for(int i=0;i<depts.size();i++){
|
|
|
JSONObject dept = depts.getJSONObject(i);
|
|
|
|
|
|
String deptCode = dept.getString("code");
|
|
|
|
|
|
List<DictHospitalDeptDO> list = dictHospitalDeptDao.findByOrgCodeAndCode(deptCode,"350211A5010");
|
|
|
|
|
|
String consultDeptFlag=null;
|
|
|
if (!dept.getString("consultDeptFlag").equalsIgnoreCase("[]")){
|
|
|
consultDeptFlag = dept.getString("consultDeptFlag");
|
|
|
}
|
|
|
if(list!=null&&list.size()>0){
|
|
|
DictHospitalDeptDO deptDO = list.get(0);
|
|
|
deptDO.setCode(deptCode);
|
|
|
deptDO.setName(dept.getString("name"));
|
|
|
if (StringUtils.isNoneBlank(consultDeptFlag)){
|
|
|
deptDO.setConsultDeptFlag(consultDeptFlag);
|
|
|
}
|
|
|
deptDO.setCreateTime(new Date());
|
|
|
dictHospitalDeptDao.save(deptDO);
|
|
|
}else {
|
|
|
DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
|
|
|
deptDO.setCode(deptCode);
|
|
|
deptDO.setName(dept.getString("name"));
|
|
|
if (StringUtils.isNoneBlank(consultDeptFlag)){
|
|
|
deptDO.setConsultDeptFlag(consultDeptFlag);
|
|
|
}
|
|
|
deptDO.setOrgCode("350211A5022");
|
|
|
deptDO.setCreateTime(new Date());
|
|
|
dictHospitalDeptDao.save(deptDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 同步医生信息
|
|
|
* @return
|
|
|
*/
|
|
|
public String getDoctorInfo(String idcard)throws Exception{
|
|
|
String api = "GetDoctorInfo";
|
|
|
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.isNoneBlank(idcard)){
|
|
|
condition = "<Idcard>"+idcard+"</Idcard>";
|
|
|
}
|
|
|
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("getDoctorInfo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getDoctorInfo json:"+json);
|
|
|
|
|
|
JSONArray doctors = JSONArray.parseArray(json);
|
|
|
findWlyyDoctor(doctors);
|
|
|
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生信息
|
|
|
* @return
|
|
|
*/
|
|
|
public String selectDoctorInfo(String idcard)throws Exception{
|
|
|
String api = "GetDoctorInfo";
|
|
|
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.isNoneBlank(idcard)){
|
|
|
condition = "<Idcard>"+idcard+"</Idcard>";
|
|
|
}
|
|
|
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("getDoctorInfo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getDoctorInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
public String findWlyyDoctor(JSONArray doctors)throws Exception{
|
|
|
logger.info("doctors size:"+doctors.size());
|
|
|
if(doctors!=null&&doctors.size()>0){
|
|
|
Integer count = 0;
|
|
|
for(int i=0;i<doctors.size();i++){
|
|
|
try {
|
|
|
JSONObject doctorJson = doctors.getJSONObject(i);
|
|
|
String idcard = doctorJson.getString("idcard");
|
|
|
if(StringUtils.isNotBlank(idcard)) {
|
|
|
List<BaseDoctorDO> ds = doctorDao.findByIdcard(idcard);
|
|
|
if (ds != null && ds.size() > 0) {
|
|
|
//已有账号更新
|
|
|
BaseDoctorDO doctor = ds.get(0);
|
|
|
doctor.setName(doctorJson.getString("name"));
|
|
|
doctor.setIdcard(doctorJson.getString("idcard"));
|
|
|
doctor.setMobile(doctorJson.getString("mobile"));
|
|
|
doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
|
|
|
doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
doctor.setProvinceCode("350000");
|
|
|
doctor.setProvinceName("福建省");
|
|
|
doctor.setTownCode("350205");
|
|
|
doctor.setTownName("海沧区");
|
|
|
doctor.setCityCode("350200");
|
|
|
doctor.setCityName("厦门市");
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
|
|
|
doctor.setExpertise(doctorJson.getString("expertise"));
|
|
|
}
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
|
|
|
doctor.setIntroduce(doctorJson.getString("introduce"));
|
|
|
}
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
|
|
|
doctor.setPhoto(doctorJson.getString("photo"));
|
|
|
}
|
|
|
doctor.setIscertified(doctorJson.getString("iscertified"));
|
|
|
doctor.setSpell(doctorJson.getString("spell"));
|
|
|
// String salt = randomString(5);
|
|
|
// String pw = idcard.substring(idcard.length() - 6);
|
|
|
// doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
// doctor.setSalt(salt);
|
|
|
doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
|
|
|
doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
|
|
|
doctor.setChargeType(doctorJson.getString("chargeType"));
|
|
|
doctorDao.save(doctor);
|
|
|
|
|
|
//更新机构科室信息
|
|
|
String dept =doctorJson.getString("dept");
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
List<BaseDoctorHospitalDO> hospitalDOs = doctorHospitalDao.findByDeptCodeAndDoctorCode(dept,doctor.getId());
|
|
|
if(hospitalDOs!=null&&hospitalDOs.size()>0){
|
|
|
BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
|
|
|
hospitalDO.setOrgCode("350211A5022");
|
|
|
hospitalDO.setOrgName("海沧医院");
|
|
|
hospitalDO.setDeptCode(doctorJson.getString("dept"));
|
|
|
hospitalDO.setDeptName(doctorJson.getString("deptName"));
|
|
|
hospitalDO.setDel("1");
|
|
|
doctorHospitalDao.save(hospitalDO);
|
|
|
}
|
|
|
}
|
|
|
List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByOrgCodeAndMappingCode("350211A5010",doctorJson.getString("code"));
|
|
|
if (doctorMappingDOS!=null&&doctorMappingDOS.size()!=0){
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDOS.get(0);
|
|
|
doctorMappingDO.setIdcard(idcard);
|
|
|
doctorMappingDO.setDoctor(doctor.getId());
|
|
|
doctorMappingDO.setOrgCode("350211A5022");
|
|
|
doctorMappingDO.setOrgName("海沧医院");
|
|
|
doctorMappingDO.setMappingCode(doctorJson.getString("code"));
|
|
|
doctorMappingDO.setMappingName(doctorJson.getString("name"));
|
|
|
doctorMappingDO.setDoctorName(doctor.getName());
|
|
|
doctorMappingDO.setMappingDeptName(doctorJson.getString("deptName"));
|
|
|
doctorMappingDO.setMappingDept(doctorJson.getString("dept"));
|
|
|
doctorMappingDO.setMappingJob(doctorJson.getString("jobTitleCode"));
|
|
|
doctorMappingDO.setMappingJobName(doctorJson.getString("jobTitleName"));
|
|
|
doctorMappingDO.setCreateTime(new Date());
|
|
|
doctorMappingDao.save(doctorMappingDO);
|
|
|
}else{
|
|
|
DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
|
|
|
doctorMappingDO.setIdcard(idcard);
|
|
|
doctorMappingDO.setDoctor(doctor.getId());
|
|
|
doctorMappingDO.setOrgCode("350211A5022");
|
|
|
doctorMappingDO.setOrgName("海沧医院");
|
|
|
doctorMappingDO.setMappingCode(doctorJson.getString("code"));
|
|
|
doctorMappingDO.setMappingName(doctorJson.getString("name"));
|
|
|
doctorMappingDO.setDoctorName(doctor.getName());
|
|
|
doctorMappingDO.setMappingDeptName(doctorJson.getString("deptName"));
|
|
|
doctorMappingDO.setMappingDept(doctorJson.getString("dept"));
|
|
|
doctorMappingDO.setMappingJob(doctorJson.getString("jobTitleCode"));
|
|
|
doctorMappingDO.setMappingJobName(doctorJson.getString("jobTitleName"));
|
|
|
doctorMappingDO.setCreateTime(new Date());
|
|
|
doctorMappingDao.save(doctorMappingDO);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
BaseDoctorDO doctor = new BaseDoctorDO();
|
|
|
doctor.setName(doctorJson.getString("name"));
|
|
|
doctor.setIdcard(doctorJson.getString("idcard"));
|
|
|
doctor.setMobile(doctorJson.getString("mobile"));
|
|
|
doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
|
|
|
doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
doctor.setProvinceCode("350000");
|
|
|
doctor.setProvinceName("福建省");
|
|
|
doctor.setTownCode("350205");
|
|
|
doctor.setTownName("海沧区");
|
|
|
doctor.setCityCode("350200");
|
|
|
doctor.setCityName("厦门市");
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("expertise"))&&StringUtils.isNoneBlank(doctorJson.getString("expertise"))){
|
|
|
doctor.setExpertise(doctorJson.getString("expertise"));
|
|
|
}
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("introduce"))&&StringUtils.isNoneBlank(doctorJson.getString("introduce"))){
|
|
|
doctor.setIntroduce(doctorJson.getString("introduce"));
|
|
|
}
|
|
|
if (!"[]".equalsIgnoreCase(doctorJson.getString("photo"))&&StringUtils.isNoneBlank(doctorJson.getString("photo"))){
|
|
|
doctor.setPhoto(doctorJson.getString("photo"));
|
|
|
}
|
|
|
doctor.setIscertified(doctorJson.getString("iscertified"));
|
|
|
doctor.setSpell(doctorJson.getString("spell"));
|
|
|
doctor.setOutpatientType("zj");
|
|
|
//认证信息设置
|
|
|
String salt = randomString(5);
|
|
|
String pw = idcard.substring(idcard.length() - 6);
|
|
|
doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
doctor.setSalt(salt);
|
|
|
doctor.setDel("1");
|
|
|
doctor.setEnabled(1);
|
|
|
doctor.setLocked(0);
|
|
|
doctor.setCreateTime(new Date());
|
|
|
doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
|
|
|
doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
|
|
|
|
|
|
BaseDoctorDO temp = doctorDao.save(doctor);
|
|
|
|
|
|
//机构信息部门信息
|
|
|
BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
|
|
|
hospitalDO.setDoctorCode(temp.getId());
|
|
|
hospitalDO.setOrgCode("350211A5022");
|
|
|
hospitalDO.setOrgName("海沧医院");
|
|
|
hospitalDO.setDeptCode(doctorJson.getString("dept"));
|
|
|
hospitalDO.setDeptName(doctorJson.getString("deptName"));
|
|
|
hospitalDO.setDel("1");
|
|
|
doctorHospitalDao.save(hospitalDO);
|
|
|
|
|
|
BaseDoctorRoleDO role = new BaseDoctorRoleDO();
|
|
|
role.setDoctorCode(temp.getId());
|
|
|
role.setRoleCode("specialist");
|
|
|
doctorRoleDao.save(role);
|
|
|
|
|
|
|
|
|
DoctorMappingDO mappingDO = new DoctorMappingDO();
|
|
|
mappingDO.setIdcard(idcard);
|
|
|
mappingDO.setDoctor(temp.getId());
|
|
|
mappingDO.setOrgCode("350211A5022");
|
|
|
mappingDO.setOrgName("海沧医院");
|
|
|
mappingDO.setMappingCode(doctorJson.getString("code"));
|
|
|
mappingDO.setMappingName(doctorJson.getString("name"));
|
|
|
mappingDO.setDoctorName(temp.getName());
|
|
|
mappingDO.setMappingDeptName(doctorJson.getString("deptName"));
|
|
|
mappingDO.setMappingDept(doctorJson.getString("dept"));
|
|
|
mappingDO.setMappingJob(doctorJson.getString("jobTitleCode"));
|
|
|
mappingDO.setMappingJobName(doctorJson.getString("jobTitleName"));
|
|
|
mappingDO.setCreateTime(new Date());
|
|
|
doctorMappingDao.save(mappingDO);
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
logger.info("data error");
|
|
|
}
|
|
|
}
|
|
|
logger.info("add count:"+count);
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
public String randomString(int length) {
|
|
|
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
|
Random random = new Random();
|
|
|
|
|
|
for(int i = 0; i < length; ++i) {
|
|
|
int pos = random.nextInt(str.length());
|
|
|
buffer.append(str.charAt(pos));
|
|
|
}
|
|
|
|
|
|
return buffer.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取职称字典
|
|
|
* @return
|
|
|
*/
|
|
|
public String getJobTitle()throws Exception{
|
|
|
String api = "GetTitleInfo";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root></root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("getJobTitleInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getJobTitleInfo json:"+json);
|
|
|
|
|
|
JSONArray list = JSONArray.parseArray(json).getJSONArray(0);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(int i=0;i<list.size();i++){
|
|
|
JSONObject object = list.getJSONObject(i);
|
|
|
logger.info("getJobTitleInfo object:"+object.toJSONString());
|
|
|
String code = object.getString("code");
|
|
|
String name = object.getString("name");
|
|
|
DictDoctorDutyDO dictDoctorDutyDO = dictDoctorDutyDao.findByCode(code);
|
|
|
if (dictDoctorDutyDO!=null){
|
|
|
dictDoctorDutyDO.setName(name);
|
|
|
dictDoctorDutyDao.save(dictDoctorDutyDO);
|
|
|
}else {
|
|
|
DictDoctorDutyDO dictDoctorDutyDO1 = new DictDoctorDutyDO();
|
|
|
dictDoctorDutyDO1.setCode(code);
|
|
|
dictDoctorDutyDO1.setName(name);
|
|
|
dictDoctorDutyDO1.setCreateTime(new Date());
|
|
|
dictDoctorDutyDao.save(dictDoctorDutyDO1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取号别字典
|
|
|
* @return
|
|
|
*/
|
|
|
public String getChargeDict()throws Exception{
|
|
|
String api = "GetScheduleType";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root></root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("getChargeDictInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getChargeDictInfo json:"+json);
|
|
|
|
|
|
JSONArray list = JSONArray.parseArray(json).getJSONArray(0);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(int i=0;i<list.size();i++){
|
|
|
JSONObject object = list.getJSONObject(i);
|
|
|
logger.info("getJobTitleInfo object:"+object.toJSONString());
|
|
|
String code = object.getString("chargeType");
|
|
|
String name = object.getString("chargeTypeName");
|
|
|
String reqFee = object.getString("reqFee");
|
|
|
Double reqFees = 0.0;
|
|
|
if (StringUtils.isNoneBlank(reqFee)&&!reqFee.equalsIgnoreCase("[]")){
|
|
|
reqFees= Double.parseDouble(reqFee);
|
|
|
}
|
|
|
WlyyChargeDictDO chargeDictDO = chargeDictDao.findByChargeType(code);
|
|
|
if (chargeDictDO!=null){
|
|
|
chargeDictDO.setChargeType(code);
|
|
|
chargeDictDO.setChargeName(name);
|
|
|
chargeDictDO.setReqFee(reqFees);
|
|
|
chargeDictDao.save(chargeDictDO);
|
|
|
}else {
|
|
|
WlyyChargeDictDO chargeDictDO1 = new WlyyChargeDictDO();
|
|
|
chargeDictDO1.setChargeType(code);
|
|
|
chargeDictDO1.setChargeName(name);
|
|
|
chargeDictDO1.setReqFee(reqFees);
|
|
|
chargeDictDO1.setCreateTime(new Date());
|
|
|
chargeDictDao.save(chargeDictDO1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询患者就诊卡
|
|
|
* @param idCard 身份证
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//查询患者就诊卡
|
|
|
public String findPatientCard(String idCard)throws Exception{
|
|
|
String api = "FindPatientCard";
|
|
|
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(idCard)){
|
|
|
condition = "<identity_no>"+idCard+"</identity_no>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
logger.info("findPatientCard params:"+params.toString());
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("查询患者就诊卡");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
logger.info("findPatientCard json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 获取卡信息
|
|
|
*
|
|
|
* @param cardNo 卡号(必填)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//获取卡信息
|
|
|
public String getCardInfo(String cardNo)throws Exception{
|
|
|
String api = "GetCardInfo";
|
|
|
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(cardNo)){
|
|
|
condition = "<cardNo>"+cardNo+"</cardNo>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("getCardInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("获取卡信息");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
logger.info("getCardInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 发送短信验证码
|
|
|
*
|
|
|
* @param json
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SendSms(String json)throws Exception{
|
|
|
String api = "SendSms";
|
|
|
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(json)){
|
|
|
JSONObject object = JSONObject.parseObject(json);
|
|
|
condition = "<content>"+object+"</content>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("SendSms params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateSmsUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String jsonObject = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(jsonObject);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("短信验证码发送");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
logger.info("SendSms json:"+jsonObject);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取单条门诊就诊记录
|
|
|
* @param patient 居民id
|
|
|
* @param conNo 就诊次数
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//获取单条门诊就诊记录
|
|
|
public String findOutpatientInfo(String patient,String conNo,String startTime,String endTime)throws Exception{
|
|
|
String api = "FindOutpatientInfo";
|
|
|
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(patient)&&!patient.equalsIgnoreCase("null")){
|
|
|
condition += "<patient>"+patient+"</patient>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(conNo)&&!conNo.equalsIgnoreCase("null")){
|
|
|
condition += "<conNo>"+conNo+"</conNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
|
|
|
condition += "<startTime>"+startTime+"</startTime>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
|
|
|
condition += "<endTime>"+endTime+"</endTime>";
|
|
|
}
|
|
|
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("FindOutpatientInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("FindOutpatientInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊下所有处方信息
|
|
|
* @param registerSn 流水号(必传)
|
|
|
* @param patNo 病人id(必传)
|
|
|
* @param admNo 住院唯一号(必传)
|
|
|
* @param realOrder 处方号(非必传,传相当于查单条处方)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//获取门诊下所有处方信息
|
|
|
public String getOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
|
|
|
String api = "GetOriginPrescriptionList";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
logger.info("registerSn"+registerSn+"patNo"+patNo+"admNo"+admNo+"realOrder"+realOrder);
|
|
|
if (!StringUtils.isEmpty(registerSn)&&!registerSn.equalsIgnoreCase("null")){
|
|
|
condition += "<registerSn>"+registerSn+"</registerSn>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
|
|
|
condition += "<patNo>"+patNo+"</patNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
|
|
|
condition += "<realOrder>"+realOrder+"</realOrder>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
|
|
|
condition += "<startTime>"+startTime+"</startTime>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
|
|
|
condition += "<endTime>"+endTime+"</endTime>";
|
|
|
}
|
|
|
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("getOriginPrescriptionList params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getOriginPrescriptionList json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊病人诊断
|
|
|
* @param registerSn
|
|
|
* @param patNo
|
|
|
* @param admNo
|
|
|
* @param realOrder
|
|
|
* @param startTime
|
|
|
* @param endTime
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getOutpatientDiagnosis(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
|
|
|
String api = "GetOutpatientDiagnosis";
|
|
|
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(registerSn)&&!registerSn.equalsIgnoreCase("null")){
|
|
|
condition += "<registerSn>"+registerSn+"</registerSn>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
|
|
|
condition += "<patNo>"+patNo+"</patNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
|
|
|
condition += "<realOrder>"+realOrder+"</realOrder>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
|
|
|
condition += "<startTime>"+startTime+"</startTime>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
|
|
|
condition += "<endTime>"+endTime+"</endTime>";
|
|
|
}
|
|
|
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("getOutpatientDiagnosis params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getOutpatientDiagnosis json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊病人处方药品信息
|
|
|
*
|
|
|
* @param registerSn
|
|
|
* @param patNo
|
|
|
* @param admNo
|
|
|
* @param realOrder
|
|
|
* @param startTime
|
|
|
* @param endTime
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getOutpatientDrugInfo(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
|
|
|
String api = "GetOutpatientDrugInfo";
|
|
|
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(registerSn)&&!registerSn.equalsIgnoreCase("null")){
|
|
|
condition += "<registerSn>"+registerSn+"</registerSn>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
|
|
|
condition += "<patNo>"+patNo+"</patNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
|
|
|
condition += "<realOrder>"+realOrder+"</realOrder>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
|
|
|
condition += "<startTime>"+startTime+"</startTime>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
|
|
|
condition += "<endTime>"+endTime+"</endTime>";
|
|
|
}
|
|
|
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("getOutpatientDrugInfo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getOutpatientDrugInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
public String getOutpatientCheckTestInfo(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime)throws Exception{
|
|
|
String api = "GetOutpatientCheckTestInfo";
|
|
|
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(registerSn)&&!registerSn.equalsIgnoreCase("null")){
|
|
|
condition += "<registerSn>"+registerSn+"</registerSn>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
|
|
|
condition += "<patNo>"+patNo+"</patNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
|
|
|
condition += "<realOrder>"+realOrder+"</realOrder>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
|
|
|
condition += "<startTime>"+startTime+"</startTime>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
|
|
|
condition += "<endTime>"+endTime+"</endTime>";
|
|
|
}
|
|
|
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("getOutpatientCheckTestInfo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("getOutpatientCheckTestInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 挂号(调his后台包)
|
|
|
* @param doctor 医生ID(必填)
|
|
|
* @param dept 科室编码(必填)
|
|
|
* @param sickId 病人id
|
|
|
* @param clinicclass 挂号类别(必填)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//挂号(调his后台包)
|
|
|
public String registered(String doctor,String dept,String sickId,String clinicclass,String courierflag)throws Exception{
|
|
|
String api = "Registered";
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
"</root>";
|
|
|
String condition ="";
|
|
|
logger.info("clinicclass:"+clinicclass);
|
|
|
if (!StringUtils.isEmpty(doctor)&&!doctor.equalsIgnoreCase("null")){
|
|
|
condition += "<doctor>"+doctor+"</doctor>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(dept)&&!dept.equalsIgnoreCase("null")){
|
|
|
condition +="<dept>"+dept+"</dept>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(sickId)&&!sickId.equalsIgnoreCase("null")){
|
|
|
condition += "<sickid>"+sickId+"</sickid>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(clinicclass)&&!clinicclass.equalsIgnoreCase("null")){
|
|
|
condition +="<clinicclass>"+clinicclass+"</clinicclass>";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(courierflag)&&!courierflag.equalsIgnoreCase("null")){
|
|
|
condition +="<courierflag>"+courierflag+"</courierflag>";
|
|
|
}
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
"<root>"+condition+"</root>";
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("registered params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setDoctor(doctor);
|
|
|
wlyyHttpLogDO.setName("挂号(调his后台包)");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
logger.info("registered json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处方状态变更
|
|
|
* @param admNo 就诊唯一号(必填)
|
|
|
* @param realOrder 处方号(必填)
|
|
|
* @param status 处方状态:3结算完成(必填)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
//处方状态变更
|
|
|
public String updatePrescriptionStatus(String admNo,String realOrder,String status)throws Exception{
|
|
|
String api = "UpdatePreStatus";
|
|
|
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(admNo)){
|
|
|
condition += "<admNo>"+admNo+"</admNo>";
|
|
|
}
|
|
|
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,String drugNo)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)&&!"null".equalsIgnoreCase(spellCode)){
|
|
|
condition += "<spell_code>"+spellCode+"</spell_code>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(drugNo)&&!"null".equalsIgnoreCase(drugNo)){
|
|
|
condition += "<physic_code>"+drugNo+"</physic_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();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("savePrescriptionToHospital params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setDoctor(ApplyDoctor);
|
|
|
wlyyHttpLogDO.setName("互联网医院开处方信息更新到his");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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(ApplyDept)){
|
|
|
condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(NullahNumber)){
|
|
|
condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
|
|
|
}
|
|
|
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();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("delHisPrescriptionByHisNo params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("互联网医院删除处方信息更新到his");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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>";
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("saveDiagnosis params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("保存入门诊断信息到his");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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>";
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("refundConsultation params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
wlyyHttpLogDO.setResponse(json);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setName("发送退号信息到his");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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.setName("合理用药审核接口");
|
|
|
wlyyHttpLogDO.setResponse(res);
|
|
|
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.setName("合理用药保存接口");
|
|
|
wlyyHttpLogDO.setResponse(res);
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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("合理用药作废接口");
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
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;
|
|
|
}
|
|
|
public String replaceHtml(String demoData,String oldChar,String newChar){
|
|
|
return demoData.replace(oldChar,null==newChar?"无":newChar);
|
|
|
}
|
|
|
/**
|
|
|
* 同步门诊病历
|
|
|
* @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 = replaceHtml(htmlDeo,"@patientName@",jsonObject.getString("patientName"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@patientAge@",jsonObject.getString("patientAge"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@patientsex@",jsonObject.getString("patientsex"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@deptCode@",jsonObject.getString("deptCode"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@baseSign@",jsonObject.getString("baseSign"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@r+outpatientCode@",jsonObject.getString("outpatientCode"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@patientClan@",jsonObject.getString("patientClan"));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@Special@",prescriptionEmrDO.getSpecialHistory());
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@createTime@",sf.format(prescriptionEmrDO.getCreateTime()));
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@complaint@",prescriptionEmrDO.getComplaint());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@medicalHistory@",prescriptionEmrDO.getMedicalHistory());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@popularHistory@",prescriptionEmrDO.getPopularHistory());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@pastHistory@",prescriptionEmrDO.getPastHistory());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@allergicHistory@",prescriptionEmrDO.getAllergicHistory());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@physicalExamination@",prescriptionEmrDO.getPhysicalExamination());
|
|
|
htmlDeo = replaceHtml(htmlDeo,"@assistExamination@",prescriptionEmrDO.getAssistExamination());
|
|
|
condition+="<content>"+htmlDeo+"</content>";
|
|
|
}
|
|
|
}
|
|
|
if ( null!=jsonObject.get("patientid")) {
|
|
|
condition+="<patientid>"+jsonObject.getString("patientid")+"</patientid>";
|
|
|
}
|
|
|
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);
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
wlyyHttpLogDO.setRequest(msgBody);
|
|
|
wlyyHttpLogDO.setName("保存电子病历");
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
logger.info("returnEmrHtmlByHLW params:"+params.toString());
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
logger.info("returnEmrHtmlByHLW json:"+xml);
|
|
|
wlyyHttpLogDO.setResponse(xml);
|
|
|
|
|
|
return xml;
|
|
|
}
|
|
|
/**
|
|
|
*
|
|
|
* 获取历史病历
|
|
|
*
|
|
|
* @param patientId
|
|
|
* @param eventNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SelectEmrInfo(String patientId,String eventNo)throws Exception{
|
|
|
String api = "SelectEmrInfo";
|
|
|
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(patientId)){
|
|
|
condition += "<patientId>"+patientId+"</patientId>";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(eventNo)&&!"null".equalsIgnoreCase(eventNo)){
|
|
|
condition += "<eventNo>"+eventNo+"</eventNo>";
|
|
|
}
|
|
|
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("SelectEmrInfo params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("SelectEmrInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
/**
|
|
|
*
|
|
|
* 获取历史病历
|
|
|
*
|
|
|
* @param patientId
|
|
|
* @param eventNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String SelectEmrDispRecord(String templateId,String patientId,String eventNo)throws Exception{
|
|
|
String api = "SelectEmrDispRecord";
|
|
|
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(templateId)){
|
|
|
condition += "<template_id>"+templateId+"</template_id>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(patientId)){
|
|
|
condition += "<patientId>"+patientId+"</patientId>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(eventNo)){
|
|
|
condition += "<eventNo>"+eventNo+"</eventNo>";
|
|
|
}
|
|
|
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("SelectEmrDispRecord params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
/* XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();*/
|
|
|
logger.info("SelectEmrDispRecord json:"+xml);
|
|
|
return xml;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 查询病历文书列表
|
|
|
*
|
|
|
* @param patientId
|
|
|
* @param eventNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String GetEMRList(String patientId,String eventNo)throws Exception{
|
|
|
String api = "GetEMRList";
|
|
|
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(patientId)){
|
|
|
condition += "<patientId>"+patientId+"</patientId>";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(eventNo)){
|
|
|
condition += "<eventNo>"+eventNo+"</eventNo>";
|
|
|
}
|
|
|
condition +="<lngCatalogID>50</lngCatalogID>";
|
|
|
condition +="<lngEMRType>93</lngEMRType>";
|
|
|
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("GetEMRList params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
/* XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();*/
|
|
|
logger.info("GetEMRList json:"+xml);
|
|
|
return xml;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 查询病历文书列表
|
|
|
*
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String BrowseSingleEMR(String bstrEmrID)throws Exception{
|
|
|
String api = "BrowseSingleEMR";
|
|
|
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(bstrEmrID)){
|
|
|
condition += "<bstrEmrID>"+bstrEmrID+"</bstrEmrID>";
|
|
|
}
|
|
|
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("BrowseSingleEMR params:"+params.toString());
|
|
|
|
|
|
String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
|
|
|
|
|
|
/* XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();*/
|
|
|
logger.info("BrowseSingleEMR json:"+xml);
|
|
|
return xml;
|
|
|
}
|
|
|
//=====================微信模板消息推送===================================
|
|
|
|
|
|
public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("transType","sms.hospital.notice");
|
|
|
params.put("merchId","3501000014");
|
|
|
JSONObject p = new JSONObject();
|
|
|
String openId = "";
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
List<BasePatientWechatDo> paientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient);
|
|
|
if(paientWechatDos!=null&&paientWechatDos.size()>0){
|
|
|
openId = paientWechatDos.get(0).getOpenid();
|
|
|
p.put("openId",openId);
|
|
|
}
|
|
|
}else {
|
|
|
p.put("cardNo",cardNo);
|
|
|
|
|
|
}
|
|
|
p.put("first",first);
|
|
|
p.put("noticeTime", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
p.put("noticeContent",noticeContent);
|
|
|
if(StringUtils.isNotBlank(redirectUrl)){
|
|
|
p.put("redirectUrl",redirectUrl);
|
|
|
}
|
|
|
p.put("remark",remark);
|
|
|
params.put("param",p);
|
|
|
|
|
|
logger.info("params :"+params.toString());
|
|
|
|
|
|
if(StringUtils.isNotBlank(openId)||StringUtils.isNotBlank(cardNo)){
|
|
|
String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
|
|
|
logger.info("rs :"+rs);
|
|
|
JSONObject rsJson = JSON.parseObject(rs);
|
|
|
String resCode = rsJson.getString("respCode");
|
|
|
if("000000".equals(resCode)){
|
|
|
return "1";
|
|
|
}
|
|
|
return "0";
|
|
|
}else {
|
|
|
return "-1";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String sendXCXMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String miniProgramPagepath,String miniProgramAppId){
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("transType","sms.hospital.notice");
|
|
|
params.put("merchId","3501000014");
|
|
|
params.put("miniProgramPagepath",miniProgramPagepath);
|
|
|
params.put("miniProgramAppId",miniProgramAppId);
|
|
|
JSONObject p = new JSONObject();
|
|
|
String openId = "";
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
List<BasePatientWechatDo> paientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient);
|
|
|
if(paientWechatDos!=null&&paientWechatDos.size()>0){
|
|
|
openId = paientWechatDos.get(0).getOpenid();
|
|
|
p.put("openId",openId);
|
|
|
}
|
|
|
}else {
|
|
|
p.put("cardNo",cardNo);
|
|
|
|
|
|
}
|
|
|
p.put("first",first);
|
|
|
p.put("noticeTime", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
p.put("noticeContent",noticeContent);
|
|
|
|
|
|
p.put("remark",remark);
|
|
|
params.put("param",p);
|
|
|
|
|
|
logger.info("params :"+params.toString());
|
|
|
|
|
|
if(StringUtils.isNotBlank(openId)||StringUtils.isNotBlank(cardNo)){
|
|
|
String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
|
|
|
logger.info("rs :"+rs);
|
|
|
JSONObject rsJson = JSON.parseObject(rs);
|
|
|
String resCode = rsJson.getString("respCode");
|
|
|
if("000000".equals(resCode)){
|
|
|
return "1";
|
|
|
}
|
|
|
return "0";
|
|
|
}else {
|
|
|
return "-1";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取心脏医院token
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getXzToken() throws Exception{
|
|
|
String url =getWXTokenUrl();
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("appId","1BQ08T2R60006501A8C00000BE73319D");
|
|
|
params.put("encryptType","DES");
|
|
|
params.put("sign","58E40DCEA527333B9E7C3CCD1A08979F");
|
|
|
params.put("signType","MD5");
|
|
|
params.put("timestamp",new Date().getTime());
|
|
|
params.put("version","v.1.0.0");
|
|
|
params.put("serviceId","ext.user.getTokenByMerchId");
|
|
|
JSONObject p = new JSONObject();
|
|
|
p.put("medicalId","3501000014");
|
|
|
params.put("param",p);
|
|
|
String path = url+"hospitalPortal-ext-app/ext/app/unifyapi";
|
|
|
String rs = HttpUtil.sendPost(path,params.toJSONString());
|
|
|
logger.info("rs :"+rs);
|
|
|
JSONObject rsJson = JSON.parseObject(rs);
|
|
|
String tokenAES = rsJson.getJSONObject("param").getString("token");
|
|
|
String token = AES.decrypt("xm_xxg_zxzx", tokenAES);
|
|
|
return token;
|
|
|
}
|
|
|
|
|
|
|
|
|
public String ehospitalNotice(String userName, String idCard, String phone, String title, String url, String content, String contentString) {
|
|
|
logger.info("ehospitalNotice:");
|
|
|
BasePatientDO patientDO = patientDao.findByIdcardAndDel(idCard,"1");
|
|
|
if(patientDO!=null&&StringUtils.isNotBlank(patientDO.getIdcard())){
|
|
|
sendMes("xm_xzzx_wx",patientDO.getId(),null,content,contentString,"",url);
|
|
|
}
|
|
|
return "-2";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=====================微信模板消息推送接口================================
|
|
|
|
|
|
|
|
|
//=====================hospital应用调用entrance应用============start=================
|
|
|
|
|
|
/**
|
|
|
* 查询患者就诊卡
|
|
|
* @param patient 居民code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectPateintCard(String patient) throws Exception {
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
String idCard = "";
|
|
|
if (patientDO==null||StringUtil.isBlank(patientDO.getIdcard())){
|
|
|
throw new Exception("居民身份证不存在");
|
|
|
}else {
|
|
|
idCard = patientDO.getIdcard();
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
String response="";
|
|
|
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 jsonObject = array.getJSONObject(i);
|
|
|
String cardType = jsonObject.getString("CARD_TYPE");
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = wlyyHospitalSysDictDao.findByHospitalAndDictCode("350211A5010",jsonObject.getString("CARD_TYPE"));
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
jsonObject.put("CARD_TYPE",hospitalSysDictDO.getDictValue());
|
|
|
jsonObject.put("CARD_TYPE_HIS",cardType);
|
|
|
}else {
|
|
|
jsonObject.put("CARD_TYPE",null);
|
|
|
jsonObject.put("CARD_TYPE_HIS",cardType);
|
|
|
}
|
|
|
}
|
|
|
/*if (array!=null&&array.size()!=0){
|
|
|
JSONObject object1 = array.getJSONObject(0);
|
|
|
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"));
|
|
|
}
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
}*/
|
|
|
return array;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
/**
|
|
|
* 查询患者就诊卡
|
|
|
* @param idCard 居民code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray selectPateintCardByIdCard(String idCard) throws Exception {
|
|
|
String response="";
|
|
|
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);
|
|
|
/*if (array!=null&&array.size()!=0){
|
|
|
JSONObject object1 = array.getJSONObject(0);
|
|
|
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"));
|
|
|
}
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
}*/
|
|
|
return array;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 同步医生信息
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer syncDoctorInfo() throws Exception {
|
|
|
String response="";
|
|
|
String idCard="";
|
|
|
String url = entranceUrl+"getDoctorInfo?idCard="+idCard;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
}
|
|
|
return object.getInteger("status");
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 同步部门信息
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer syncDeptInfo() throws Exception {
|
|
|
String response="";
|
|
|
String code="";
|
|
|
String url = entranceUrl+"getDeptInfo?code="+code;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
}
|
|
|
return object.getInteger("status");
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 同步职称
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer syncJobTitle() throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getJobTitle";
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
}
|
|
|
return object.getInteger("status");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 同步号别
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer syncChargeDict() throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getChargeDict";
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
}
|
|
|
return object.getInteger("status");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取卡信息
|
|
|
* @param cardNo 就诊卡
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject selectCardInfo(String cardNo){
|
|
|
JSONArray array = new JSONArray();
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getCardInfo?cardNo="+cardNo;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (object.getInteger("status")==200){
|
|
|
array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
jsonObject = array.getJSONObject(0);
|
|
|
}
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
public String savePatientMapping(String patient){
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
String response="";
|
|
|
String idCard = patientDO.getIdcard();
|
|
|
String url = entranceUrl+"findPatientCard?idCard="+idCard;
|
|
|
String mappingCode="";
|
|
|
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);
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
JSONObject object1 = array.getJSONObject(0);
|
|
|
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"));
|
|
|
}
|
|
|
mappingCode=object1.getString("SICKID");
|
|
|
patientMappingDO = patientMappingDao.save(patientMappingDO);
|
|
|
}
|
|
|
}
|
|
|
return mappingCode;
|
|
|
}
|
|
|
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);
|
|
|
logger.info("判断卡号是否相同:"+object1.getString("CARD_NO")+"cardNo:"+cardNo);
|
|
|
if (object1.getString("CARD_NO").equalsIgnoreCase(cardNo)){
|
|
|
logger.info("卡号相同");
|
|
|
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
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime,String cardNo) throws Exception {
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
|
|
|
JSONArray array = new JSONArray();
|
|
|
String response="";
|
|
|
patient = updatePatientMapping(patient,cardNo);
|
|
|
String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&startTime="+startTime+"&endTime="+endTime;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
|
if (jsonObject.getInteger("status")==200){
|
|
|
array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
|
|
|
outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
|
|
|
outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
|
|
|
outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
|
|
|
outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
|
|
|
outpatientVO.setDept(isEmty(object.getString("DEPT")));
|
|
|
outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
|
|
|
outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
|
|
|
outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
|
|
|
outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
|
|
|
outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
|
|
|
outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
|
|
|
outpatientVO.setMjz(isEmty(object.getString("MJZ")));
|
|
|
outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
|
|
|
outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
|
|
|
outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
|
|
|
outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
|
|
|
outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
|
|
|
outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
|
|
|
outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
|
|
|
outpatientVO.setStatus(isEmty(object.getString("STATUS")));
|
|
|
outpatientVO.setConNo(isEmty(object.getString("VISITNUM")));
|
|
|
outpatientVO.setPatient(patient);
|
|
|
wlyyOutpatientVOList.add(outpatientVO);
|
|
|
}
|
|
|
}
|
|
|
return wlyyOutpatientVOList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取单条门诊就诊记录
|
|
|
* @param patient 居民id
|
|
|
* @param conNo 就诊次数
|
|
|
* @return
|
|
|
*/
|
|
|
public WlyyOutpatientVO selectOutpatientInfo(String patient,String conNo){
|
|
|
WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
|
|
|
JSONArray array = new JSONArray();
|
|
|
String response="";
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
if (patientMappingDO!=null){
|
|
|
patient = patientMappingDO.getMappingCode();
|
|
|
}else {
|
|
|
patient = savePatientMapping(patient);
|
|
|
}
|
|
|
String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&conNo="+conNo;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
|
if (jsonObject.getInteger("status")==200){
|
|
|
array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
JSONObject object = array.getJSONObject(0);
|
|
|
outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
|
|
|
outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
|
|
|
outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
|
|
|
outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
|
|
|
outpatientVO.setDept(isEmty(object.getString("DEPT")));
|
|
|
outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
|
|
|
outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
|
|
|
outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
|
|
|
outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
|
|
|
outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
|
|
|
outpatientVO.setMjz(isEmty(object.getString("MJZ")));
|
|
|
outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
|
|
|
outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
|
|
|
outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
|
|
|
outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
|
|
|
outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
|
|
|
outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
|
|
|
outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
|
|
|
outpatientVO.setStatus(isEmty(object.getString("STATUS")));
|
|
|
outpatientVO.setConNo(isEmty(object.getString("VISITNUM")));
|
|
|
outpatientVO.setHospitalName("厦门大学附属心血管病医院");
|
|
|
outpatientVO.setHospital("350211A5010");
|
|
|
outpatientVO.setSex(patientDO.getSex()+"");
|
|
|
outpatientVO.setPatient(patientDO.getId());
|
|
|
outpatientVO.setBirthday(patientDO.getBirthday());
|
|
|
}
|
|
|
}
|
|
|
return outpatientVO;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String,Object> updatePreStatusLocal(String admNo,String realOrder,String status) throws Exception {
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
logger.info("admNo"+admNo+"=========realOrder"+realOrder+"===========status"+status);
|
|
|
if (status.equalsIgnoreCase("1")){
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
|
|
|
if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
|
|
|
throw new Exception("该就诊号查不到!");
|
|
|
}
|
|
|
for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
|
|
|
String registerNo = wlyyOutpatientDO.getRegisterNo();
|
|
|
if (!StringUtils.isNoneBlank(registerNo)){
|
|
|
throw new Exception("挂号流水号为空!");
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
|
|
|
List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionListLocal(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
|
|
|
for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
|
|
|
WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
|
|
|
prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
|
|
|
if (status.equalsIgnoreCase("1")){
|
|
|
prescriptionDO.setStatus(20);
|
|
|
}
|
|
|
prescriptionDO.setDoctor(wlyyOutpatientDO.getDoctor());
|
|
|
prescriptionDO.setPatientCode(wlyyOutpatientDO.getPatient());
|
|
|
prescriptionDO= prescriptionDao.save(prescriptionDO);
|
|
|
//处方诊断表vo
|
|
|
List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
|
|
|
for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
|
|
|
WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
|
|
|
prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
prescriptionDiagnosisDO.setDel(1);
|
|
|
diagnosisDao.save(prescriptionDiagnosisDO);
|
|
|
}
|
|
|
//药品表
|
|
|
List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
|
|
|
for (WlyyPrescriptionInfoVO infoVO:infoVOList){
|
|
|
WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
|
|
|
infoDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
infoDO.setDel(1);
|
|
|
prescriptionInfoDao.save(infoDO);
|
|
|
}
|
|
|
|
|
|
List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
|
|
|
for (WlyyInspectionVO inspectionVO:inspectionVOList){
|
|
|
WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
|
|
|
BeanUtils.copyProperties(inspectionVO,inspectionDO);
|
|
|
inspectionDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
inspectionDO.setDel(1);
|
|
|
wlyyInspectionDao.save(inspectionDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else if (status.equalsIgnoreCase("2")){
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
|
|
|
wlyyPrescriptionDO.setStatus(-1);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
//检查
|
|
|
List<WlyyInspectionDO> wlyyInspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyInspectionDO inspectionDO:wlyyInspectionDOS){
|
|
|
inspectionDO.setDel(0);
|
|
|
wlyyInspectionDao.save(inspectionDO);
|
|
|
}
|
|
|
//药品
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS=prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOS){
|
|
|
prescriptionInfoDO.setDel(0);
|
|
|
prescriptionInfoDao.save(prescriptionInfoDO);
|
|
|
}
|
|
|
//诊断
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
|
|
|
diagnosisDO.setDel(0);
|
|
|
prescriptionDiagnosisDao.save(diagnosisDO);
|
|
|
}
|
|
|
}
|
|
|
}else if (status.equalsIgnoreCase("3")){
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
|
|
|
wlyyPrescriptionDO.setStatus(30);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊下所有处方信息
|
|
|
* @param registerSn 流水号
|
|
|
* @param patNo 居民id
|
|
|
* @param admNo 住院唯一号
|
|
|
* @param realOrder 处方号
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyPrescriptionVO> selectOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder){
|
|
|
List<WlyyPrescriptionVO> prescriptionVOList = new ArrayList<>();
|
|
|
String response="";
|
|
|
String params = "";
|
|
|
if (StringUtils.isNoneBlank(realOrder)){
|
|
|
params +="&realOrder="+realOrder;
|
|
|
}
|
|
|
logger.info("处方request:"+registerSn+"=="+patNo+"==="+admNo+"===="+realOrder);
|
|
|
String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("处方response:"+response+"===="+url);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object!=null&&object.getInteger("status")==200){
|
|
|
JSONArray array = new JSONArray();
|
|
|
array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
wlyyPrescriptionVO.setCreateTime(DateUtil.strToDate(isEmty(jsonObject.getString("CREATETIME"))));
|
|
|
wlyyPrescriptionVO.setCreateUser(isEmty(jsonObject.getString("CREATEUSER")));
|
|
|
wlyyPrescriptionVO.setCreateUserName(isEmty(jsonObject.getString("CREATENAME")));
|
|
|
wlyyPrescriptionVO.setUpdateTime(DateUtil.strToDate(isEmty(jsonObject.getString("UPDATETIME"))));
|
|
|
wlyyPrescriptionVO.setUpdateUser(isEmty(jsonObject.getString("UPDATEUSER")));
|
|
|
wlyyPrescriptionVO.setUpdateUserName(isEmty(jsonObject.getString("UPDATEUSERNAME")));
|
|
|
wlyyPrescriptionVO.setRealOrder(isEmty(jsonObject.getString("REALORDER")));
|
|
|
wlyyPrescriptionVO.setOriginRealOrder(isEmty(jsonObject.getString("ORIGINREALORDER")));
|
|
|
wlyyPrescriptionVO.setAdmNo(isEmty(jsonObject.getString("ADMNO")));
|
|
|
wlyyPrescriptionVO.setOriginAdmNo(isEmty(jsonObject.getString("ORIGINADMNO")));
|
|
|
wlyyPrescriptionVO.setSerialNo(isEmty(jsonObject.getString("SERIALNO")));
|
|
|
wlyyPrescriptionVO.setOriginSerialNo(isEmty(jsonObject.getString("ORIGINSERIALNO")));
|
|
|
wlyyPrescriptionVO.setType(jsonObject.getInteger("TYPE"));
|
|
|
wlyyPrescriptionVO.setPatientCode(isEmty(jsonObject.getString("PATIENTCODE")));
|
|
|
wlyyPrescriptionVO.setPatientName(isEmty(jsonObject.getString("PATEINTNAME")));
|
|
|
wlyyPrescriptionVO.setIdcard(isEmty(jsonObject.getString("IDCARD")));
|
|
|
wlyyPrescriptionVO.setCardNo(isEmty(jsonObject.getString("CARDNO")));
|
|
|
wlyyPrescriptionVO.setSsc(isEmty(jsonObject.getString("SSC")));
|
|
|
wlyyPrescriptionVO.setDoctor(isEmty(jsonObject.getString("DOCTOR")));
|
|
|
wlyyPrescriptionVO.setDoctorName(isEmty(jsonObject.getString("DOCTORNAME")));
|
|
|
wlyyPrescriptionVO.setStatus(jsonObject.getInteger("STATUS"));
|
|
|
wlyyPrescriptionVO.setMkFailReason(isEmty(jsonObject.getString("MKFAILREASON")));
|
|
|
wlyyPrescriptionVO.setMkTime(DateUtil.strToDate(isEmty(jsonObject.getString("MKTIME"))));
|
|
|
wlyyPrescriptionVO.setPrescribeTime(DateUtil.strToDate(isEmty(jsonObject.getString("PRESCRIBETIME"))));
|
|
|
wlyyPrescriptionVO.setPrescribeReason(isEmty(jsonObject.getString("PRESCRIBEREASON")));
|
|
|
wlyyPrescriptionVO.setPayTime(DateUtil.strToDate(isEmty(jsonObject.getString("PAYTIME"))));
|
|
|
wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate(isEmty(jsonObject.getString("DOSAGETIME"))));
|
|
|
wlyyPrescriptionVO.setFinishTime(DateUtil.strToDate(isEmty(jsonObject.getString("FINISHTIME"))));
|
|
|
wlyyPrescriptionVO.setDept(isEmty(jsonObject.getString("DEPT")));
|
|
|
wlyyPrescriptionVO.setDeptName(isEmty(jsonObject.getString("DEPTNAME")));
|
|
|
wlyyPrescriptionVO.setHospital(isEmty(jsonObject.getString("HOSPITAL")));
|
|
|
wlyyPrescriptionVO.setHospitalName(isEmty(jsonObject.getString("HOSPITALNAME")));
|
|
|
wlyyPrescriptionVO.setConsult(isEmty(jsonObject.getString("CONSULT")));
|
|
|
wlyyPrescriptionVO.setDispensaryType(isEmty(jsonObject.getString("DISPENSARYTYPE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("DISPENSARYTYPE"))):null);
|
|
|
wlyyPrescriptionVO.setReason(isEmty(jsonObject.getString("REASON")));
|
|
|
wlyyPrescriptionVO.setDiseaseImg(isEmty(jsonObject.getString("DISEASEIMG")));
|
|
|
wlyyPrescriptionVO.setRemark(isEmty(jsonObject.getString("REMARK")));
|
|
|
wlyyPrescriptionVO.setCancelReason(isEmty(jsonObject.getString("CANCELREASON")));
|
|
|
wlyyPrescriptionVO.setCaCertData(isEmty(jsonObject.getString("CACERTDATA")));
|
|
|
wlyyPrescriptionVO.setCaMessage(isEmty(jsonObject.getString("CAMESSAGE")));
|
|
|
wlyyPrescriptionVO.setDigitalSignNo(isEmty(jsonObject.getString("DIGITALSIGNNO")));
|
|
|
wlyyPrescriptionVO.setOriginalDataAbstract(isEmty(jsonObject.getString("ORIGINALDATAABSTRACT")));
|
|
|
wlyyPrescriptionVO.setStrOriginalData(isEmty(jsonObject.getString("STRORIGINALDATA")));
|
|
|
wlyyPrescriptionVO.setHisDeptCode(isEmty(jsonObject.getString("HISDEPTCODE")));
|
|
|
wlyyPrescriptionVO.setHisDoctorCode(isEmty(jsonObject.getString("HISDOCTORCODE")));
|
|
|
wlyyPrescriptionVO.setHisGisterTypeCode(isEmty(jsonObject.getString("HISGISTERTYPECODE")));
|
|
|
wlyyPrescriptionVO.setHisRateTypeCode(isEmty(jsonObject.getString("HISRATETYPECODE")));
|
|
|
wlyyPrescriptionVO.setHisHospital(isEmty(jsonObject.getString("HISHOSPITAL")));
|
|
|
wlyyPrescriptionVO.setHisRegisterFee(isEmty(jsonObject.getString("HISREGISTERFEE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("HISREGISTERFEE"))):null);
|
|
|
wlyyPrescriptionVO.setPayStatus(isEmty(jsonObject.getString("PAYSTATUS"))!=null?Integer.parseInt(isEmty(jsonObject.getString("PAYSTATUS"))):null);
|
|
|
//TODO 快递数据
|
|
|
wlyyPrescriptionVO.setDispUser(isEmty(jsonObject.getString("DISPUSER")));
|
|
|
wlyyPrescriptionVO.setDispUserName(isEmty(jsonObject.getString("DISPUSERNAME")));
|
|
|
wlyyPrescriptionVO.setDispDate(DateUtil.strToDate(isEmty(jsonObject.getString("DISPDATE"))));
|
|
|
|
|
|
//诊断
|
|
|
String disagnosisUrl = entranceUrl+"getOutpatientDiagnosis?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String disagnosisResponse = httpClientUtil.get(disagnosisUrl,"GBK");
|
|
|
logger.info("诊断disagnosisResponse:"+disagnosisResponse);
|
|
|
JSONObject object1 = JSONObject.parseObject(disagnosisResponse);
|
|
|
if (object1.getString("status").equalsIgnoreCase("200")){
|
|
|
JSONArray jsonArray = object1.getJSONArray("obj").getJSONArray(0);
|
|
|
List<WlyyPrescriptionDiagnosisVO> prescriptionDiagnosisVOS = new ArrayList<>();
|
|
|
for (int j=0;j<jsonArray.size();j++){
|
|
|
JSONObject disagnosisJson = jsonArray.getJSONObject(j);
|
|
|
WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = new WlyyPrescriptionDiagnosisVO();
|
|
|
prescriptionDiagnosisVO.setCode(isEmty(disagnosisJson.getString("DIAGNOSECODE")));
|
|
|
prescriptionDiagnosisVO.setName(isEmty(disagnosisJson.getString("DIAGNOSENAME")));
|
|
|
prescriptionDiagnosisVO.setType(isEmty(disagnosisJson.getString("DIAGNOSETYPE"))==null?null:Integer.parseInt(disagnosisJson.getString("DIAGNOSETYPE")));
|
|
|
prescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
|
|
|
}
|
|
|
wlyyPrescriptionVO.setDiagnosisVOs(prescriptionDiagnosisVOS);
|
|
|
}
|
|
|
|
|
|
String infoUrl = entranceUrl+"getOutpatientDrugInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String infoResponse = httpClientUtil.get(infoUrl,"GBK");
|
|
|
logger.info("药品infoResponse:"+infoResponse);
|
|
|
JSONObject infoObject = JSONObject.parseObject(infoResponse);
|
|
|
if (infoObject.getString("status").equalsIgnoreCase("200")) {
|
|
|
JSONArray infoArray = infoObject.getJSONArray("obj").getJSONArray(0);
|
|
|
//药品
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOList = new ArrayList<>();
|
|
|
for (int j=0;j<infoArray.size();j++){
|
|
|
WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
|
|
|
JSONObject infoJson = infoArray.getJSONObject(j);
|
|
|
prescriptionInfoVO.setDrugNo(isEmty(infoJson.getString("DRUGNO")));
|
|
|
prescriptionInfoVO.setDrugName(isEmty(infoJson.getString("DRUGNAME")));
|
|
|
prescriptionInfoVO.setDispDeposite(isEmty(infoJson.getString("DISPDEPOSITE")));
|
|
|
prescriptionInfoVO.setDosage(isEmty(infoJson.getString("DOSAGE")));
|
|
|
prescriptionInfoVO.setQuantity(isEmty(infoJson.getString("QUANTITY")));
|
|
|
prescriptionInfoVO.setUnit(isEmty(infoJson.getString("UNIT")));
|
|
|
prescriptionInfoVO.setUnitName(isEmty(infoJson.getString("UNITNAME")));
|
|
|
prescriptionInfoVO.setPackUnitName(isEmty(infoJson.getString("PACKUNITNAME")));
|
|
|
prescriptionInfoVO.setPackUnit(isEmty(infoJson.getString("PACKUNIT")));
|
|
|
prescriptionInfoVO.setUsageCode(isEmty(infoJson.getString("USAGECODE")));
|
|
|
prescriptionInfoVO.setUsageName(isEmty(infoJson.getString("USAGENAME")));
|
|
|
prescriptionInfoVO.setSupplyCode(isEmty(infoJson.getString("SUPPLYCODE")));
|
|
|
prescriptionInfoVO.setSupplyName(isEmty(infoJson.getString("SUPPLYNAME")));
|
|
|
prescriptionInfoVO.setDays(isEmty(infoJson.getString("DAYS")));
|
|
|
prescriptionInfoVO.setFrequency(isEmty(infoJson.getString("FREQUENCY")));
|
|
|
prescriptionInfoVO.setSerial(isEmty(infoJson.getString("SERIAL")));
|
|
|
/* prescriptionInfoVO.setGroupNo(isEmty(infoJson.getString("groupNo")));*/
|
|
|
prescriptionInfoVO.setSpecification(isEmty(infoJson.getString("SPECIFICATION")));
|
|
|
prescriptionInfoVO.setPackRetprice(isEmty(infoJson.getString("PACKRETPRICE"))==null?0.0:infoJson.getDouble("PACKRETPRICE"));
|
|
|
prescriptionInfoVO.setHerbalCount(isEmty(infoJson.getString("HERBALCOUNT")));
|
|
|
prescriptionInfoVO.setPostCount(isEmty(infoJson.getString("POSTCOUNT")));
|
|
|
prescriptionInfoVO.setDel(isEmty(infoJson.getString("DEL"))==null?1:infoJson.getInteger("DEL"));
|
|
|
prescriptionInfoVO.setComm(infoJson.getString("COMM"));
|
|
|
wlyyPrescriptionInfoVOList.add(prescriptionInfoVO);
|
|
|
wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//检查检验内容
|
|
|
String inspectionUrl = entranceUrl+"getOutpatientCheckTestInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String inspectionResponse = httpClientUtil.get(inspectionUrl,"GBK");
|
|
|
logger.info("检查检验内容inspectionResponse:"+inspectionResponse);
|
|
|
JSONObject inspectionObject = JSONObject.parseObject(inspectionResponse);
|
|
|
if (inspectionObject.getString("status").equalsIgnoreCase("200")) {
|
|
|
List<WlyyInspectionVO> wlyyInspectionVOList = new ArrayList<>();
|
|
|
JSONArray inspectionArray = inspectionObject.getJSONArray("obj").getJSONArray(0);
|
|
|
for (int j=0;j<inspectionArray.size();j++){
|
|
|
WlyyInspectionVO inspectionVO = new WlyyInspectionVO();
|
|
|
JSONObject inspectionJson = inspectionArray.getJSONObject(j);
|
|
|
inspectionVO.setGroupName(isEmty(inspectionJson.getString("GROUPNAME")));
|
|
|
inspectionVO.setQuantity(isEmty(inspectionJson.getString("QUANTITYS"))!=null?Integer.parseInt(isEmty(inspectionJson.getString("QUANTITYS"))):null);
|
|
|
inspectionVO.setFrequency(isEmty(inspectionJson.getString("FREQUENCYS")));
|
|
|
inspectionVO.setParentCode(isEmty(inspectionJson.getString("PARENTCODE")));
|
|
|
inspectionVO.setParentName(isEmty(inspectionJson.getString("PARENTCODENAME")));
|
|
|
inspectionVO.setCode(isEmty(inspectionJson.getString("CODES")));
|
|
|
inspectionVO.setName(isEmty(inspectionJson.getString("NAMES")));
|
|
|
inspectionVO.setInformation(isEmty(inspectionJson.getString("INFORMATION")));
|
|
|
inspectionVO.setCheckEquip(isEmty(inspectionJson.getString("CHECKEQUIP")));
|
|
|
inspectionVO.setCheckPartName(isEmty(inspectionJson.getString("CHECKPARTNAME")));
|
|
|
inspectionVO.setCheckPart(isEmty(inspectionJson.getString("CHECKPART")));
|
|
|
wlyyInspectionVOList.add(inspectionVO);
|
|
|
}
|
|
|
wlyyPrescriptionVO.setInspectionVOs(wlyyInspectionVOList);
|
|
|
}
|
|
|
try {
|
|
|
List<WlyyPrescriptionEmrDO> listEmr = selectHistoryEmr(patNo,"");
|
|
|
if (null!=listEmr&&listEmr.size()>0){
|
|
|
wlyyPrescriptionVO.setWlyyPrescriptionEmrDO(listEmr.get(0));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
prescriptionVOList.add(wlyyPrescriptionVO);
|
|
|
}
|
|
|
}
|
|
|
return prescriptionVOList;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊下所有处方信息---内网调下
|
|
|
* @param registerSn 流水号
|
|
|
* @param patNo 居民id
|
|
|
* @param admNo 住院唯一号
|
|
|
* @param realOrder 处方号
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyPrescriptionVO> selectOriginPrescriptionListLocal(String registerSn,String patNo,String admNo,String realOrder){
|
|
|
List<WlyyPrescriptionVO> prescriptionVOList = new ArrayList<>();
|
|
|
String response="";
|
|
|
String params = "";
|
|
|
if (StringUtils.isNoneBlank(realOrder)){
|
|
|
params +="&realOrder="+realOrder;
|
|
|
}
|
|
|
logger.info("处方request:"+registerSn+"=="+patNo+"==="+admNo+"===="+realOrder);
|
|
|
String url = entranceUrlLocal+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("处方response:"+response+"===="+url);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object!=null&&object.getInteger("status")==200){
|
|
|
JSONArray array = new JSONArray();
|
|
|
array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
wlyyPrescriptionVO.setCreateTime(DateUtil.strToDate(isEmty(jsonObject.getString("CREATETIME"))));
|
|
|
wlyyPrescriptionVO.setCreateUser(isEmty(jsonObject.getString("CREATEUSER")));
|
|
|
wlyyPrescriptionVO.setCreateUserName(isEmty(jsonObject.getString("CREATENAME")));
|
|
|
wlyyPrescriptionVO.setUpdateTime(DateUtil.strToDate(isEmty(jsonObject.getString("UPDATETIME"))));
|
|
|
wlyyPrescriptionVO.setUpdateUser(isEmty(jsonObject.getString("UPDATEUSER")));
|
|
|
wlyyPrescriptionVO.setUpdateUserName(isEmty(jsonObject.getString("UPDATEUSERNAME")));
|
|
|
wlyyPrescriptionVO.setRealOrder(isEmty(jsonObject.getString("REALORDER")));
|
|
|
wlyyPrescriptionVO.setOriginRealOrder(isEmty(jsonObject.getString("ORIGINREALORDER")));
|
|
|
wlyyPrescriptionVO.setAdmNo(isEmty(jsonObject.getString("ADMNO")));
|
|
|
wlyyPrescriptionVO.setOriginAdmNo(isEmty(jsonObject.getString("ORIGINADMNO")));
|
|
|
wlyyPrescriptionVO.setSerialNo(isEmty(jsonObject.getString("SERIALNO")));
|
|
|
wlyyPrescriptionVO.setOriginSerialNo(isEmty(jsonObject.getString("ORIGINSERIALNO")));
|
|
|
wlyyPrescriptionVO.setType(jsonObject.getInteger("TYPE"));
|
|
|
wlyyPrescriptionVO.setPatientCode(isEmty(jsonObject.getString("PATIENTCODE")));
|
|
|
wlyyPrescriptionVO.setPatientName(isEmty(jsonObject.getString("PATEINTNAME")));
|
|
|
wlyyPrescriptionVO.setIdcard(isEmty(jsonObject.getString("IDCARD")));
|
|
|
wlyyPrescriptionVO.setCardNo(isEmty(jsonObject.getString("CARDNO")));
|
|
|
wlyyPrescriptionVO.setSsc(isEmty(jsonObject.getString("SSC")));
|
|
|
wlyyPrescriptionVO.setDoctor(isEmty(jsonObject.getString("DOCTOR")));
|
|
|
wlyyPrescriptionVO.setDoctorName(isEmty(jsonObject.getString("DOCTORNAME")));
|
|
|
wlyyPrescriptionVO.setStatus(jsonObject.getInteger("STATUS"));
|
|
|
wlyyPrescriptionVO.setMkFailReason(isEmty(jsonObject.getString("MKFAILREASON")));
|
|
|
wlyyPrescriptionVO.setMkTime(DateUtil.strToDate(isEmty(jsonObject.getString("MKTIME"))));
|
|
|
wlyyPrescriptionVO.setPrescribeTime(DateUtil.strToDate(isEmty(jsonObject.getString("PRESCRIBETIME"))));
|
|
|
wlyyPrescriptionVO.setPrescribeReason(isEmty(jsonObject.getString("PRESCRIBEREASON")));
|
|
|
wlyyPrescriptionVO.setPayTime(DateUtil.strToDate(isEmty(jsonObject.getString("PAYTIME"))));
|
|
|
wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate(isEmty(jsonObject.getString("DOSAGETIME"))));
|
|
|
wlyyPrescriptionVO.setFinishTime(DateUtil.strToDate(isEmty(jsonObject.getString("FINISHTIME"))));
|
|
|
wlyyPrescriptionVO.setDept(isEmty(jsonObject.getString("DEPT")));
|
|
|
wlyyPrescriptionVO.setDeptName(isEmty(jsonObject.getString("DEPTNAME")));
|
|
|
wlyyPrescriptionVO.setHospital(isEmty(jsonObject.getString("HOSPITAL")));
|
|
|
wlyyPrescriptionVO.setHospitalName(isEmty(jsonObject.getString("HOSPITALNAME")));
|
|
|
wlyyPrescriptionVO.setConsult(isEmty(jsonObject.getString("CONSULT")));
|
|
|
wlyyPrescriptionVO.setDispensaryType(isEmty(jsonObject.getString("DISPENSARYTYPE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("DISPENSARYTYPE"))):null);
|
|
|
wlyyPrescriptionVO.setReason(isEmty(jsonObject.getString("REASON")));
|
|
|
wlyyPrescriptionVO.setDiseaseImg(isEmty(jsonObject.getString("DISEASEIMG")));
|
|
|
wlyyPrescriptionVO.setRemark(isEmty(jsonObject.getString("REMARK")));
|
|
|
wlyyPrescriptionVO.setCancelReason(isEmty(jsonObject.getString("CANCELREASON")));
|
|
|
wlyyPrescriptionVO.setCaCertData(isEmty(jsonObject.getString("CACERTDATA")));
|
|
|
wlyyPrescriptionVO.setCaMessage(isEmty(jsonObject.getString("CAMESSAGE")));
|
|
|
wlyyPrescriptionVO.setDigitalSignNo(isEmty(jsonObject.getString("DIGITALSIGNNO")));
|
|
|
wlyyPrescriptionVO.setOriginalDataAbstract(isEmty(jsonObject.getString("ORIGINALDATAABSTRACT")));
|
|
|
wlyyPrescriptionVO.setStrOriginalData(isEmty(jsonObject.getString("STRORIGINALDATA")));
|
|
|
wlyyPrescriptionVO.setHisDeptCode(isEmty(jsonObject.getString("HISDEPTCODE")));
|
|
|
wlyyPrescriptionVO.setHisDoctorCode(isEmty(jsonObject.getString("HISDOCTORCODE")));
|
|
|
wlyyPrescriptionVO.setHisGisterTypeCode(isEmty(jsonObject.getString("HISGISTERTYPECODE")));
|
|
|
wlyyPrescriptionVO.setHisRateTypeCode(isEmty(jsonObject.getString("HISRATETYPECODE")));
|
|
|
wlyyPrescriptionVO.setHisHospital(isEmty(jsonObject.getString("HISHOSPITAL")));
|
|
|
wlyyPrescriptionVO.setHisRegisterFee(isEmty(jsonObject.getString("HISREGISTERFEE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("HISREGISTERFEE"))):null);
|
|
|
wlyyPrescriptionVO.setPayStatus(isEmty(jsonObject.getString("PAYSTATUS"))!=null?Integer.parseInt(isEmty(jsonObject.getString("PAYSTATUS"))):null);
|
|
|
//TODO 快递数据
|
|
|
wlyyPrescriptionVO.setDispUser(isEmty(jsonObject.getString("DISPUSER")));
|
|
|
wlyyPrescriptionVO.setDispUserName(isEmty(jsonObject.getString("DISPUSERNAME")));
|
|
|
wlyyPrescriptionVO.setDispDate(DateUtil.strToDate(isEmty(jsonObject.getString("DISPDATE"))));
|
|
|
|
|
|
//诊断
|
|
|
String disagnosisUrl = entranceUrlLocal+"getOutpatientDiagnosis?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String disagnosisResponse = httpClientUtil.get(disagnosisUrl,"GBK");
|
|
|
logger.info("诊断disagnosisResponse:"+disagnosisResponse);
|
|
|
JSONObject object1 = JSONObject.parseObject(disagnosisResponse);
|
|
|
if (object1.getString("status").equalsIgnoreCase("200")){
|
|
|
|
|
|
JSONArray jsonArray = JSONArray.parseArray(object1.getString("obj")).getJSONArray(0);
|
|
|
logger.info("诊断"+jsonArray.toJSONString());
|
|
|
List<WlyyPrescriptionDiagnosisVO> prescriptionDiagnosisVOS = new ArrayList<>();
|
|
|
for (int j=0;j<jsonArray.size();j++){
|
|
|
JSONObject disagnosisJson = jsonArray.getJSONObject(j);
|
|
|
WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = new WlyyPrescriptionDiagnosisVO();
|
|
|
prescriptionDiagnosisVO.setCode(isEmty(disagnosisJson.getString("DIAGNOSECODE")));
|
|
|
prescriptionDiagnosisVO.setName(isEmty(disagnosisJson.getString("DIAGNOSENAME")));
|
|
|
prescriptionDiagnosisVO.setType(isEmty(disagnosisJson.getString("DIAGNOSETYPE"))==null?null:Integer.parseInt(disagnosisJson.getString("DIAGNOSETYPE")));
|
|
|
prescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
|
|
|
}
|
|
|
wlyyPrescriptionVO.setDiagnosisVOs(prescriptionDiagnosisVOS);
|
|
|
}
|
|
|
|
|
|
String infoUrl = entranceUrlLocal+"getOutpatientDrugInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String infoResponse = httpClientUtil.get(infoUrl,"GBK");
|
|
|
logger.info("药品infoResponse:"+infoResponse);
|
|
|
JSONObject infoObject = JSONObject.parseObject(infoResponse);
|
|
|
if (infoObject.getString("status").equalsIgnoreCase("200")) {
|
|
|
JSONArray infoArray = JSONArray.parseArray(infoObject.getString("obj")).getJSONArray(0);
|
|
|
//药品
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOList = new ArrayList<>();
|
|
|
for (int j=0;j<infoArray.size();j++){
|
|
|
WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
|
|
|
JSONObject infoJson = infoArray.getJSONObject(j);
|
|
|
prescriptionInfoVO.setDrugNo(isEmty(infoJson.getString("DRUGNO")));
|
|
|
prescriptionInfoVO.setDrugName(isEmty(infoJson.getString("DRUGNAME")));
|
|
|
prescriptionInfoVO.setDispDeposite(isEmty(infoJson.getString("DISPDEPOSITE")));
|
|
|
prescriptionInfoVO.setDosage(isEmty(infoJson.getString("DOSAGE")));
|
|
|
prescriptionInfoVO.setQuantity(isEmty(infoJson.getString("QUANTITY")));
|
|
|
prescriptionInfoVO.setUnit(isEmty(infoJson.getString("UNIT")));
|
|
|
prescriptionInfoVO.setUnitName(isEmty(infoJson.getString("UNITNAME")));
|
|
|
prescriptionInfoVO.setPackUnitName(isEmty(infoJson.getString("PACKUNITNAME")));
|
|
|
prescriptionInfoVO.setPackUnit(isEmty(infoJson.getString("PACKUNIT")));
|
|
|
prescriptionInfoVO.setUsageCode(isEmty(infoJson.getString("USAGECODE")));
|
|
|
prescriptionInfoVO.setUsageName(isEmty(infoJson.getString("USAGENAME")));
|
|
|
prescriptionInfoVO.setSupplyCode(isEmty(infoJson.getString("SUPPLYCODE")));
|
|
|
prescriptionInfoVO.setSupplyName(isEmty(infoJson.getString("SUPPLYNAME")));
|
|
|
prescriptionInfoVO.setDays(isEmty(infoJson.getString("DAYS")));
|
|
|
prescriptionInfoVO.setFrequency(isEmty(infoJson.getString("FREQUENCY")));
|
|
|
prescriptionInfoVO.setSerial(isEmty(infoJson.getString("SERIAL")));
|
|
|
/* prescriptionInfoVO.setGroupNo(isEmty(infoJson.getString("groupNo")));*/
|
|
|
prescriptionInfoVO.setSpecification(isEmty(infoJson.getString("SPECIFICATION")));
|
|
|
prescriptionInfoVO.setPackRetprice(isEmty(infoJson.getString("PACKRETPRICE"))!=null?Double.parseDouble(isEmty(infoJson.getString("PACKRETPRICE"))):null);
|
|
|
prescriptionInfoVO.setHerbalCount(isEmty(infoJson.getString("HERBALCOUNT")));
|
|
|
prescriptionInfoVO.setPostCount(isEmty(infoJson.getString("POSTCOUNT")));
|
|
|
prescriptionInfoVO.setDel(isEmty(infoJson.getString("DEL"))!=null?Integer.parseInt(infoJson.getString("DEL")):null);
|
|
|
prescriptionInfoVO.setComm(infoJson.getString("COMM"));
|
|
|
wlyyPrescriptionInfoVOList.add(prescriptionInfoVO);
|
|
|
wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//检查检验内容
|
|
|
String inspectionUrl = entranceUrlLocal+"getOutpatientCheckTestInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
|
|
|
String inspectionResponse = httpClientUtil.get(inspectionUrl,"GBK");
|
|
|
logger.info("检查检验内容inspectionResponse:"+inspectionResponse);
|
|
|
JSONObject inspectionObject = JSONObject.parseObject(inspectionResponse);
|
|
|
if (inspectionObject.getString("status").equalsIgnoreCase("200")) {
|
|
|
List<WlyyInspectionVO> wlyyInspectionVOList = new ArrayList<>();
|
|
|
JSONArray inspectionArray = JSONArray.parseArray(inspectionObject.getString("obj")).getJSONArray(0);
|
|
|
for (int j=0;j<inspectionArray.size();j++){
|
|
|
WlyyInspectionVO inspectionVO = new WlyyInspectionVO();
|
|
|
JSONObject inspectionJson = inspectionArray.getJSONObject(j);
|
|
|
inspectionVO.setGroupName(isEmty(inspectionJson.getString("GROUPNAME")));
|
|
|
inspectionVO.setQuantity(isEmty(inspectionJson.getString("QUANTITYS"))!=null?Integer.parseInt(isEmty(inspectionJson.getString("QUANTITYS"))):null);
|
|
|
inspectionVO.setFrequency(isEmty(inspectionJson.getString("FREQUENCYS")));
|
|
|
inspectionVO.setParentCode(isEmty(inspectionJson.getString("PARENTCODE")));
|
|
|
inspectionVO.setParentName(isEmty(inspectionJson.getString("PARENTCODENAME")));
|
|
|
inspectionVO.setCode(isEmty(inspectionJson.getString("CODES")));
|
|
|
inspectionVO.setName(isEmty(inspectionJson.getString("NAMES")));
|
|
|
inspectionVO.setInformation(isEmty(inspectionJson.getString("INFORMATION")));
|
|
|
inspectionVO.setCheckEquip(isEmty(inspectionJson.getString("CHECKEQUIP")));
|
|
|
inspectionVO.setCheckPartName(isEmty(inspectionJson.getString("CHECKPARTNAME")));
|
|
|
inspectionVO.setCheckPart(isEmty(inspectionJson.getString("CHECKPART")));
|
|
|
wlyyInspectionVOList.add(inspectionVO);
|
|
|
}
|
|
|
wlyyPrescriptionVO.setInspectionVOs(wlyyInspectionVOList);
|
|
|
}
|
|
|
prescriptionVOList.add(wlyyPrescriptionVO);
|
|
|
}
|
|
|
}
|
|
|
return prescriptionVOList;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 挂号(调his后台包)
|
|
|
* @param doctor 医生ID(必填)
|
|
|
* @param dept 科室编码(必填)
|
|
|
* @param sickId 病人id
|
|
|
* @param clinicclass 挂号类别(必填)
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject registeredOperate(String doctor,String dept,String sickId,String clinicclass,String courierflag){
|
|
|
JSONObject jsonObject= new JSONObject();
|
|
|
String response="";
|
|
|
logger.info("clinicclass:"+clinicclass);
|
|
|
logger.info("courierflag:"+courierflag);
|
|
|
String url = entranceUrl+"registered?doctor="+doctor+"&dept="+dept+"&sickId="+sickId+"&clinicclass="+clinicclass+"&courierflag="+courierflag;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object.getInteger("status")==200){
|
|
|
jsonObject = JSONObject.parseObject(object.getString("obj"));
|
|
|
}
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取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,String drugNo) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"getDrugDict?spellCode="+spellCode+"&drugNo="+drugNo;
|
|
|
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",jsonObject.getString("QUANTITY"));
|
|
|
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"));
|
|
|
DecimalFormat df =new DecimalFormat("0.00");
|
|
|
Double packSize=Double.parseDouble(jsonObject.get("PACK_SPEC").toString().equals("[]")?"1":jsonObject.getString("PACK_SPEC"));
|
|
|
Double retprice=Double.parseDouble(jsonObject.get("RETAIL_PRICE").toString().equals("[]")?"0":jsonObject.getString("RETAIL_PRICE"));
|
|
|
Double miniUnitPrice=0.00;
|
|
|
if (0.00!=packSize){
|
|
|
miniUnitPrice=retprice/packSize;
|
|
|
}
|
|
|
object1.put("mini_unit_price",df.format(miniUnitPrice));
|
|
|
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("ApplyDept",wlyyOutpatientDO.getDept());
|
|
|
params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
|
|
|
}
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
|
|
|
if (null!=doctorMappingDO){
|
|
|
params.put("ApplyDoctor",doctorMappingDO.getDoctorName()+"/"+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 String saveEmrToEntrance(String prescriptionId,String baseSign) 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());
|
|
|
}
|
|
|
//获取医生编号
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(wlyyOutpatientDO.getDoctor());
|
|
|
String operatorId = null;
|
|
|
if (doctorDO!=null){
|
|
|
String url = entranceUrl+"selectDoctorInfo?idCard="+doctorDO.getIdcard();
|
|
|
String 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);
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
JSONObject jsonObject = array.getJSONObject(0);
|
|
|
operatorId = jsonObject.getString("staffNo");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(null!=doctorMappingDO){
|
|
|
paramRequest.put("operatorid",operatorId);
|
|
|
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.getDeptName());
|
|
|
paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
|
|
|
paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
|
|
|
}
|
|
|
paramRequest.put("templateid","1158");
|
|
|
paramRequest.put("catalogid","50");
|
|
|
paramRequest.put("emrtype","93");
|
|
|
paramRequest.put("emrtitle","互联网医院");
|
|
|
|
|
|
if (StringUtils.isNoneBlank(baseSign)){
|
|
|
//UploadVO uploadVO=fileUploadService.uploadImagesBase64(baseSign,fastdfs_file_url);
|
|
|
//paramRequest.put("baseSign","https://ih.xmheart.com/fastdfs/"+uploadVO.getFullUri());
|
|
|
paramRequest.put("baseSign",baseSign);
|
|
|
}
|
|
|
}
|
|
|
params.put("jsonInfo",paramRequest.toJSONString());
|
|
|
String response = "";
|
|
|
String url = entranceUrl+"returnEmrHtmlByHLW";
|
|
|
|
|
|
logger.info("params"+params.toString());
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("保存电子病历"+response);
|
|
|
if (response.contains("error")||response.contains("ERROR")){
|
|
|
return "faild";
|
|
|
}else {
|
|
|
return "success";
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 获取历史病历
|
|
|
* @param patientId 病人id
|
|
|
* @param eventNo 病人住院号
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyPrescriptionEmrDO> selectHistoryEmr(String patientId,String eventNo) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"selectEmrInfo?patientId="+patientId+"&eventNo="+eventNo;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
List<WlyyPrescriptionEmrDO> wlyyPrescriptionEmrDOList = new ArrayList<>();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
if("[[]]".equalsIgnoreCase(obj)||"[]".equalsIgnoreCase(obj)||StringUtils.isBlank(obj)){
|
|
|
return null;
|
|
|
}else {
|
|
|
logger.info("obj:" + obj);
|
|
|
JSONArray array = JSONArray.parseArray(obj.replace("[]", "\"\"")).getJSONArray(0);
|
|
|
logger.info("arrayResponse:" + array.toJSONString());
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
logger.info("jsonObject:" + jsonObject);
|
|
|
WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
|
|
|
wlyyPrescriptionEmrDO.setComplaint(null == jsonObject.get("CHIEF_COMPLAINT") ? "" : jsonObject.get("CHIEF_COMPLAINT").toString());
|
|
|
wlyyPrescriptionEmrDO.setMedicalHistory(null == jsonObject.get("PRESENT_ILLNESS") ? "" : jsonObject.get("PRESENT_ILLNESS").toString());
|
|
|
wlyyPrescriptionEmrDO.setPastHistory(null == jsonObject.get("PAST_HISTORY") ? "" : jsonObject.get("PAST_HISTORY").toString());
|
|
|
wlyyPrescriptionEmrDO.setPhysicalExamination(null == jsonObject.get("PHYSICAL_EXAMINATION") ? "" : jsonObject.get("PHYSICAL_EXAMINATION").toString());
|
|
|
wlyyPrescriptionEmrDO.setAssistExamination(null == jsonObject.get("OBSERVE_RESULT") ? "" : jsonObject.get("OBSERVE_RESULT").toString());
|
|
|
wlyyPrescriptionEmrDO.setAllergicHistory(null == jsonObject.get("ALLERGY_HISTORY") ? "" : jsonObject.get("ALLERGY_HISTORY").toString());
|
|
|
wlyyPrescriptionEmrDO.setPopularHistory(null == jsonObject.get("EPIDEMIOLOGICAL") ? "" : jsonObject.get("EPIDEMIOLOGICAL").toString());
|
|
|
wlyyPrescriptionEmrDO.setSpecialHistory(null == jsonObject.get("SPECIAL_HISTORY") ? "" : jsonObject.get("SPECIAL_HISTORY").toString());
|
|
|
wlyyPrescriptionEmrDOList.add(wlyyPrescriptionEmrDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return wlyyPrescriptionEmrDOList;
|
|
|
}
|
|
|
/**
|
|
|
* 查询历次就诊门诊病历文书
|
|
|
* @param templateId
|
|
|
* @param patientId 病人id
|
|
|
* @param eventNo 病人住院号
|
|
|
* @return
|
|
|
*/
|
|
|
public String selectHistoryEmrRecord(String templateId,String patientId,String eventNo) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"selectEmrDispRecord?templateId="+templateId+"&patientId="+patientId+"&eventNo="+eventNo;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
return obj;
|
|
|
}else {
|
|
|
return "获取失败";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JSONArray selectHistoryEmrFromEntrance(String patientId,String eventNo) throws Exception {
|
|
|
String response="";
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
PatientMappingDO mappingDO = patientMappingDao.findByPatient(patientId);
|
|
|
String patient = null;
|
|
|
if (mappingDO!=null){
|
|
|
patient = mappingDO.getMappingCode();
|
|
|
}
|
|
|
String url = entranceUrl+"selectEmrInfo?patientId="+patient+"&eventNo="+eventNo;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
List<WlyyPrescriptionEmrDO> wlyyPrescriptionEmrDOList = new ArrayList<>();
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
if("[[]]".equalsIgnoreCase(obj)||"[]".equalsIgnoreCase(obj)||StringUtils.isBlank(obj)){
|
|
|
return null;
|
|
|
}else {
|
|
|
logger.info("obj:"+obj);
|
|
|
JSONArray array = JSONArray.parseArray(obj.replace("[]","\"\"")).getJSONArray(0);
|
|
|
logger.info("arrayResponse:"+array.toJSONString());
|
|
|
for (int j=0;j<array.size();j++){
|
|
|
JSONObject object1 = array.getJSONObject(j);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("DEPT_NAME",object1.getString("DEPT_NAME"));
|
|
|
jsonObject.put("TREAT_DATE_TIME",DateUtil.getYyyymmddhhmmss(DateUtil.strToDateLong(object1.getString("VISIT_TIME"))));
|
|
|
jsonObject.put("OPID",object1.getString("EMR_ID"));
|
|
|
String firstFlag = object1.getString("FIRST_FLAG");
|
|
|
if (firstFlag.equalsIgnoreCase("复诊")){
|
|
|
jsonObject.put("TREAT_DOCTOR_NAME",object1.getString("RETURN_DOC_SIGN"));
|
|
|
}else if (firstFlag.equalsIgnoreCase("初诊")){
|
|
|
jsonObject.put("TREAT_DOCTOR_NAME",object1.getString("DOCTOR_SIGNATURE"));
|
|
|
}
|
|
|
jsonArray.add(jsonObject);
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询病历文书html信息
|
|
|
* @param bstrEmrID
|
|
|
* @return
|
|
|
*/
|
|
|
public String selectBrowseSingleEMR(String bstrEmrID) throws Exception {
|
|
|
String response="";
|
|
|
String url = entranceUrl+"browseSingleEMR?bstrEmrID="+bstrEmrID;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
return obj;
|
|
|
}else {
|
|
|
return "获取失败";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//=====================hospital应用调用entrance应用============end=================
|
|
|
|
|
|
|
|
|
//============================hospital业务层==================start====================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询单条门诊记录
|
|
|
* @param patient
|
|
|
* @param conNo
|
|
|
* @return
|
|
|
*/
|
|
|
public WlyyOutpatientVO findOutpatientData(String patient, String conNo)throws Exception{
|
|
|
logger.info("findOutpatientList patient:"+patient);
|
|
|
String patNo =findHisPatNoByPatient(patient);
|
|
|
if(StringUtils.isBlank(patNo)){
|
|
|
return null;
|
|
|
}
|
|
|
logger.info("findOutpatientList patNo:"+patNo);
|
|
|
WlyyOutpatientVO outpatientVO=selectOutpatientInfo(patNo,conNo);
|
|
|
|
|
|
if(outpatientVO!=null){
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
outpatientVO.setSex(patientDO.getSex()+"");
|
|
|
outpatientVO.setBirthday(patientDO.getBirthday());
|
|
|
return outpatientVO;
|
|
|
}
|
|
|
return outpatientVO;
|
|
|
}
|
|
|
|
|
|
public String isEmty(String str){
|
|
|
if (str.equalsIgnoreCase("[]")){
|
|
|
return null;
|
|
|
}else {
|
|
|
return str;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取his居民id
|
|
|
* @param patient
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String findHisPatNoByPatient(String patient)throws Exception{
|
|
|
logger.info("findHisPatNoByPatient:"+patient);
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
logger.info("patientDO:"+patientDO.toString());
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
if(patientMappingDO!=null){
|
|
|
return patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
String patientId = "";
|
|
|
JSONArray rs = selectPateintCard(patient);
|
|
|
if (rs!=null&&rs.size()!=0){
|
|
|
JSONObject object = rs.getJSONObject(0);
|
|
|
patientId = object.getString("SICKID");
|
|
|
}
|
|
|
return patientId;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* @param registerSn 流水号
|
|
|
* @param patient 居民code
|
|
|
* @param admNo 住院唯一号
|
|
|
* @param realOrder 处方号
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyPrescriptionVO> findPrescriptionList(String outPatientId,String realOrder) throws Exception {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId);
|
|
|
if (outpatientDO==null){
|
|
|
throw new Exception("该门诊记录不存在!");
|
|
|
}
|
|
|
String registerSn = outpatientDO.getRegisterNo();
|
|
|
if (!StringUtils.isNoneBlank(registerSn)){
|
|
|
throw new Exception("挂号流水号不存在");
|
|
|
}
|
|
|
String admNo = outpatientDO.getAdmNo();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
|
|
|
if (patientMappingDO==null||!StringUtils.isNoneBlank(patientMappingDO.getMappingCode())){
|
|
|
throw new Exception("该居民映射表不存在!");
|
|
|
}
|
|
|
|
|
|
List<WlyyPrescriptionVO> wlyyPrescriptionVOList = selectOriginPrescriptionList(registerSn,patientMappingDO.getMappingCode(),admNo,realOrder);
|
|
|
|
|
|
return wlyyPrescriptionVOList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<WlyyPrescriptionVO> selectPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patNo);
|
|
|
if (patientMappingDO==null||!StringUtils.isNoneBlank(patientMappingDO.getMappingCode())){
|
|
|
throw new Exception("该居民映射表不存在!");
|
|
|
}
|
|
|
|
|
|
List<WlyyPrescriptionVO> wlyyPrescriptionVOList = selectOriginPrescriptionList(registerSn,patientMappingDO.getMappingCode(),admNo,realOrder);
|
|
|
|
|
|
return wlyyPrescriptionVOList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
if (status.equalsIgnoreCase("1")){
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
|
|
|
if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
|
|
|
throw new Exception("该就诊号查不到!");
|
|
|
}
|
|
|
for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
|
|
|
String registerNo = wlyyOutpatientDO.getRegisterNo();
|
|
|
if (!StringUtils.isNoneBlank(registerNo)){
|
|
|
throw new Exception("挂号流水号为空!");
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutpatientId(wlyyOutpatientDO.getId());
|
|
|
if (prescriptionDOList==null||prescriptionDOList.size()==0){
|
|
|
List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
|
|
|
for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
|
|
|
WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
|
|
|
prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
|
|
|
if (status.equalsIgnoreCase("3")){
|
|
|
prescriptionDO.setStatus(30);
|
|
|
}
|
|
|
prescriptionDO= prescriptionDao.save(prescriptionDO);
|
|
|
//处方诊断表vo
|
|
|
List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
|
|
|
for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
|
|
|
WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
|
|
|
prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
diagnosisDao.save(prescriptionDiagnosisDO);
|
|
|
}
|
|
|
//药品表
|
|
|
List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
|
|
|
for (WlyyPrescriptionInfoVO infoVO:infoVOList){
|
|
|
WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
|
|
|
infoDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
prescriptionInfoDao.save(infoDO);
|
|
|
}
|
|
|
|
|
|
List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
|
|
|
for (WlyyInspectionVO inspectionVO:inspectionVOList){
|
|
|
WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
|
|
|
BeanUtils.copyProperties(inspectionVO,inspectionDO);
|
|
|
inspectionDO.setPrescriptionId(prescriptionDO.getId());
|
|
|
wlyyInspectionDao.save(inspectionDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else if (status.equalsIgnoreCase("2")){
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
|
|
|
wlyyPrescriptionDO.setStatus(-1);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
//检查
|
|
|
List<WlyyInspectionDO> wlyyInspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyInspectionDO inspectionDO:wlyyInspectionDOS){
|
|
|
inspectionDO.setDel(0);
|
|
|
wlyyInspectionDao.save(inspectionDO);
|
|
|
}
|
|
|
//药品
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS=prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOS){
|
|
|
prescriptionInfoDO.setDel(0);
|
|
|
prescriptionInfoDao.save(prescriptionInfoDO);
|
|
|
}
|
|
|
//诊断
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
|
|
|
diagnosisDO.setDel(0);
|
|
|
prescriptionDiagnosisDao.save(diagnosisDO);
|
|
|
}
|
|
|
}
|
|
|
}else if (status.equalsIgnoreCase("3")){
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
|
|
|
wlyyPrescriptionDO.setStatus(30);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}else if (status.equalsIgnoreCase("4")){
|
|
|
List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
|
|
|
wlyyPrescriptionDO.setStatus(100);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}
|
|
|
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());
|
|
|
if (null!=basePatientDO.getSex()){
|
|
|
jsonObject.put("GENDER", 1==basePatientDO.getSex()?"男":"女");
|
|
|
}else{
|
|
|
jsonObject.put("GENDER", "男");
|
|
|
}
|
|
|
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;
|
|
|
}
|
|
|
/**
|
|
|
* 发送短信验证码
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Integer SendSmsToEntrance(String json) throws Exception {
|
|
|
int result = 0;
|
|
|
String response="";
|
|
|
String url = entranceUrl+"SendSms";
|
|
|
Map<String,String> map = new HashedMap();
|
|
|
map.put("json",json);
|
|
|
response = httpClientUtil.httpPost(url,map);
|
|
|
logger.info("返回参数:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if(object.getInteger("status")==200){
|
|
|
JSONArray jsonArray= JSONArray.parseArray(object.getString("obj"));
|
|
|
if (jsonArray!=null&&jsonArray.size()!=0){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
if (jsonObject.getString("code").equalsIgnoreCase("10000")){
|
|
|
result=0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================hospital业务层==================start====================
|
|
|
|
|
|
//===========================entrance访问hospital============start=======================
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param admNo
|
|
|
* @param realOrder
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getSFExpressInfoToHospital(String admNo, String realOrder) throws Exception {
|
|
|
String response="";
|
|
|
String url = hospitalUrl+"open/noLogin/getSFExpressInfoNew";
|
|
|
Map<String,String> map = new HashedMap();
|
|
|
map.put("admNo",admNo);
|
|
|
map.put("realOrder",realOrder);
|
|
|
logger.info("jsonobject"+map.toString());
|
|
|
response = httpClientUtil.httpPost(url,map);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
JSONObject jsonObject1 = new JSONObject();
|
|
|
logger.info("object"+object.toJSONString());
|
|
|
if(object.getInteger("status")==200){
|
|
|
String obj = object.getString("obj");
|
|
|
object = JSONObject.parseObject(obj);
|
|
|
jsonObject1.put("mailNo",object.getString("mailNo"));
|
|
|
}
|
|
|
return jsonObject1;
|
|
|
|
|
|
}
|
|
|
//===========================entrance访问hospital============end=======================
|
|
|
|
|
|
}
|