|
@ -26,6 +26,7 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.*;
|
|
|
import com.yihu.jw.oauth.OauthRsaKeyDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
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.encrypt.MD5;
|
|
@ -33,11 +34,11 @@ import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.util.network.HttpResponse;
|
|
|
import com.yihu.jw.util.network.HttpUtils;
|
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
|
import com.yihu.jw.utils.WritebackCvalueInterfaceLocator;
|
|
|
import com.yihu.jw.utils.dsyyUtil.SendMessge_ServiceLocator;
|
|
|
import com.yihu.jw.utils.dsyyUtil.WritebackCvalueInterfaceLocator;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
import okhttp3.*;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -240,8 +241,8 @@ public class DsyyEntranceService {
|
|
|
}
|
|
|
|
|
|
//==========================调用his视图===============
|
|
|
private final static String url="http://192.168.101.2:10023/ykyy/createSQLQuery";
|
|
|
private final static String orgCode ="dsyy";
|
|
|
private final static String url="http://192.168.101.2:10023/dsyy/createSQLQuery";
|
|
|
private final static String orgCode ="350211A1004";
|
|
|
|
|
|
/**
|
|
|
* 同步科室信息
|
|
@ -437,6 +438,461 @@ public class DsyyEntranceService {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
public String isEmty(String str){
|
|
|
if (str.equalsIgnoreCase("[]")){
|
|
|
return null;
|
|
|
}else {
|
|
|
return str;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取门诊就诊记录列表
|
|
|
* @param patient 居民id
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyOutpatientVO> selectOutpatientList(String patient, String startTime, String endTime,String ksdm, String cardNo) throws Exception {
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
|
|
|
JSONArray array = new JSONArray();
|
|
|
patient = updatePatientMapping(patient,cardNo);
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tadmNo AS \"ADMNO\",\n" +
|
|
|
"\toriginAdmNo AS \"ORIGINADMNO\",\n" +
|
|
|
"\tregisterNo AS \"REGISTERNO\",\n" +
|
|
|
"\toriginRegisterNo AS \"ORIGINREGISTERNO\",\n" +
|
|
|
"\toriginConNo as \"ORIGINCONNO\",\n" +
|
|
|
"\tdept as \"DEPT\",\n" +
|
|
|
"\tDEPTNAME as \"DEPTNAME\",\n" +
|
|
|
" PATIENT as \"PATIENT\",\n" +
|
|
|
"\tPATIENTNAME as \"PATIENTNAME\",\n" +
|
|
|
"\tDOCTOR as \"DOCTOR\",\n" +
|
|
|
"\tDOCTORNAME as \"DOCTORNAME\",\n" +
|
|
|
"\tIDCARD as \"IDCARD\",\n" +
|
|
|
"\tMJZ as \"MJZ\",\n" +
|
|
|
"\tICDCODE as \"ICDCODE\",\n" +
|
|
|
"\tICDNAME as \"ICDNAME\",\n" +
|
|
|
"\tADMDATE as \"ADMDATE\",\n" +
|
|
|
"\tCONDATE as \"CONDATE\",\n" +
|
|
|
"\tDESCRIPTION as \"DESCRIPTION\",\n" +
|
|
|
"\tDISEASEIMG as \"DISEASEIMG\",\n" +
|
|
|
"\tCREATETIME as \"CREATETIME\",\n" +
|
|
|
"\tSTATUS as \"STATUS\",\n" +
|
|
|
"\tVISITNUM as \"VISITNUM\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tv_internet_dispensary_cure where 1=1 ";
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and CREATETIME >= to_date('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
sql +=" and CREATETIME <= to_date('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patient)){
|
|
|
sql +=" and PATIENT ='"+patient+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(ksdm)){
|
|
|
sql += " and dept ='"+ksdm+"' ";
|
|
|
}
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("获取就诊记录列表:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
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) throws Exception {
|
|
|
WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
|
|
|
JSONArray array = new JSONArray();
|
|
|
BasePatientDO patientDO = patientDao.findById(patient).orElse(null);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
if (patientMappingDO!=null){
|
|
|
patient = patientMappingDO.getMappingCode();
|
|
|
}else {
|
|
|
patient = savePatientMapping(patient);
|
|
|
}
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tadmNo AS \"ADMNO\",\n" +
|
|
|
"\toriginAdmNo AS \"ORIGINADMNO\",\n" +
|
|
|
"\tregisterNo AS \"REGISTERNO\",\n" +
|
|
|
"\toriginRegisterNo AS \"ORIGINREGISTERNO\",\n" +
|
|
|
"\toriginConNo as \"ORIGINCONNO\",\n" +
|
|
|
"\tdept as \"DEPT\",\n" +
|
|
|
"\tDEPTNAME as \"DEPTNAME\",\n" +
|
|
|
" PATIENT as \"PATIENT\",\n" +
|
|
|
"\tPATIENTNAME as \"PATIENTNAME\",\n" +
|
|
|
"\tDOCTOR as \"DOCTOR\",\n" +
|
|
|
"\tDOCTORNAME as \"DOCTORNAME\",\n" +
|
|
|
"\tIDCARD as \"IDCARD\",\n" +
|
|
|
"\tMJZ as \"MJZ\",\n" +
|
|
|
"\tICDCODE as \"ICDCODE\",\n" +
|
|
|
"\tICDNAME as \"ICDNAME\",\n" +
|
|
|
"\tADMDATE as \"ADMDATE\",\n" +
|
|
|
"\tCONDATE as \"CONDATE\",\n" +
|
|
|
"\tDESCRIPTION as \"DESCRIPTION\",\n" +
|
|
|
"\tDISEASEIMG as \"DISEASEIMG\",\n" +
|
|
|
"\tCREATETIME as \"CREATETIME\",\n" +
|
|
|
"\tSTATUS as \"STATUS\",\n" +
|
|
|
"\tVISITNUM as \"VISITNUM\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tv_internet_dispensary_cure where 1=1 ";
|
|
|
if (StringUtils.isNoneBlank(patient)){
|
|
|
sql +=" and PATIENT ='"+patient+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(conNo)){
|
|
|
sql += " and conNo ='"+conNo+"' ";
|
|
|
}
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("获取单个就诊记录:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
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("350211A1004");
|
|
|
outpatientVO.setSex(patientDO.getSex() + "");
|
|
|
outpatientVO.setPatient(patientDO.getId());
|
|
|
outpatientVO.setBirthday(patientDO.getBirthday());
|
|
|
}
|
|
|
}
|
|
|
return outpatientVO;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 更新患者hisid
|
|
|
* @param patient
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String updatePatientMapping(String patient,String cardNo) throws Exception {
|
|
|
BasePatientDO patientDO = patientDao.findById(patient).orElse(null);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
JSONArray array =findCardNo(patientDO.getIdcard());
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
logger.info("判断卡号是否相同:"+object.getString("CARD_NO")+"cardNo:"+cardNo);
|
|
|
if (object.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(object.getString("SICK_ID"));
|
|
|
}else {
|
|
|
patientMappingDO.setMappingCode(object.getString("SICK_ID"));
|
|
|
}
|
|
|
patientMappingDO = patientMappingDao.save(patientMappingDO);
|
|
|
}
|
|
|
}
|
|
|
return patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取处方主表
|
|
|
*
|
|
|
*
|
|
|
* @param
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
|
|
|
String sql ="SELECT\n" +
|
|
|
"\tREALORDER as \"REALORDER\",\n" +
|
|
|
" ORIGINREALORDER as \"ORIGINREALORDER\",\n" +
|
|
|
"\tADMNO as \"ADMNO\",\n" +
|
|
|
"\tORIGINADMNO as \"ORIGINADMNO\",\n" +
|
|
|
"\tSERIALNO as \"SERIALNO\",\n" +
|
|
|
"\tORIGINSERIALNO as \"ORIGINSERIALNO\",\n" +
|
|
|
"\tTYPE as \"TYPE\",\n" +
|
|
|
"\tPATIENTCODE as \"PATIENTCODE\",\n" +
|
|
|
"\tPATEINTNAME as \"PATEINTNAME\",\n" +
|
|
|
"\tIDCARD as \"IDCARD\",\n" +
|
|
|
"\tCARDNO as \"CARDNO\",\n" +
|
|
|
"\tSSC as \"SSC\",\n" +
|
|
|
"\tDOCTOR as \"DOCTOR\",\n" +
|
|
|
"\tDOCTORNAME as \"DOCTORNAME\",\n" +
|
|
|
"\tSTATUS as \"STATUS\",\n" +
|
|
|
"\tPRESCRIBETIME as \"PRESCRIBETIME\",\n" +
|
|
|
"\tPRESCRIBEREASON as \"PRESCRIBEREASON\",\n" +
|
|
|
"\tPAYTIME as \"PAYTIME\",\n" +
|
|
|
"\tDOSAGETIME as \"DOSAGETIME\",\n" +
|
|
|
" FINISHTIME as \"FINISHTIME\", \n" +
|
|
|
"\tCREATETIME AS \"CREATETIME\",\n" +
|
|
|
"\tDEPT as \"DEPT\",\n" +
|
|
|
"\tDEPTNAME as \"DEPTNAME\",\n" +
|
|
|
"\tHOSPITAL as \"HOSPITAL\",\n" +
|
|
|
"\tHOSPITALNAME as \"HOSPITALNAME\",\n" +
|
|
|
"\tDISPENSARYTYPE as \"DISPENSARYTYPE\",\n" +
|
|
|
"\tDISEASEIMG as \"DISEASEIMG\",\n" +
|
|
|
"\tREMARK as \"REMARK\",\n" +
|
|
|
"\tCANCELREASON as \"CANCELREASON\",\n" +
|
|
|
"\tCACERTDATA as \"CACERTDATA\",\n" +
|
|
|
"\tCAMESSAGE as \"CAMESSAGE\",\n" +
|
|
|
"\tDIGITALSIGNNO as \"DIGITALSIGNNO\",\n" +
|
|
|
"\tORIGINALDATAABSTRACT as \"ORIGINALDATAABSTRACT\",\n" +
|
|
|
"\tSTRORIGINALDATA as \"STRORIGINALDATA\",\n" +
|
|
|
"\tHISDEPTCODE as \"HISDEPTCODE\",\n" +
|
|
|
"\tHISDOCTORCODE as \"HISDOCTORCODE\",\n" +
|
|
|
"\tHISGISTERTYPECODE as \"HISGISTERTYPECODE\",\n" +
|
|
|
"\tHISRATETYPECODE as \"HISRATETYPECODE\",\n" +
|
|
|
"\tHISHOSPITAL as \"HISHOSPITAL\",\n" +
|
|
|
"\tHISREGISTERFEE as \"HISREGISTERFEE\",\n" +
|
|
|
"\tPAYSTATUS as \"PAYSTATUS\",\n" +
|
|
|
" DISPUSER as \"DISPUSER\",\n" +
|
|
|
"\tDISPUSERNAME as \"DISPUSERNAME\",\n" +
|
|
|
"\tDISPDATE as \"DISPDATE\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tv_internet_prescrip_master where 1=1 ";
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (StringUtils.isNoneBlank(registerSn)){
|
|
|
sql +=" and REGISTERNO = '"+registerSn+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and patient = '"+patNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and admNo = '"+admNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(realOrder)){
|
|
|
sql+=" and realOrder ='"+realOrder+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and CREATETIME >= to_date('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
sql +=" and CREATETIME <= to_date('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("cardNo:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊诊断
|
|
|
*
|
|
|
*
|
|
|
* @param
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getOutpatientDiagnosis(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
|
|
|
String sql ="SELECT\n" +
|
|
|
"\tREALORDER as \"REALORDER\",\n" +
|
|
|
"\tCODE AS \"CODE\",\n" +
|
|
|
"\tNAME AS \"NAME\",\n" +
|
|
|
"\tTYPE AS \"TYPE\",\n" +
|
|
|
"\tcreateTime AS \"CREATETIME\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tv_internet_sick_diagnosis_info where 1=1 ";
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (StringUtils.isNoneBlank(registerSn)){
|
|
|
sql +=" and REGISTERNO = '"+registerSn+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and patient = '"+patNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and admNo = '"+admNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(realOrder)){
|
|
|
sql+=" and realOrder ='"+realOrder+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and CREATETIME >= to_date('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
sql +=" and CREATETIME <= to_date('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("cardNo:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取门诊处方药品
|
|
|
*
|
|
|
*
|
|
|
* @param
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getOutpatientDrugInfo(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
|
|
|
String sql ="SELECT\n" +
|
|
|
"\tREALORDER as \"REALORDER\",\n" +
|
|
|
"\tDRUGNO AS \"DRUGNO\",\n" +
|
|
|
"\tDRUGNAME AS \"DRUGNAME\",\n" +
|
|
|
"\tDISPDEPOSITE AS \"DISPDEPOSITE\",\n" +
|
|
|
"\tDOSAGE AS \"DOSAGE\",\n" +
|
|
|
" QUANTITY as \"QUANTITY\",\n" +
|
|
|
"\tDRUGNO AS \"UNIT\",\n" +
|
|
|
"\tDRUGNAME AS \"UNITNAME\",\n" +
|
|
|
"\tDISPDEPOSITE AS \"PACKUNITNAME\",\n" +
|
|
|
"\tDOSAGE AS \"PACKUNIT\",\n" +
|
|
|
"\tUSAGECODE as \"USAGECODE\",\n" +
|
|
|
"\tUSAGENAME as \"USAGENAME\",\n" +
|
|
|
"\tSUPPLYCODE as \"SUPPLYCODE\",\n" +
|
|
|
"\tSUPPLYNAME as \"SUPPLYNAME\",\n" +
|
|
|
"\tDAYS as \"DAYS\",\n" +
|
|
|
"\tFREQUENCY as \"FREQUENCY\",\n" +
|
|
|
"\tSERIAL as \"SERIAL\",\n" +
|
|
|
"\tSPECIFICATION as \"SPECIFICATION\",\n" +
|
|
|
"\tPACKRETPRICE as \"PACKRETPRICE\",\n" +
|
|
|
"\tHERBALCOUNT as \"HERBALCOUNT\",\n" +
|
|
|
"\tPOSTCOUNT as \"POSTCOUNT\",\n" +
|
|
|
"\tDEL as \"DEL\",\n" +
|
|
|
"\tCOMM as \"COMM\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tv_internet_prescrip_detail where 1=1 ";
|
|
|
JSONArray array = new JSONArray();
|
|
|
if (StringUtils.isNoneBlank(registerSn)){
|
|
|
sql +=" and REGISTERNO = '"+registerSn+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and patient = '"+patNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patNo)){
|
|
|
sql +=" and admNo = '"+admNo+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(realOrder)){
|
|
|
sql+=" and realOrder ='"+realOrder+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and CREATETIME >= to_date('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
sql +=" and CREATETIME <= to_date('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ";
|
|
|
}
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("cardNo:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存患者hisid
|
|
|
* @param patient
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String savePatientMapping(String patient) throws Exception {
|
|
|
BasePatientDO patientDO = patientDao.findById(patient).orElse(null);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
JSONArray array =findCardNo(patientDO.getIdcard());
|
|
|
if (array.size()!=0&array.size()>=1){
|
|
|
JSONObject object = 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(object.getString("SICK_ID"));
|
|
|
}else {
|
|
|
patientMappingDO.setMappingCode(object.getString("SICK_ID"));
|
|
|
}
|
|
|
patientMappingDO = patientMappingDao.save(patientMappingDO);
|
|
|
|
|
|
}
|
|
|
return patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取患者卡列表
|
|
|
*
|
|
@ -1017,31 +1473,38 @@ public class DsyyEntranceService {
|
|
|
//========================集成平台调用开始===========================
|
|
|
|
|
|
/**
|
|
|
* 发送退号信息到his
|
|
|
* OAuth认证请求接口
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void authorize()throws Exception{
|
|
|
test1();
|
|
|
// test();
|
|
|
/* String api = "authorize";
|
|
|
String msgHeader ="";
|
|
|
String condition ="<![CDATA[{\"clientId\":\"12222222\",\"responseType\":\"code\"}]]>";
|
|
|
// String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
String msgBody = "<authorize><pinput>"+condition+"</pinput></authorize>";
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("Header",msgHeader);
|
|
|
params.put("Body",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("authorize params:"+params.toString());
|
|
|
String xml = getDsyyJhWebServiceInfo(api,params,getJhServiceUrl());
|
|
|
public String authorize()throws Exception{
|
|
|
String condition ="{\"clientId\":\"2019111513540975\",\"responseType\":\"code\"}";
|
|
|
WritebackCvalueInterfaceLocator locator = new WritebackCvalueInterfaceLocator();
|
|
|
String returnStr = locator.getWritebackCvalueInterfaceSoap().authorize(condition);
|
|
|
return returnStr;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* OAuth登陆-获取用户信息
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String tokeninfo(String requestId)throws Exception{
|
|
|
String condition ="{\"clientId\":\"2019111513540975\",\"requestId\":\""+requestId+"\"}";
|
|
|
WritebackCvalueInterfaceLocator locator = new WritebackCvalueInterfaceLocator();
|
|
|
String returnStr = locator.getWritebackCvalueInterfaceSoap().tokeninfo(condition);
|
|
|
return returnStr;
|
|
|
}
|
|
|
|
|
|
public String sendMessage(String strDllModel,String strPhoneNO,String strMsgContent)throws Exception{
|
|
|
SendMessge_ServiceLocator locator = new SendMessge_ServiceLocator();
|
|
|
String returnStr = locator.getSendMessgeSoap().sendMessge(strDllModel,strPhoneNO,strMsgContent);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("authorize json:"+json);*/
|
|
|
/* return json;*/
|
|
|
String json = xmlSerializer.read(returnStr).toString();
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void test1(){
|
|
|
try {
|
|
|
String condition ="{\"clientId\":\"2019111513540975\",\"responseType\":\"code\"}";
|
|
@ -1053,93 +1516,6 @@ public class DsyyEntranceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void test(){
|
|
|
try {
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
.build();
|
|
|
MediaType mediaType = MediaType.parse("Content-Type");
|
|
|
RequestBody body = RequestBody.create(mediaType, "<soapenv:Envelope " +
|
|
|
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
|
|
|
" xmlns:good=\"http://goodwillcis.com\"> " +
|
|
|
" <soapenv:Header/> <soapenv:Body> " +
|
|
|
" <good:authorize> " +
|
|
|
"<good:pInput><![CDATA[{\"clientId\":\"12222222\",\"responseType\":\"code\"}]]></good:pInput> " +
|
|
|
" </good:authorize> " +
|
|
|
" </soapenv:Body> </soapenv:Envelope>");
|
|
|
Request request = new Request.Builder()
|
|
|
.url("http://10.95.8.41:80/csp/jhip/JHIP.BJCA.BS.BJCAServicesBS.cls")
|
|
|
.method("POST", body)
|
|
|
.addHeader("Content-Type", "Content-Type")
|
|
|
.addHeader("SOAPAction", "\"#authorize\"")
|
|
|
.build();
|
|
|
Response response = client.newCall(request).execute();
|
|
|
System.out.println("==============================="+response.code());
|
|
|
System.out.println("==============================="+response.body().string());
|
|
|
System.out.println("==============================="+response.message());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//发送短信
|
|
|
public String SendMessage(String strDllModel,String strPhoneNO,String strMsgContent) throws Exception {
|
|
|
String api = "SendMessage";
|
|
|
String msgHeader ="";
|
|
|
String condition ="<![CDATA[{\"strDllModel\":\"\",\"strPhoneNO\":\"13559485270\",\"strMsgContent\":\"测试短信\"}]]>";
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
params.put("Header",msgHeader);
|
|
|
params.put("strDllModel",strDllModel);
|
|
|
params.put("strPhoneNO",strPhoneNO);
|
|
|
params.put("strMsgContent",strMsgContent);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info("SendMessage params:"+params.toString());
|
|
|
List<WlyyHospitalSysDictDO> distList = wlyyHospitalSysDictDao.findByDictName("DX_SMS_SERVICE");
|
|
|
Map<String,String> dictMap = distList.stream().collect(Collectors.toMap(WlyyHospitalSysDictDO::getDictCode,WlyyHospitalSysDictDO::getDictValue));
|
|
|
String msgUrl = dictMap.get("SMS_SERVICE_URL");
|
|
|
String soapaction = dictMap.get("SMS_SERVICE_SOAPACTION");
|
|
|
String xml = getDsyyJhWebServiceInfo(api,params,msgUrl);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
logger.info("SendMessage json:"+json);
|
|
|
return json;
|
|
|
/* String operationName = "SendMessage";// 调用方法名
|
|
|
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
|
|
|
String response = "";
|
|
|
if (StringUtils.isBlank(strDllModel)){
|
|
|
strDllModel="";
|
|
|
}
|
|
|
List<WlyyHospitalSysDictDO> distList = wlyyHospitalSysDictDao.findByDictName("DX_SMS_SERVICE");
|
|
|
Map<String,String> dictMap = distList.stream().collect(Collectors.toMap(WlyyHospitalSysDictDO::getDictCode,WlyyHospitalSysDictDO::getDictValue));
|
|
|
String msgUrl = dictMap.get("SMS_SERVICE_URL");
|
|
|
String soapaction = dictMap.get("SMS_SERVICE_SOAPACTION");
|
|
|
Object[] obj = new Object[]{};
|
|
|
try {
|
|
|
Call call = (Call) service.createCall();
|
|
|
call.setTargetEndpointAddress(msgUrl);
|
|
|
call.setOperationName(new QName(soapaction, operationName)); // 设置要调用哪个方法
|
|
|
call.addParameter(new QName(soapaction, "strDllModel"), // 设置要传递的参数
|
|
|
org.apache.axis.encoding.XMLType.XSD_STRING,
|
|
|
javax.xml.rpc.ParameterMode.IN);
|
|
|
call.addParameter(new QName(soapaction, "strPhoneNO"),
|
|
|
org.apache.axis.encoding.XMLType.XSD_STRING,
|
|
|
javax.xml.rpc.ParameterMode.IN);
|
|
|
call.addParameter(new QName(soapaction, "strMsgContent"),
|
|
|
org.apache.axis.encoding.XMLType.XSD_STRING,
|
|
|
javax.xml.rpc.ParameterMode.IN);
|
|
|
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);// (标准的类型)
|
|
|
call.setUseSOAPAction(true);
|
|
|
call.setSOAPActionURI(soapaction +"/"+ "JHIP.SMS.BS.SendMessge");
|
|
|
// obj = new Object[]{strMoID, strMobiles, strContent, strApiCode, NAME, PWD, strSender};
|
|
|
obj = new Object[]{strDllModel, strPhoneNO, strMsgContent};
|
|
|
response = (String) call.invoke(obj);
|
|
|
//response 返回字符串的不以error开头,则表示成功
|
|
|
return response;
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new Exception("短信下发失败");
|
|
|
}*/
|
|
|
}
|
|
|
//========================集成平台调用结束===========================
|
|
|
|
|
|
public String replaceHtml(String demoData,String oldChar,String newChar){
|