|
@ -965,7 +965,7 @@ public class YkyyEntranceService {
|
|
|
"FROM\n" +
|
|
|
"\tV_ZKSG_BRCX x\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tsfzh.sfzh = '"+idcard+"' ";
|
|
|
"\tx.sfzh = '"+idcard+"' ";
|
|
|
JSONArray array = new JSONArray();
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
@ -1049,7 +1049,7 @@ public class YkyyEntranceService {
|
|
|
wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
|
|
|
}
|
|
|
//诊断
|
|
|
synPrescriptionDiagnosis(prescriptionVO);
|
|
|
synPrescriptionDiagnosis(prescriptionVO,code);
|
|
|
|
|
|
prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
|
|
|
synPrecriptionHis(prescriptionVO,code);
|
|
@ -1059,12 +1059,83 @@ public class YkyyEntranceService {
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据身份证查找his医生
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findHisDoctor(String idcard) throws Exception{
|
|
|
String sql ="select y.code AS \"code\",y.ygbh,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 ='"+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 Icd10
|
|
|
* @param code
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray findHisIcd10(String code) throws Exception{
|
|
|
String sql ="select v.code,v.name,v.flag from V_HLW_ICD10 v WHERE v.code = '"+code.trim()+"'";
|
|
|
JSONArray array = new JSONArray();
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("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==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找挂号明细
|
|
|
* @param patient
|
|
|
* @param doctor
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray fingHlwGhmx(String patient,String doctor) throws Exception{
|
|
|
String sql = "select v.SBXH,v.GHXH,to_char(v.ghsj,'yyyy-mm-dd hh24:mi:ss') as GHSJ from v_hlw_ghmx v where v.brid = '"+patient+"' and v.ysdm =" +
|
|
|
" '"+doctor+"' and v.ghsj > to_date('"+DateUtil.dateToStrLong(DateUtil.getToday())+"','yyyy-MM-dd HH24:mi:ss')";
|
|
|
JSONArray array = new JSONArray();
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("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==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 诊断
|
|
|
* @param wlyyPrescriptionVO
|
|
|
*/
|
|
|
public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception{
|
|
|
public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception{
|
|
|
String doctor = wlyyPrescriptionVO.getDoctor();
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
|
|
|
String patient = wlyyPrescriptionVO.getPatientCode();
|
|
@ -1074,7 +1145,6 @@ public class YkyyEntranceService {
|
|
|
//挂号明细表HLW_GHMX
|
|
|
HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
|
|
|
hlwGhmxDO.setSBXH(0);
|
|
|
hlwGhmxDO.setJZXH(1);
|
|
|
hlwGhmxDO.setGHCS(1);
|
|
|
hlwGhmxDO.setGHJE(0);
|
|
|
hlwGhmxDO.setZLJE(0);
|
|
@ -1091,64 +1161,145 @@ public class YkyyEntranceService {
|
|
|
hlwGhmxDO.setYSPB(0);
|
|
|
hlwGhmxDO.setSFFS(0);
|
|
|
hlwGhmxDO.setJZZT(2);
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwGhmxDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
}
|
|
|
hlwGhmxDO.setJZXH(0);
|
|
|
hlwGhmxDO.setKSDM(wlyyPrescriptionVO.getDept());
|
|
|
hlwGhmxDO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
|
|
|
String jsonString = JSONObject.toJSONString(hlwGhmxDO);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("json",jsonString);
|
|
|
params.put("table","HlwGhmxDO");
|
|
|
logger.info("HlwGhmxDO:"+jsonString);
|
|
|
HttpResponse response = HttpUtils.doGet(saveUrl,params);
|
|
|
if (response.getStatus()==200){
|
|
|
String content = response.getContent();
|
|
|
logger.info("content"+content);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
if (object!=null){
|
|
|
GHXH = object.getInteger("sbxh");
|
|
|
logger.info("GHXH=========="+GHXH);
|
|
|
}
|
|
|
logger.info("表hlwGhmxDO同步成功!");
|
|
|
hlwGhmxDO.setGHSJ(new Date());//挂号时间
|
|
|
hlwGhmxDO.setGHLB(1);//挂号类别
|
|
|
hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
|
|
|
hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
|
|
|
//病人性质
|
|
|
JSONArray jsonArray = findHisPatient(patientMappingDO.getIdcard());
|
|
|
if(jsonArray!=null&&jsonArray.size()>0){
|
|
|
//获取居民信息
|
|
|
JSONObject json = jsonArray.getJSONObject(0);
|
|
|
hlwGhmxDO.setBRXZ(json.getInteger("brxz"));
|
|
|
}
|
|
|
|
|
|
//就诊历史表HLWYS_MZ_JZLS
|
|
|
HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
|
|
|
hlwYsMzJzLsDO.setJZXH(0);
|
|
|
hlwYsMzJzLsDO.setGHXH(GHXH);
|
|
|
hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
|
|
|
hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
|
|
|
hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
|
|
|
hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
|
|
|
hlwYsMzJzLsDO.setJZZT(9);
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
//操作工号
|
|
|
JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
|
|
|
if(jsonArray1!=null&&jsonArray1.size()>0){
|
|
|
//获取医生信息
|
|
|
JSONObject json = jsonArray1.getJSONObject(0);
|
|
|
hlwGhmxDO.setCZGH(json.getString("YGBH"));
|
|
|
}
|
|
|
String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
|
|
|
Map<String,Object> params2 = new HashedMap();
|
|
|
params2.put("json",jsonString2);
|
|
|
params2.put("table","HlwYsMzJzLsDO");
|
|
|
logger.info("HlwYsMzJzLsDO:"+jsonString2);
|
|
|
HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
|
|
|
if (response2.getStatus()==200){
|
|
|
logger.info("content"+response2.getContent());
|
|
|
logger.info("表hlwYsMzJzLsDO同步成功!");
|
|
|
|
|
|
// 同一个医生同一个病人,一天一条挂号记录。
|
|
|
JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),doctorMappingDO.getMappingCode());
|
|
|
if(ja!=null&&ja.size()>0){
|
|
|
//更新
|
|
|
JSONObject json = ja.getJSONObject(0);
|
|
|
hlwGhmxDO.setSBXH(json.getInteger("SBXH"));
|
|
|
hlwGhmxDO.setGHSJ(DateUtil.strToDate(json.getString("GHSJ")));
|
|
|
GHXH = json.getInteger("GHXH");
|
|
|
|
|
|
String jsonString = JSONObject.toJSONString(hlwGhmxDO);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("json",jsonString);
|
|
|
params.put("table","HlwGhmxDO");
|
|
|
logger.info("HlwGhmxDO:"+jsonString);
|
|
|
HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
|
|
|
if (response.getStatus()==200){
|
|
|
logger.info("content"+response.getContent());
|
|
|
logger.info("表hlwGhmxDo更新成功!");
|
|
|
|
|
|
}else {
|
|
|
logger.info("表hlwGhmxDo更新失败!"+response.getErrorMsg());
|
|
|
}
|
|
|
}else{
|
|
|
//新增
|
|
|
String jsonString = JSONObject.toJSONString(hlwGhmxDO);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("json",jsonString);
|
|
|
params.put("table","HlwGhmxDO");
|
|
|
logger.info("HlwGhmxDO:"+jsonString);
|
|
|
HttpResponse response = HttpUtils.doGet(saveUrl,params);
|
|
|
if (response.getStatus()==200){
|
|
|
String content = response.getContent();
|
|
|
logger.info("content"+content);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
if (object!=null){
|
|
|
GHXH = object.getInteger("sbxh");
|
|
|
logger.info("GHXH=========="+GHXH);
|
|
|
}
|
|
|
logger.info("表hlwGhmxDo新增成功!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionVO.getId());
|
|
|
for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs){
|
|
|
Integer icd10Flag = 0;
|
|
|
List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code);
|
|
|
if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
|
|
|
WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
|
|
|
|
|
|
//就诊历史表HLWYS_MZ_JZLS
|
|
|
HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
|
|
|
hlwYsMzJzLsDO.setJZXH(0);
|
|
|
hlwYsMzJzLsDO.setGHXH(GHXH);
|
|
|
hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
|
|
|
hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
|
|
|
hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
|
|
|
hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
|
|
|
hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
|
|
|
hlwYsMzJzLsDO.setJZZT(9);
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
}
|
|
|
//V_HLW_ICD10.FLAG
|
|
|
JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
|
|
|
if(jsonArray2!=null&&jsonArray2.size()>0){
|
|
|
//获取居民信息
|
|
|
JSONObject json = jsonArray2.getJSONObject(0);
|
|
|
icd10Flag = json.getInteger("FLAG");
|
|
|
|
|
|
}
|
|
|
hlwYsMzJzLsDO.setZYZD(icd10Flag);
|
|
|
|
|
|
String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
|
|
|
Map<String,Object> params2 = new HashedMap();
|
|
|
params2.put("json",jsonString2);
|
|
|
params2.put("table","HlwYsMzJzLsDO");
|
|
|
logger.info("HlwYsMzJzLsDO:"+jsonString2);
|
|
|
HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
|
|
|
if (response2.getStatus()==200){
|
|
|
String content = response2.getContent();
|
|
|
logger.info("content"+content);
|
|
|
//获取就诊序号,更新处方表数据
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
JSONObject object = jsonObject.getJSONObject("obj");
|
|
|
if (object!=null){
|
|
|
Integer jzxh = object.getInteger("jzxh");
|
|
|
wlyyPrescriptionVO.setAdmNo(jzxh+"");
|
|
|
logger.info("JZXH=========="+jzxh);
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
|
|
|
if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
wlyyPrescriptionDO.setAdmNo(jzxh+"");
|
|
|
prescriptionDao.save(wlyyPrescriptionDO);
|
|
|
}
|
|
|
}
|
|
|
logger.info("表hlwYsMzJzLsDO同步成功!");
|
|
|
}
|
|
|
|
|
|
//疾病诊断表HLWYS_MZ_JBZD
|
|
|
HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
|
|
|
//hlwYsMzJbzdDO.setJLBH(0);
|
|
|
hlwYsMzJbzdDO.setJZXH(0);
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
}
|
|
|
hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
|
|
|
hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
|
|
|
hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
|
|
|
hlwYsMzJbzdDO.setJBBH(icd10Flag);
|
|
|
hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
|
|
|
hlwYsMzJbzdDO.setZDLB(11);//诊断类别
|
|
|
hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
|
|
|
hlwYsMzJbzdDO.setZFPB(0);//作废标志
|
|
|
hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
|
|
|
hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
|
|
|
hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
|
|
|
hlwYsMzJbzdDO.setZDLX(1);//诊断类型
|
|
|
hlwYsMzJbzdDO.setTJBZ(1);//提交标志
|
|
|
if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
|
|
|
hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
|
|
|
}
|
|
|
|
|
|
String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
|
|
|
Map<String,Object> params1 = new HashedMap();
|
|
|
params1.put("json",jsonString1);
|
|
@ -1156,11 +1307,12 @@ public class YkyyEntranceService {
|
|
|
logger.info("HlwYsMzJbzdDO:"+jsonString1);
|
|
|
HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
|
|
|
if (response1.getStatus()==200){
|
|
|
logger.info("content"+response1.getContent());
|
|
|
String content = response1.getContent();
|
|
|
logger.info("content"+content);
|
|
|
|
|
|
logger.info("表hlwYsMzJbzdDO同步成功!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
|