|
@ -26,7 +26,10 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
@ -167,6 +170,84 @@ public class YkyyEntranceService {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者门诊就诊记录
|
|
|
* 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
|
|
|
*
|
|
|
* @param PAT_NO 居民唯一号 一个居民在该医院只有一个号,该接口必须输入的参数
|
|
|
* @param conNo 就诊次数,使用居民唯一号+就诊次数获取唯一一条就诊记录
|
|
|
* // * @param admNo 就诊唯一号 每一次就诊都有一个唯一号:居民号+就诊次数,查询确定的一条就诊记录时需要传,否则传null
|
|
|
* // * @param registerSn 挂号流水号,查询确定的一条就诊记录时需要传,否则传null
|
|
|
* @param startTime 开始时间 (查询一段时间内就诊记录开始时间,查询就诊记录列表时需要传,否则传null)
|
|
|
* @param endTime 结束时间 (查询一段时间内就诊记录结束时间,查询就诊记录列表时需要传,否则传null)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception {
|
|
|
String fid = "BS30025";
|
|
|
logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
|
|
|
|
|
|
String resp = "";
|
|
|
String orgCode = "350211A5004";
|
|
|
String orgName = "厦门大学附属厦门眼科中心";
|
|
|
|
|
|
//居民id转化
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(PAT_NO);
|
|
|
if(patientMappingDO == null){
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//查找眼科数据
|
|
|
JSONArray jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime);
|
|
|
if (jsonArray.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
|
|
|
WlyyOutpatientVO wlyyOutpatientVO;
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
JSONObject jsonObjectMgsInfo = jsonArray.getJSONObject(i);
|
|
|
if (null != jsonObjectMgsInfo) {
|
|
|
wlyyOutpatientVO = new WlyyOutpatientVO();
|
|
|
wlyyOutpatientVO.setHospital(orgCode);
|
|
|
wlyyOutpatientVO.setHospitalName(orgName);
|
|
|
wlyyOutpatientVO.setWinNo("6");
|
|
|
wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
|
|
|
//wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
|
|
|
wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("KSDM") ? "" : jsonObjectMgsInfo.get("KSDM") + "");
|
|
|
wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("KSMC") ? "" : jsonObjectMgsInfo.get("KSMC") + "");
|
|
|
wlyyOutpatientVO.setPatient(patientMappingDO.getPatient());
|
|
|
wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName());
|
|
|
//wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("CON_NO") ? "" : jsonObjectMgsInfo.get("CON_NO") + "");
|
|
|
String doctor = null == jsonObjectMgsInfo.get("YSDM") ? "" : jsonObjectMgsInfo.get("YSDM") + "";
|
|
|
|
|
|
//转化医生
|
|
|
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("KDYS") ? "" : jsonObjectMgsInfo.get("KDYS") + "");
|
|
|
|
|
|
// wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
|
|
|
|
|
|
String icdName = null == jsonObjectMgsInfo.get("ZDMC") ? "" : jsonObjectMgsInfo.get("ZDMC") + "";
|
|
|
// wlyyOutpatientVO.setIcd10(icdcodes);
|
|
|
wlyyOutpatientVO.setIcd10Name(icdName);
|
|
|
|
|
|
// String admDate = null == jsonObjectMgsInfo.get("ADM_DAT") ? "" : jsonObjectMgsInfo.get("ADM_DAT") + "";
|
|
|
String conDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + "";
|
|
|
// 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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找眼科his 已审核未付款的处方
|
|
|
* @throws Exception
|
|
@ -186,6 +267,38 @@ public class YkyyEntranceService {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* HIS就诊患者历史查询
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime) throws Exception{
|
|
|
String sql = "SELECT to_char(h.KSSJ ,'yyyy-MM-dd hh24:mi:ss' ) as KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
|
|
|
",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" ";
|
|
|
if(!StringUtil.isBlank(conNo)){
|
|
|
sql += " and h.JZXH = " + conNo;
|
|
|
}
|
|
|
if(!StringUtil.isBlank(startTime)){
|
|
|
sql += " and h.KSSJ >= to_date('"+startTime+"', 'YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
if(!StringUtil.isBlank(endTime)){
|
|
|
sql += " and h.KSSJ <= to_date('"+endTime+"', 'YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
|
|
|
sql += " order by h.KSSJ desc";
|
|
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",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!=null&&status == 200){
|
|
|
return rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|
|
|
public String updateYkyyDoctor()throws Exception{
|
|
|
String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.jobtitlecode AS \"jobTitleCode\",y.jobTitleName AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
@ -763,11 +876,76 @@ public class YkyyEntranceService {
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取his病人信息
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findHisPatient(String idcard) throws Exception {
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tx.brid AS \"brid\",\n" +
|
|
|
"\tx.mzhm AS \"mzhm\",\n" +
|
|
|
"\tx.brxm AS \"brxm\",\n" +
|
|
|
"\tx.sfzh AS \"sfzh\",\n" +
|
|
|
"\tx.brxz AS \"brxz\",\n" +
|
|
|
"\tx.brxb AS \"brxb\",\n" +
|
|
|
"\tx.csny as \"csny\",\n" +
|
|
|
"\tx.jzkh AS \"jzkh\",\n" +
|
|
|
"\tx.jdsj AS \"jdsj\",\n" +
|
|
|
"\tx.sjhm AS \"sjhm\",\n" +
|
|
|
"\tx.fzxmc AS \"fzxmc\",\n" +
|
|
|
"\tx.gzztmc AS \"gzztmc\",\n" +
|
|
|
"\tx.lxdz AS \"lxdz\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tV_ZKSG_BRCX x\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tsfzh.sfzh = '"+idcard+"' ";
|
|
|
JSONArray array = new JSONArray();
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("idcard:"+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;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取his就诊卡号
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findHisCard(String idcard) throws Exception {
|
|
|
String sql = "select o.pat_no as \"pat_no\",o.card_no as \"card_no\",o.card_stat as \"card_stat\",o.op_date as \"op_date\",o.card_type as \"card_type\",o.card_type_name as \"card_type_name\" from v_zksg_brcx x,V_HLW_CARDINFO o where o.pat_no = x.mzhm and x.sfzh = '"+idcard+"'";
|
|
|
JSONArray array = new JSONArray();
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("idcard:"+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;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String findByRealOrder(String code) throws Exception {
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOs = prescriptionDao.findByPatientCode(code);
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOs = prescriptionDao.findById(code);
|
|
|
if (wlyyPrescriptionDOs!=null&&wlyyPrescriptionDOs.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
|
|
|
JSONObject objectString = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
|
|
@ -776,18 +954,19 @@ public class YkyyEntranceService {
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
|
|
|
JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
|
|
|
logger.info("11111参数入参"+object.toJSONString());
|
|
|
WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
|
|
|
wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
|
|
|
}
|
|
|
prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
|
|
|
synPrecriptionHis(prescriptionVO);
|
|
|
synPrecriptionHis(prescriptionVO,code);
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
return wlyyPrescriptionDOs.toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
|
|
|
public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
|
|
|
HlwCf01DO hlwCf01DO = new HlwCf01DO();
|
|
|
if (wlyyPrescriptionVO!=null){
|
|
|
hlwCf01DO.setSPZT(0);
|
|
@ -795,13 +974,24 @@ public class YkyyEntranceService {
|
|
|
hlwCf01DO.setYFSB(3);
|
|
|
hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
|
|
|
hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
|
|
|
hlwCf01DO.setZFPB(1);
|
|
|
hlwCf01DO.setZFPB(0);
|
|
|
hlwCf01DO.setFYBZ(0);
|
|
|
hlwCf01DO.setPYBZ(0);
|
|
|
hlwCf01DO.setDJYBZ(0);
|
|
|
hlwCf01DO.setCFTS(1);
|
|
|
hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
|
|
|
hlwCf01DO.setYXPB(1);
|
|
|
hlwCf01DO.setDYBZ(0);
|
|
|
hlwCf01DO.setTSCF(0);
|
|
|
hlwCf01DO.setTYBZ(0);
|
|
|
hlwCf01DO.setTSLX(6);
|
|
|
hlwCf01DO.setCFBZ(0);
|
|
|
hlwCf01DO.setJZXH(0);
|
|
|
hlwCf01DO.setYXPB(0);
|
|
|
hlwCf01DO.setLSCFBZ(0);
|
|
|
hlwCf01DO.setZJFLAG(0);
|
|
|
hlwCf01DO.setLSCFBZ(0);
|
|
|
hlwCf01DO.setZJFLAG(0);
|
|
|
hlwCf01DO.setFKZT(1);
|
|
|
hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
|
|
|
String patient = wlyyPrescriptionVO.getPatientCode();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
@ -813,6 +1003,8 @@ public class YkyyEntranceService {
|
|
|
hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
|
|
|
hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
|
|
|
hlwCf01DO.setGUID(getCode());
|
|
|
hlwCf01DO.setSJLY(1);
|
|
|
hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
/* hibenateUtils.save(hlwCf01DO);*/
|
|
|
|
|
|
String jsonString = JSONObject.toJSONString(hlwCf01DO);
|
|
@ -820,24 +1012,42 @@ public class YkyyEntranceService {
|
|
|
params.put("json",jsonString);
|
|
|
params.put("table","HLW_CF01");
|
|
|
logger.info("HLW_CF01:"+jsonString);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
HttpResponse response = HttpUtils.doGet(saveUrl,params);
|
|
|
if (response.getStatus()==200){
|
|
|
logger.info("content"+response.getContent());
|
|
|
String content = response.getContent();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
if (object!=null){
|
|
|
String cfsb = object.getString("cfsb");
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
wlyyPrescriptionDO.setRealOrder(cfsb);
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}
|
|
|
logger.info("表HLW_CF01同步成功!");
|
|
|
|
|
|
}else {
|
|
|
logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
|
|
|
}
|
|
|
logger.info("处方:"+wlyyPrescriptionVO);
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
|
|
|
for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
|
|
|
try {
|
|
|
logger.info("chufang1============");
|
|
|
HlwCf02DO hlwCf02DO = new HlwCf02DO();
|
|
|
hlwCf02DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
|
|
|
hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
|
|
|
logger.info("drugNo"+hlwCf02DO.getYPXH());
|
|
|
hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
|
|
|
hlwCf02DO.setXMLX(1);
|
|
|
hlwCf02DO.setCFTS(1);
|
|
|
hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
|
|
|
hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice());
|
|
|
hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice());//划价价额
|
|
|
hlwCf02DO.setYPZS(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
|
|
|
hlwCf02DO.setYPZS(1);//药品组数 待确定
|
|
|
hlwCf02DO.setYCSL("0");
|
|
|
hlwCf02DO.setFYGB(17);//费用归并
|
|
|
hlwCf02DO.setZFBL(1.0);//自负比例
|
|
@ -845,20 +1055,28 @@ public class YkyyEntranceService {
|
|
|
hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
|
|
|
hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
|
|
|
hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
|
|
|
hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
|
|
|
hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
|
|
|
hlwCf02DO.setPSPB(0);
|
|
|
hlwCf02DO.setYYTS(1);
|
|
|
/*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
|
|
|
hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
|
|
|
/* hibenateUtils.save(hlwCf02DO);*/
|
|
|
String jsonString1 = JSONObject.toJSONString(hlwCf01DO);
|
|
|
String jsonString1 = JSONObject.toJSONString(hlwCf02DO);
|
|
|
logger.info("chufang2============");
|
|
|
Map<String,Object> params1 = new HashedMap();
|
|
|
params1.put("json",jsonString1);
|
|
|
params1.put("table","HLW_CF02");
|
|
|
logger.info("HLW_CF02:"+jsonString1);
|
|
|
HttpResponse response1 = HttpUtils.doGet(url,params1);
|
|
|
HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
|
|
|
if (response1.getStatus()==200){
|
|
|
logger.info("表HLW_CF02同步成功!");
|
|
|
}else {
|
|
|
logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
e.getMessage();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -867,4 +1085,10 @@ public class YkyyEntranceService {
|
|
|
public String getCode() {
|
|
|
return UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|