|
@ -4,6 +4,7 @@ package com.yihu.jw.hospital.prescription.service.entrance;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
|
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
|
|
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
@ -19,9 +20,7 @@ import java.io.BufferedReader;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.io.InputStreamReader;
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@ -200,7 +199,7 @@ public class EntranceService {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public String BS16017ReturnObj(String REGISTER_SN,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
|
|
|
|
|
|
public List<WlyyPrescriptionVO> BS16017ReturnObj(String REGISTER_SN,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
|
|
String fid=BS16017;
|
|
String fid=BS16017;
|
|
String resp = "";
|
|
String resp = "";
|
|
if (demoFlag) {
|
|
if (demoFlag) {
|
|
@ -227,7 +226,7 @@ public class EntranceService {
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
|
|
}
|
|
}
|
|
return resp;
|
|
|
|
|
|
return convertWlyyPrescriptionVOInBodyRow(resp);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 返回对象数组数据解析
|
|
* 返回对象数组数据解析
|
|
@ -240,65 +239,95 @@ public class EntranceService {
|
|
JSONArray jsonArray=new JSONArray();
|
|
JSONArray jsonArray=new JSONArray();
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
WlyyPrescriptionVO wlyyPrescriptionVO =new WlyyPrescriptionVO();
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
|
|
if(null!=jsonObjectMgsInfo) {
|
|
|
|
//处方实体
|
|
|
|
WlyyPrescriptionVO wlyyPrescriptionVO=new WlyyPrescriptionVO();
|
|
|
|
//诊断list
|
|
|
|
List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
|
|
|
|
//药品实体list
|
|
|
|
List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS= new ArrayList<>();
|
|
|
|
//药品
|
|
|
|
WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO;
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
net.sf.json.JSONObject jsonObjectBody=(net.sf.json.JSONObject)object;
|
|
|
|
jsonObjectBody= (net.sf.json.JSONObject)jsonObjectBody.get("body");
|
|
|
|
if(null!=jsonObjectBody){
|
|
|
|
if(null!=jsonObjectBody.get("YP_FLAG")){
|
|
|
|
//是否为药品:0否,1是
|
|
|
|
Integer ypFlag=(Integer)jsonObjectBody.get("YP_FLAG");
|
|
|
|
if(1==ypFlag){
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setRealOrder(null!=jsonObjectBody.get("real_order")?jsonObjectBody.get("real_order").toString():"");
|
|
|
|
wlyyPrescriptionVO.setSerialNo(null!=jsonObjectBody.get("REGISTER_SN")?jsonObjectBody.get("REGISTER_SN").toString():"");
|
|
|
|
wlyyPrescriptionVO.setType(1);
|
|
|
|
wlyyPrescriptionVO.setPatientCode(null!=jsonObjectBody.get("PAT_NO")?jsonObjectBody.get("PAT_NO").toString():"");
|
|
|
|
//TODO 通过居民唯一号获取居民姓名
|
|
|
|
wlyyPrescriptionVO.setPatientName(null!=jsonObjectBody.get("UOM")?jsonObjectBody.get("UOM").toString():"");
|
|
|
|
//TODO 通过映射表获取居民身份证号
|
|
|
|
wlyyPrescriptionVO.setIdcard(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
//TODO 社保卡号
|
|
|
|
wlyyPrescriptionVO.setSsc(null!=jsonObjectBody.get("YP_FLAG")?jsonObjectBody.get("YP_FLAG").toString():"");
|
|
|
|
//诊断
|
|
|
|
WlyyPrescriptionDiagnosisVO wlyyPrescriptionDiagnosisVO=new WlyyPrescriptionDiagnosisVO();
|
|
|
|
wlyyPrescriptionDiagnosisVO.setPrescriptionId(null!=jsonObjectBody.get("real_order")?jsonObjectBody.get("real_order").toString():"");
|
|
|
|
// wlyyPrescriptionDiagnosisVO.setPrescriptionId(null!=jsonObjectBody.get("real_order")?jsonObjectBody.get("real_order").toString():"");
|
|
|
|
//主诊断 毒蛇咬伤&T63.001
|
|
|
|
String[] icdName=jsonObjectBody.get("icd_name").toString().split("&");
|
|
|
|
String[] diagTwo=jsonObjectBody.get("diag_two").toString().toString().split("&");
|
|
|
|
String[] diagThree=jsonObjectBody.get("diag_three").toString().toString().split("&");
|
|
|
|
String[] diagFour=jsonObjectBody.get("diag_four").toString().toString().split("&");
|
|
|
|
String[] diagFive=jsonObjectBody.get("diag_five").toString().toString().split("&");
|
|
|
|
if(null!=icdName){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) object;
|
|
|
|
jsonObjectBody = (net.sf.json.JSONObject) jsonObjectBody.get("body");
|
|
|
|
if (null != jsonObjectBody) {
|
|
|
|
jsonObjectBody = (net.sf.json.JSONObject) jsonObjectBody.get("row");
|
|
|
|
if (null != jsonObjectBody) {
|
|
|
|
//诊断
|
|
|
|
WlyyPrescriptionDiagnosisVO wlyyPrescriptionDiagnosisVO;
|
|
|
|
if (null != jsonObjectBody.get("YP_FLAG")) {
|
|
|
|
//是否为药品:0否,1是
|
|
|
|
Integer ypFlag = (Integer) jsonObjectBody.get("YP_FLAG");
|
|
|
|
Set<String> stringSet = new HashSet<>();
|
|
|
|
Map<String, WlyyPrescriptionVO> wlyyPrescriptionVOMap = new HashMap<>();
|
|
|
|
if (1 == ypFlag) {
|
|
|
|
String realOrder = null != jsonObjectBody.get("real_order") ? jsonObjectBody.get("real_order").toString() : "";
|
|
|
|
if (!(null != stringSet && stringSet.contains(realOrder))) {
|
|
|
|
wlyyPrescriptionVO = initWlyyPrescriptionVo(new WlyyPrescriptionVO(), jsonObjectBody, realOrder);
|
|
|
|
wlyyPrescriptionVOMap.put(realOrder, wlyyPrescriptionVO);
|
|
|
|
//主诊断 毒蛇咬伤&T63.001
|
|
|
|
String[] icdName = jsonObjectBody.get("icd_name").toString().split("&");
|
|
|
|
String[] diagTwo = jsonObjectBody.get("diag_two").toString().toString().split("&");
|
|
|
|
String[] diagThree = jsonObjectBody.get("diag_three").toString().toString().split("&");
|
|
|
|
String[] diagFour = jsonObjectBody.get("diag_four").toString().toString().split("&");
|
|
|
|
String[] diagFive = jsonObjectBody.get("diag_five").toString().toString().split("&");
|
|
|
|
|
|
|
|
if (null != icdName && icdName.length > 1) {
|
|
|
|
//主诊断
|
|
|
|
wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, icdName[0].toString(), icdName[1].toString(), 1);
|
|
|
|
wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
|
|
|
|
}
|
|
|
|
if (null != diagTwo && diagTwo.length > 1) {
|
|
|
|
//第二诊断
|
|
|
|
wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagTwo[0].toString(), diagTwo[1].toString(), 2);
|
|
|
|
wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
|
|
|
|
}
|
|
|
|
if (null != diagThree && diagThree.length > 1) {
|
|
|
|
//第三诊断
|
|
|
|
wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagThree[0].toString(), diagThree[1].toString(), 2);
|
|
|
|
wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
|
|
|
|
}
|
|
|
|
if (null != diagFour && diagFour.length > 1) {
|
|
|
|
//第四诊断
|
|
|
|
wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFour[0].toString(), diagFour[1].toString(), 2);
|
|
|
|
wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
|
|
|
|
}
|
|
|
|
if (null != diagFive && diagFive.length > 1) {
|
|
|
|
//第五诊断
|
|
|
|
wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFive[0].toString(), diagFive[1].toString(), 2);
|
|
|
|
wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
wlyyPrescriptionVO = wlyyPrescriptionVOMap.get(realOrder);
|
|
|
|
}
|
|
|
|
stringSet.add(realOrder);
|
|
|
|
//药品
|
|
|
|
wlyyPrescriptionInfoVO = new WlyyPrescriptionInfoVO();
|
|
|
|
wlyyPrescriptionInfoVO.setPrescriptionId(realOrder);
|
|
|
|
wlyyPrescriptionInfoVO.setDrugNo(null != jsonObjectBody.get("DRUG_CODE") ? jsonObjectBody.get("DRUG_CODE").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setDrugName(null != jsonObjectBody.get("DRUG_NAME") ? jsonObjectBody.get("DRUG_NAME").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setDispDeposite(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setDosage(null != jsonObjectBody.get("YPYL00") ? jsonObjectBody.get("YPYL00").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setQuantity(null != jsonObjectBody.get("DRUG_QTY") ? jsonObjectBody.get("DRUG_QTY").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setUnit(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setUsage(null != jsonObjectBody.get("YPPL00") ? jsonObjectBody.get("YPPL00").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setSupplyCode(null != jsonObjectBody.get("YPYF00") ? jsonObjectBody.get("YPYF00").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setDays(null != jsonObjectBody.get("days") ? jsonObjectBody.get("days").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setFrequency(null != jsonObjectBody.get("frequency") ? jsonObjectBody.get("frequency").toString() : "");
|
|
|
|
wlyyPrescriptionInfoVO.setDel(1);
|
|
|
|
wlyyPrescriptionInfoVOS.add(wlyyPrescriptionInfoVO);
|
|
}
|
|
}
|
|
//
|
|
|
|
// wlyyPrescriptionDiagnosisVO.
|
|
|
|
// icdName.split("&")
|
|
|
|
|
|
|
|
wlyyPrescriptionDiagnosisVO.setPrescriptionId(null!=jsonObjectBody.get("icd_name")?jsonObjectBody.get("icd_name").toString():"");
|
|
|
|
wlyyPrescriptionDiagnosisVO.setPrescriptionId(null!=jsonObjectBody.get("real_order")?jsonObjectBody.get("real_order").toString():"");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlyyPrescriptionVO.setHisDoctorCode(null!=jsonObjectBody.get("PRESC_DOC")?jsonObjectBody.get("PRESC_DOC").toString():"");
|
|
|
|
wlyyPrescriptionVO.setHisDeptCode(null!=jsonObjectBody.get("PRESC_SPEC")?jsonObjectBody.get("PRESC_SPEC").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null!=jsonObjectBody.get("ADM_NO")?jsonObjectBody.get("ADM_NO").toString():"");
|
|
|
|
}
|
|
}
|
|
|
|
// jsonArray.add(jsonObjectBody.get("row"));
|
|
}
|
|
}
|
|
|
|
|
|
jsonArray.add(jsonObjectBody.get("row")) ;
|
|
|
|
|
|
} else {
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
wlyyPrescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
|
|
|
|
wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
|
|
|
|
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}else {
|
|
}else {
|
|
@ -309,6 +338,48 @@ public class EntranceService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化处方接口
|
|
|
|
* @param wlyyPrescriptionVO
|
|
|
|
* @param jsonObjectBody
|
|
|
|
* @param realOrder
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public WlyyPrescriptionVO initWlyyPrescriptionVo(WlyyPrescriptionVO wlyyPrescriptionVO , net.sf.json.JSONObject jsonObjectBody,String realOrder){
|
|
|
|
wlyyPrescriptionVO.setAdmNo(null != jsonObjectBody.get("ADM_NO") ? jsonObjectBody.get("ADM_NO").toString() : "");
|
|
|
|
wlyyPrescriptionVO.setRealOrder(realOrder);
|
|
|
|
wlyyPrescriptionVO.setSerialNo(null != jsonObjectBody.get("REGISTER_SN") ? jsonObjectBody.get("REGISTER_SN").toString() : "");
|
|
|
|
wlyyPrescriptionVO.setType(1);
|
|
|
|
wlyyPrescriptionVO.setPatientCode(null != jsonObjectBody.get("PAT_NO") ? jsonObjectBody.get("PAT_NO").toString() : "");
|
|
|
|
//TODO 通过居民唯一号获取居民姓名
|
|
|
|
wlyyPrescriptionVO.setPatientName(null != jsonObjectBody.get("UOM") ? jsonObjectBody.get("UOM").toString() : "");
|
|
|
|
//TODO 通过映射表获取居民身份证号
|
|
|
|
wlyyPrescriptionVO.setIdcard(null != jsonObjectBody.get("ADM_NO") ? jsonObjectBody.get("ADM_NO").toString() : "");
|
|
|
|
//TODO 社保卡号
|
|
|
|
wlyyPrescriptionVO.setSsc(null != jsonObjectBody.get("YP_FLAG") ? jsonObjectBody.get("YP_FLAG").toString() : "");
|
|
|
|
wlyyPrescriptionVO.setHisDoctorCode(null != jsonObjectBody.get("PRESC_DOC") ? jsonObjectBody.get("PRESC_DOC").toString() : "");
|
|
|
|
wlyyPrescriptionVO.setHisDeptCode(null != jsonObjectBody.get("PRESC_SPEC") ? jsonObjectBody.get("PRESC_SPEC").toString() : "");
|
|
|
|
return wlyyPrescriptionVO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化诊断信息
|
|
|
|
* @param icdCode
|
|
|
|
* @param icdName
|
|
|
|
* @param type
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public WlyyPrescriptionDiagnosisVO initWlyyPrescriptionDiagnosisVO(String realOrder,String icdCode,String icdName,Integer type) throws Exception{
|
|
|
|
WlyyPrescriptionDiagnosisVO wlyyPrescriptionDiagnosisVO=new WlyyPrescriptionDiagnosisVO();
|
|
|
|
wlyyPrescriptionDiagnosisVO.setPrescriptionId(realOrder);
|
|
|
|
wlyyPrescriptionDiagnosisVO.setCode(icdCode);
|
|
|
|
wlyyPrescriptionDiagnosisVO.setName(icdName);
|
|
|
|
wlyyPrescriptionDiagnosisVO.setCreateTime(new Date());
|
|
|
|
wlyyPrescriptionDiagnosisVO.setType(type);
|
|
|
|
return wlyyPrescriptionDiagnosisVO;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 患者门诊就诊记录
|
|
* 患者门诊就诊记录
|
|
* 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
|
|
* 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
|