Browse Source

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 5 years ago
parent
commit
1147f3c2e7

+ 187 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java

@ -0,0 +1,187 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
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.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
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.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2020/05/07.
 */
@Service
@Transactional
public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(XzyyPrescriptionService.class);
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private PatientMappingDao patientMappingDao;
    /**
     * 挂号接口
     * @param outPatientId
     * @param doctor
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor){
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorMappingDO == null) {
            throw new RuntimeException("未找到医生映射信息");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        if (patientMappingDO==null){
            throw new RuntimeException("未找到居民映射信息");
        }
        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(), date, doctor);
        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
            //判断是否已经挂号,如果已经挂号
            if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                JSONObject res = new JSONObject();
                res.put("@RESULT", "0");
                logger.info("已经挂号 res: " + res.toString());
                //更新挂号流水号
                outpatientDO.setConNo(registerDO.getConNo());
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDao.save(outpatientDO);
                return res;
            }
        }
        JSONArray response =  xzzxEntranceService.registeredOperate(doctorMappingDO.getMappingCode(),outpatientDO.getDept(),patientMappingDO.getMappingCode(),doctorDO.getChargeType());
        JSONObject res = response.getJSONObject(0);
        logger.info("挂号结果 res: " + response.toString());
        String rsCode = res.getString("registerNo");
        if ("0".equals(rsCode)) {
            //存储挂号号
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: ");
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            // 存储挂号医生与挂号科室
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            //挂号流水号与挂号次数
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        } else if ("-2".equals(rsCode)) {
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: " + serialNo );
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(response.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return res;
    }
}

+ 23 - 124
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -970,29 +970,31 @@ public class XzzxEntranceService{
        String response="";
        String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&conNo="+conNo;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject jsonObject = JSONObject.parseObject(response);
        if (jsonObject.getInteger("status")==200){
            array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
            JSONObject object = array.getJSONObject(0);
            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.setIdcard(isEmty(object.getString("idcard")));
            outpatientVO.setMjz(isEmty(object.getString("mjz")));
            outpatientVO.setIcd10(isEmty(object.getString("icd10")));
            outpatientVO.setIcd10Name(isEmty(object.getString("icd10Name")));
            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.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")));
        }
        return outpatientVO;
    }
@ -1016,6 +1018,7 @@ public class XzzxEntranceService{
        }
        String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
@ -1194,6 +1197,7 @@ public class XzzxEntranceService{
        String response="";
        String url = entranceUrl+"registered?doctor="+doctor+"&dept="+dept+"&sickId="+sickId+"&clinicclass"+clinicclass;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
@ -1207,112 +1211,7 @@ public class XzzxEntranceService{
//============================hospital业务层==================start====================
    /**
     * 挂号接口
     * @param outPatientId
     * @param doctor
     * @param chargeType
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor,String chargeType){
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        if (doctorMappingDO == null) {
            throw new RuntimeException("未找到医生映射信息");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        if (patientMappingDO==null){
            throw new RuntimeException("未找到居民映射信息");
        }
        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(), date, doctor);
        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
            //判断是否已经挂号,如果已经挂号
            if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                JSONObject res = new JSONObject();
                res.put("@RESULT", "0");
                logger.info("已经挂号 res: " + res.toString());
                //更新挂号流水号
                outpatientDO.setConNo(registerDO.getConNo());
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDao.save(outpatientDO);
                return res;
            }
        }
        JSONArray response =  registeredOperate(doctorMappingDO.getMappingCode(),outpatientDO.getDept(),patientMappingDO.getMappingCode(),chargeType);
        JSONObject res = response.getJSONObject(0);
        logger.info("挂号结果 res: " + response.toString());
        String rsCode = res.getString("registerNo");
        if ("0".equals(rsCode)) {
            //存储挂号号
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: ");
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            // 存储挂号医生与挂号科室
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            //挂号流水号与挂号次数
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        } else if ("-2".equals(rsCode)) {
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: " + serialNo );
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(response.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return res;
    }
    /**

+ 103 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -27,6 +27,7 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
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.PrescriptionDiagnosisDao;
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;
@ -124,7 +125,8 @@ public class YkyyEntranceService {
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
@ -1046,6 +1048,9 @@ public class YkyyEntranceService {
                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            //诊断
            synPrescriptionDiagnosis(prescriptionVO);
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO,code);
        }
@ -1054,6 +1059,103 @@ public class YkyyEntranceService {
    }
    /**
     * 诊断
     * @param wlyyPrescriptionVO
     */
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception{
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionVO.getId());
        for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs){
            //疾病诊断表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());
            String jsonString = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(saveUrl,params);
            if (response.getStatus()==200){
                logger.info("content"+response.getContent());
                logger.info("表hlwYsMzJbzdDO同步成功!");
            }
        }
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        hlwGhmxDO.setSBXH(0);
        hlwGhmxDO.setJZXH(1);
        hlwGhmxDO.setGHCS(1);
        hlwGhmxDO.setGHJE(0);
        hlwGhmxDO.setZLJE(0);
        hlwGhmxDO.setZJFY(0);
        hlwGhmxDO.setBLJE(0);
        hlwGhmxDO.setXJJE(0);
        hlwGhmxDO.setZPJE(0);
        hlwGhmxDO.setZHJE(0);
        hlwGhmxDO.setHBWC(0);
        hlwGhmxDO.setQTYS(0);
        hlwGhmxDO.setTHBZ(0);
        hlwGhmxDO.setCZPB(0);
        hlwGhmxDO.setMZLB(0);
        hlwGhmxDO.setYSLB(0);
        hlwGhmxDO.setsFFS(0);
        hlwGhmxDO.setJZZT(2);
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwGhmxDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }
        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){
            logger.info("content"+response.getContent());
            logger.info("表hlwGhmxDO同步成功!");
        }
        //就诊历史表HLWYS_MZ_JZLS
        HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
        hlwYsMzJzLsDO.setJZXH(0);
        hlwYsMzJzLsDO.setGHXH(0);
        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()));
        }
        String jsonString2 = JSONObject.toJSONString(hlwGhmxDO);
        Map<String,Object> params2 = new HashedMap();
        params2.put("json",jsonString);
        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同步成功!");
        }
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        logger.info("开始===================");

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwGhmxDO.java

@ -6,12 +6,12 @@ import javax.persistence.*;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 挂号明细表
 *
 * */
//@ApiModel(value = "HlwCf01VO", description = "眼科处方表1数据")
@Entity
@Table(name = "HLW_GHMX")
@Table(name = "v_hlw_ghmx")
public class HlwGhmxDO {
    private Integer sBXH;//NUMBER(18)N0识别序号

+ 2 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJbzdDO.java

@ -7,12 +7,11 @@ import javax.persistence.Table;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 疾病诊断表
 *
 * */
//@ApiModel(value = "HlwCf01VO", description = "眼科处方表1数据")
@Entity
@Table(name = "HLW_GHMX")
@Table(name = "v_hlwys_mz_jbzd")
public class HlwYsMzJbzdDO {
    private Integer jLBH;//N	NUMBER(18)	N			主键
    private Integer jZXH;//N	NUMBER(18)	N			就诊序号

+ 3 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJzLsDO.java

@ -6,11 +6,11 @@ import javax.persistence.*;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 就诊历史表
 *
 * */
@Entity
@Table(name = "v_ms_dd02")
@Table(name = "v_hlwys_mz_jzls")
public class HlwYsMzJzLsDO {
    private Integer jZXH;//NUMBER(18)N
    private Integer gHXH;//NUMBER(18)N
@ -93,6 +93,7 @@ public class HlwYsMzJzLsDO {
        this.zYZD = zYZD;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "KSSJ")
    public Date getKSSJ() {
        return kSSJ;

+ 43 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import com.yihu.jw.entity.hospital.prescription.HlwCf02DO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
@ -152,6 +151,48 @@ public class YkyyController extends EnvelopRestEndpoint {
            envelop.setObj(object1);
            hlwCf02VO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwCf02VO);
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'YS_MZ_JBZD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("jlbh",jlbh);
            envelop.setObj(object1);
            hlwYsMzJbzdDO.setJLBH(jlbh.intValue());
            ykyyEntranceService.save(hlwYsMzJbzdDO);
        }else if(table.equalsIgnoreCase("HlwGhmxDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwGhmxDO hlwGhmxDO =  JSONObject.toJavaObject(object,HlwGhmxDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_GHMX'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("sbxh",sbxh);
            envelop.setObj(object1);
            hlwGhmxDO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwGhmxDO);
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'YS_MZ_JZLS'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("jzxh",jzxh);
            envelop.setObj(object1);
            hlwYsMzJzLsDO.setJZXH(jzxh.intValue());
            ykyyEntranceService.save(hlwYsMzJzLsDO);
        }
        return envelop;

+ 2 - 24
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -1,10 +1,12 @@
package com.yihu.jw.hospital.endpoint.Xzyy;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -53,28 +55,6 @@ public class XzyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 挂号
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/registerOutPatient")
    @ApiOperation(value = "挂号", notes = "挂号")
    public ObjEnvelop registerOutPatient(@ApiParam(name = "outPatientId", value = "门诊id", required = true)
                                  @RequestParam(value = "outPatientId",required = true)String outPatientId,
                                  @ApiParam(name = "doctor", value = "医生code", required = true)
                                  @RequestParam(value = "doctor",required = true)String doctor,
                                  @ApiParam(name = "chargeType", value = "号别", required = true)
                                   @RequestParam(value = "chargeType",required = true)String chargeType)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.registerOutPatient(outPatientId,doctor,chargeType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 获取单条门诊就诊记录
     * @return
@ -93,8 +73,6 @@ public class XzyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 获取门诊下所有处方信息
     * @return

+ 15 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -85,6 +86,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public BasePatientDao basePatientDao;
	@Autowired
	private WxTemplateService wxTemplateService;
	@Autowired
	private XzyyPrescriptionService xzyyPrescriptionService;
	
	@Value("${wechat.id}")
	private String wxId;
@ -181,13 +184,21 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				if(!"xm_ykyy_wx".equals(wxId)){//中山医院-心脏中心需要挂号
					//1.调用挂号接口
					logger.info("调用挂号接口====START");
					net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
					
					String rsCode = (String)res.get("@RESULT");
					String rsCode = "";
					String mes = "";
					if("xm_xzzx_wx".equals(wxId)){ //心脏中心挂号
						JSONObject res = xzyyPrescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = res.getString("@RESULT");
						mes = res.getString("@MSG");
					}else {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){
						//挂号成功,已经挂号
					}else{
						String mes = (String)res.get("@MSG");
						failed(mes);
					}
					logger.info("调用挂号接口====END");