|
@ -25,6 +25,7 @@ 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.ConvertUtil;
|
|
|
import com.yihu.jw.oauth.OauthRsaKeyDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
|
|
@ -47,12 +48,18 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.InputStreamReader;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 第三医院内网his对接服务
|
|
@ -122,7 +129,6 @@ public class DsyyEntranceService {
|
|
|
@Autowired
|
|
|
private OauthCaConfigDao oauthCaConfigDao;
|
|
|
|
|
|
|
|
|
private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
|
|
|
|
|
|
private static String caKey = "bvvsf3JA0mUXMU+mVnMaOQ==";
|
|
@ -497,13 +503,139 @@ public class DsyyEntranceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取本地示例返参
|
|
|
*
|
|
|
* @param fid 服务id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getJosnFileResullt(String fid) throws Exception {
|
|
|
String contentStr = null;
|
|
|
Resource resource = new ClassPathResource("mqConfig/mqdata/" + fid + ".json");
|
|
|
if (resource.exists()) {
|
|
|
InputStream is = resource.getInputStream();
|
|
|
contentStr = new BufferedReader(new InputStreamReader(is, "utf-8"))
|
|
|
.lines().collect(Collectors.joining(System.lineSeparator()));
|
|
|
// contentStr = replaceSpecialStr(contentStr);
|
|
|
} else {
|
|
|
throw new Exception("文件不存在");
|
|
|
}
|
|
|
return contentStr;
|
|
|
}
|
|
|
|
|
|
public List<WlyyOutpatientVO> BS30025_demo(String PAT_NO, String conNo, String startTime, String endTime ,String ksdm) throws Exception {
|
|
|
System.out.println("ksdm="+ksdm);
|
|
|
String fid = "BS30025";
|
|
|
logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
|
|
|
|
|
|
String resp = "";
|
|
|
String orgCode = "350211A1002";
|
|
|
String orgName = "厦门大学附属中山医院";
|
|
|
resp = getJosnFileResullt(fid);
|
|
|
net.sf.json.JSONArray jsonArray = ConvertUtil.convertListEnvelopInRow(resp);
|
|
|
if (null == jsonArray) {
|
|
|
return null; }
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
|
|
|
WlyyOutpatientVO wlyyOutpatientVO;
|
|
|
for (Object object : jsonArray) {
|
|
|
net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object;
|
|
|
if (null != jsonObjectMgsInfo) {
|
|
|
wlyyOutpatientVO = new WlyyOutpatientVO();
|
|
|
//中山医院固定入参
|
|
|
wlyyOutpatientVO.setHospital(orgCode);
|
|
|
wlyyOutpatientVO.setHospitalName(orgName);
|
|
|
wlyyOutpatientVO.setWinNo("6");
|
|
|
wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "");
|
|
|
wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
|
|
|
wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + "");
|
|
|
wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("ADM_SPEC_NAME") ? "" : jsonObjectMgsInfo.get("ADM_SPEC_NAME") + "");
|
|
|
String patNo = null != jsonObjectMgsInfo.get("PAT_NO") ? jsonObjectMgsInfo.get("PAT_NO").toString() : "";
|
|
|
String patientName = null != jsonObjectMgsInfo.get("PAT_NAME") ? jsonObjectMgsInfo.get("PAT_NAME").toString() : "";
|
|
|
PatientMappingDO patientMappingDo = new PatientMappingDO();
|
|
|
if (StringUtils.isNotBlank(patNo)) {
|
|
|
patientMappingDo = patientMappingDao.findByMappingCodeAndSource(patNo.trim(), "1");
|
|
|
patNo = null == patientMappingDo ? null : patientMappingDo.getPatient();
|
|
|
patientName = null == patientMappingDo ? null : patientMappingDo.getPatientName();
|
|
|
}
|
|
|
wlyyOutpatientVO.setPatient(patNo);
|
|
|
wlyyOutpatientVO.setPatientName(patientName);
|
|
|
wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("CON_NO") ? "" : jsonObjectMgsInfo.get("CON_NO") + "");
|
|
|
String doctor = null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "";
|
|
|
|
|
|
//转化医生
|
|
|
String mappingCode = doctor.trim();
|
|
|
String doctorCode = "";
|
|
|
if (StringUtils.isNotBlank(mappingCode)) {
|
|
|
List<DoctorMappingDO> mappingDOs = doctorMappingDao.findByOrgCodeAndMappingCode(orgCode, mappingCode);
|
|
|
if (mappingDOs != null && mappingDOs.size() > 0) {
|
|
|
doctorCode = mappingDOs.get(0).getDoctor();
|
|
|
}
|
|
|
}
|
|
|
wlyyOutpatientVO.setDoctor(doctorCode);
|
|
|
wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + "");
|
|
|
|
|
|
// wlyyOutpatientVO.setIdcard(null == jsonObjectMgsInfo.get("social_no") ? "" : jsonObjectMgsInfo.get("social_no") + "");
|
|
|
wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
|
|
|
|
|
|
//主诊断 毒蛇咬伤&T63.001
|
|
|
String[] icdName = jsonObjectMgsInfo.get("icd_name").toString().split("&");
|
|
|
String[] diagTwo = jsonObjectMgsInfo.get("diag_two").toString().split("&");
|
|
|
String[] diagThree = jsonObjectMgsInfo.get("diag_three").toString().split("&");
|
|
|
String[] diagFour = jsonObjectMgsInfo.get("diag_four").toString().split("&");
|
|
|
String[] diagFive = jsonObjectMgsInfo.get("diag_five").toString().split("&");
|
|
|
|
|
|
String icdcodes = "";
|
|
|
String icdNames = "";
|
|
|
if (icdName.length > 1) {
|
|
|
icdcodes += icdName[1];
|
|
|
icdNames += icdName[0];
|
|
|
}
|
|
|
if (diagTwo.length > 1) {
|
|
|
icdcodes += "," + diagTwo[1];
|
|
|
icdNames += "," + diagTwo[0];
|
|
|
}
|
|
|
if (diagThree.length > 1) {
|
|
|
icdcodes += "," + diagThree[1];
|
|
|
icdNames += "," + diagThree[0];
|
|
|
}
|
|
|
if (diagFour.length > 1) {
|
|
|
icdcodes += "," + diagFour[1];
|
|
|
icdNames += "," + diagFour[0];
|
|
|
}
|
|
|
if (diagFive.length > 1) {
|
|
|
icdcodes += "," + diagFive[1];
|
|
|
icdNames += "," + diagFive[0];
|
|
|
}
|
|
|
|
|
|
// String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
|
|
|
// String[] icdcodeAndName = icds.split("&");
|
|
|
// wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
|
|
|
// wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : "");
|
|
|
wlyyOutpatientVO.setIcd10(icdcodes);
|
|
|
wlyyOutpatientVO.setIcd10Name(icdNames);
|
|
|
|
|
|
String admDate = null == jsonObjectMgsInfo.get("ADM_DAT") ? "" : jsonObjectMgsInfo.get("ADM_DAT") + "";
|
|
|
String conDate = null == jsonObjectMgsInfo.get("CON_DATE") ? "" : jsonObjectMgsInfo.get("CON_DATE") + "";
|
|
|
wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
|
|
|
wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
|
|
|
wlyyOutpatientVOS.add(wlyyOutpatientVO);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
return wlyyOutpatientVOS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取门诊就诊记录列表
|
|
|
* @param patient 居民id
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyOutpatientVO> selectOutpatientList(String patient, String startTime, String endTime,String ksdm, String cardNo) throws Exception {
|
|
|
public List<WlyyOutpatientVO> selectOutpatientList(String patient, String startTime, String endTime,boolean demoFlag,String ksdm, String cardNo) throws Exception {
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
|
|
|
if(demoFlag){
|
|
|
return BS30025_demo(patient, null, startTime, endTime,ksdm);
|
|
|
}
|
|
|
JSONArray array = new JSONArray();
|
|
|
patient = updatePatientMapping(patient,cardNo);
|
|
|
String sql = "SELECT\n" +
|