Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

mengkang 5 lat temu
rodzic
commit
a2861ba917
26 zmienionych plików z 872 dodań i 118 usunięć
  1. 0 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/DoctorZsInfoDao.java
  3. 123 21
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 147 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  5. 92 0
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java
  6. 191 28
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  7. 22 3
      business/base-service/src/main/java/com/yihu/jw/wlyy/wlyyhttp/WlyyHttpService.java
  8. 0 1
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  9. 0 12
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  10. 13 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  11. 8 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  12. 5 0
      gateway/ag-basic/pom.xml
  13. 98 4
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  14. 7 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  15. 12 4
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DataUploadJob.java
  16. 15 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/QuartzHelper.java
  17. 8 3
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  18. 15 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/BaseController.java
  19. 62 18
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  20. 1 1
      svr/svr-internet-hospital-job/src/main/resources/bootstrap.yml
  21. 2 0
      svr/svr-internet-hospital-job/src/main/resources/quartz.properties
  22. 2 2
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  23. 5 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  24. 0 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/SystemMessageController.java
  25. 39 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  26. 1 1
      svr/svr-internet-hospital/src/main/resources/bootstrap.yml

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java

@ -30,7 +30,6 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
     * @throws Exception
     */
    public SystemMessageDO addMessage(SystemMessageDO systemMessageDO) throws Exception{
        systemMessageDO.setHandleState("0");
        systemMessageDO.setIsRead("0");
        systemMessageDO.setDel("1");
        systemMessageDO.setCreateTime((new Date()));

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/DoctorZsInfoDao.java

@ -4,8 +4,12 @@ import com.yihu.jw.entity.hospital.doctor.BaseDoctorZsInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/16.
 */
public interface DoctorZsInfoDao extends PagingAndSortingRepository<BaseDoctorZsInfoDO, String>, JpaSpecificationExecutor<BaseDoctorZsInfoDO> {
    List<BaseDoctorZsInfoDO> findByIdNumber(String idNumber);
}

+ 123 - 21
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -20,6 +20,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
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.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
@ -32,6 +33,7 @@ import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
@ -47,6 +49,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
@ -145,7 +148,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    
    @Autowired
    private SystemMessageService systemMessageService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -197,14 +202,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String admNo,boolean demoFlag)throws Exception{
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" admNo:"+admNo);
        return entranceService.BS16017(registerSn,null,patNo,admNo,demoFlag);
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        return entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag);
    }
    /**
@ -243,17 +248,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"' AND o.outpatient_type != '2' ";
                " o.patient = ? AND o.outpatient_type != '2' ";
        List<Object> totalParams = new ArrayList<>();
        totalParams.add(patient);
        if(status!=null){
            totalSql +=  " AND o.status = "+status;
            totalSql +=  " AND o.status = ? ";
            totalParams.add(status);
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
            totalSql += " AND create_time >= ? ";
            totalParams.add(startTime+" 00:00:00");
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <='"+endTime+" 23:59:59' ";
            totalSql += " AND create_time <= ? ";
            totalParams.add(endTime+" 23:59:59");
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray());
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
@ -291,18 +301,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"'";
                " o.patient = ? ";
        List<Object> params = new ArrayList<>();
        params.add(patient);
        if(status!=null){
            sql +=  " AND o.status = "+status;
            sql +=  " AND o.status = ? ";
            params.add(status);
        }
        if(StringUtils.isNotBlank(startTime)){
            sql += " AND o.create_time >='"+startTime+" 00:00:00'";
            sql += " AND o.create_time >= ? ";
            params.add(startTime+" 00:00:00");
        }
        if(StringUtils.isNotBlank(endTime)){
            sql += " AND o.create_time <='"+endTime+" 23:59:59'";
            sql += " AND o.create_time <= ? ";
            params.add(endTime+" 23:59:59");
        }
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class));
        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class),params.toArray());
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
@ -606,7 +622,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        //是否是有协同门诊医生
        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
        if(StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())){
            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
@ -697,6 +713,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                prescriptionDao.save(wlyyPrescriptionDO);
            }
            //发送取药系统消息
            sendPatientGetDrugMes(outpatientDO,wlyyPrescriptionDO);
        }
        return true;
    }
    public Boolean sendPatientGetDrugMes(WlyyOutpatientDO outpatient,WlyyPrescriptionDO prescriptionDO){
        try{
            SystemMessageDO systemMessageDO = new SystemMessageDO();
            systemMessageDO.setTitle("患者取药");
            systemMessageDO.setType("7");
            systemMessageDO.setReceiver(outpatient.getDoctor());
            systemMessageDO.setReceiverName(outpatient.getDoctorName());
            systemMessageDO.setRelationCode(outpatient.getId());
            systemMessageDO.setSender(outpatient.getPatient());
            systemMessageDO.setSenderName(outpatient.getPatientName());
            systemMessageDO.setRelationCode(outpatient.getId());
            JSONObject data = new JSONObject();
            data.put("name",outpatient.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("recipeType",prescriptionDO.getDispensaryType());
            data.put("message","患者已完成取药");
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        }catch (Exception e){
            logger.error("sendPatientGetDrugMes :"+e.toString());
            return false;
        }
        return true;
    }
@ -3051,9 +3099,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 获取正在进行中的视频复诊/协同门诊
     * @param doctor
     * @param general_doctor
     * @return
     */
    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor) {
    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor,String general_doctor) {
        String sql ="SELECT " +
                "room.outpatient_id AS id," +
                "room.patient_id AS patient_id," +
@ -3079,9 +3128,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND consult.relation_code=outpatient.id " +
                "AND consult.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.consult_type= 2";
                "AND consult.status = 0 ";
        if(StringUtils.isNoneBlank(doctor)){
            sql = sql +"AND room.doctor='"+doctor+"' " +
                    "AND room.consult_type= 2";
        }else if(StringUtils.isNoneBlank(general_doctor)){
            sql = sql +"AND room.general_doctor='"+general_doctor+"' " +
                    "AND room.consult_type= 2";
        }else{}
        
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
@ -3135,7 +3190,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND outpatient.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null " +
                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time DESC ";
                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -3431,9 +3486,56 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //3.创建候诊室
        createRoom(outpatient,chargeType);
        //4.发送协同门诊系统消息
        sendOutPatientMes(outpatient);
        return outpatient;
    }
    /**
     * 发送新增门诊信息
     * @param outpatient
     * @return
     */
    public Boolean sendOutPatientMes(WlyyOutpatientDO outpatient){
        try{
            SystemMessageDO systemMessageDO = new SystemMessageDO();
            //1.在线复诊2.协同门诊
            if("2".equals(outpatient.getOutpatientType())){
                systemMessageDO.setTitle("协同门诊");
                systemMessageDO.setType("3");
            }else{
                //1.图文 2.视频
                if("1".equals(outpatient.getType())){
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                }else {
                    systemMessageDO.setTitle("视频复诊");
                    systemMessageDO.setType("2");
                }
            }
            systemMessageDO.setReceiver(outpatient.getDoctor());
            systemMessageDO.setReceiverName(outpatient.getDoctorName());
            systemMessageDO.setRelationCode(outpatient.getId());
            systemMessageDO.setSender(outpatient.getPatient());
            systemMessageDO.setSenderName(outpatient.getPatientName());
            systemMessageDO.setRelationCode(outpatient.getId());
            JSONObject data = new JSONObject();
            data.put("name",outpatient.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question",outpatient.getDescription());
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        }catch (Exception e){
            logger.error("sendOutPatientMes :"+e.toString());
            return false;
        }
        return true;
    }
    /**
     * 指定门诊医生医生
     * @param outpatientJson
@ -3529,7 +3631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        String salt = UUID.randomUUID().toString().substring(0,5);
                        String mobile = biz.getString("mobile_phone");
                        String pw = idcard.substring(mobile.length()-6);
                        String pw = mobile.substring(mobile.length()-6);
                        patient.setIdcard(idcard);
                        patient.setName(biz.getString("user_name"));

+ 147 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -226,7 +226,20 @@ public class EntranceService {
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
        }
        return ConvertUtil.convertListEnvelopByString(resp);
        //剔除非激活的卡
        JSONArray res = ConvertUtil.convertListEnvelopByString(resp);
        if(res!=null&&res.size()>0){
            Iterator it = res.iterator();
            if(it.hasNext()){
                net.sf.json.JSONObject rs = (net.sf.json.JSONObject) it.next();
                String stat = rs.getString("CARD_STAT");
                if(!"激活".equals(stat)){
                    it.remove();
                }
            }
        }
        return res;
    }
    /**
@ -376,7 +389,7 @@ public class EntranceService {
                sbs.append("<query compy=\"=\" item=\"REGISTER_SN\" splice=\"and\" value=\"'" + REGISTER_SN + "'\"/>");
            }
            if (StringUtils.isNotBlank(realOrder)) {
                sbs.append("<query compy=\"=\" item=\"real_order\" splice=\"and\" value=\"'" + realOrder + "'\"/>");
                sbs.append("<query compy=\"=\" item=\"DISP_NO\" splice=\"and\" value=\"'" + realOrder + "'\"/>");
            }
            if (StringUtils.isNotBlank(PAT_NO)) {
                sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + PAT_NO + "'\"/>");
@ -387,7 +400,7 @@ public class EntranceService {
            //查询信息结束
            sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            logger.info("resp "+resp);
//            logger.info("resp "+resp);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
        }
@ -453,6 +466,7 @@ public class EntranceService {
        }
        //发药时间
        String dispDate = null != jsonObjectBody.get("DISP_DATE") ? jsonObjectBody.get("DISP_DATE").toString() : "";
        if(StringUtils.isNotBlank(dispDate)){
            //根据处方号获取处方
            WlyyPrescriptionDO wlyyPrescriptionDO=prescriptionDao.findByRealOrder(realOrder);
@ -2138,4 +2152,134 @@ public class EntranceService {
        }
        return ConvertUtil.convertListEnvelopInBodyRow(resp);
    }
    /**
     * 同步医生信息
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public int sysDoctorInfo(String docIdCard,boolean demoFlag) throws Exception {
        int i = 0;
        String fid = "MS02003";
        String resp = "";
        if (demoFlag) {
            resp = getJosnFileResullt(fid);
            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
        } else {
            StringBuffer sbs = new StringBuffer();
            //AccessControl :用户、密码、服务id
            sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>" + mqUser + "</UserName><Password>" + mqPwd + "</Password></AccessControl>");
            //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
            //查询信息拼接
            sbs.append("<MsgInfo><endNum>10000</endNum><Msg></Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
        }
        net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(resp);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    jsonObjectMgsInfo=(JSONArray)jsonArraySub.get("body");
                    if(jsonObjectMgsInfo instanceof JSONArray){
                        for (Object objectSub : jsonObjectMgsInfo) {
                            net.sf.json.JSONObject jsonObjectBody = (net.sf.json.JSONObject) objectSub;
                            String doctorCode = "";
                            String doctorName = "";
                            if (null != jsonObjectBody) {
                                //获取中山医院的医生
                                String winNo = "6";
                                doctorCode = null == jsonObjectBody.get("Emp_Code") ? "" : jsonObjectBody.get("Emp_Code").toString();
                                //根据医生及分部,获取医生号别
                                net.sf.json.JSONArray jsonArrayCharge = BS55010(winNo, doctorCode, null, false);
                                String chareType=null;
                                if(null!=jsonArrayCharge){
                                    for (Object objectCharge : jsonArrayCharge) {
                                        net.sf.json.JSONObject jsonObjectBodyCharge = (net.sf.json.JSONObject) objectCharge;
                                        if (null != jsonObjectBodyCharge) {
                                            chareType = null == jsonObjectBodyCharge.get("charge_type") ? null : jsonObjectBodyCharge.get("charge_type").toString();
                                        }
                                    }
                                }
                                //保存医生信息
                                BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
                                String idCard = null == jsonObjectBody.get("Card_Id") ? "" : jsonObjectBody.get("Card_Id").toString();
                                //同步单条信息
                                if(docIdCard.equals(idCard)){
                                    baseDoctorDO.setIdcard(idCard);
                                    baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
                                    baseDoctorDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard(idCard)));
                                    baseDoctorDO.setLocked(0);
                                    baseDoctorDO.setEnabled(1);
                                    //拼音码
                                    baseDoctorDO.setSpell(null == jsonObjectBody.get("PinYin_Code") ? "" : jsonObjectBody.get("PinYin_Code").toString());
                                    String disableFlag = null == jsonObjectBody.get("Disable_Flag") ? "" : jsonObjectBody.get("Disable_Flag").toString();
                                    //互联网医院:1停用,0使用  转 i健康:1正常,0作废
                                    baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
                                    //姓名
                                    doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
                                    //号别
                                    baseDoctorDO.setChargeType(chareType);
                                    if (StringUtils.isNotBlank(idCard)) {
                                        baseDoctorDO.setSalt(PwdUtil.randomString(5));
                                        try {
                                            baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length()-6) + "{" + baseDoctorDO.getSalt() + "}"));
                                        } catch (Exception e) {
                                            logger.error(e.getMessage()+"docotr="+doctorCode+";idcard="+baseDoctorDO.getIdcard());
                                        }
                                    }else {
                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456"+ "{" + baseDoctorDO.getSalt() + "}"));
                                    }
                                    baseDoctorDO.setName(doctorName);
                                    baseDoctorDO.setIsFamous(0);
                                    baseDoctorDO.setCreateTime(new Date());
                                    baseDoctorDO.setUpdateTime(new Date());
                                    baseDoctorDO.setMobile("0");
                                    baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
                                    //根据医生和机构判断数据是否存在,若不存在则在mapping中追加记录
                                    List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByDoctorAndOrgCode(baseDoctorDO.getId(), "350211A1002");
                                    if (!(null != doctorMappingDOS && doctorMappingDOS.size() > 0)) {
                                        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
                                        doctorMappingDO.setDoctor(baseDoctorDO.getId());
                                        doctorMappingDO.setDoctorName(doctorName);
                                        doctorMappingDO.setMappingCode(doctorCode);
                                        doctorMappingDO.setMappingName(doctorName);
                                        doctorMappingDO.setOrgCode("350211A1002");
                                        doctorMappingDO.setOrgName("厦门大学附属中山医院");
                                        doctorMappingDao.save(doctorMappingDO);
                                    }
                                    // 用医生和机构id、部门判断数据是否存在,若不存在则保存医生机构关联关系
                                    String deptCode = null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString();
                                    List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode("350211A1002", deptCode, baseDoctorDO.getId());
                                    if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) {
                                        BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                                        baseDoctorHospitalDO.setOrgCode("350211A1002");
                                        baseDoctorHospitalDO.setOrgName("厦门大学附属中山医院");
                                        baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                                        baseDoctorHospitalDO.setDeptCode(deptCode);
                                        //根据机构编码获取机构名称
                                        List<DictHospitalDeptDO>  dictHospitalDeptDOS=  dictHospitalDeptDao.findByOrgCodeAndCode("350211A1002",deptCode);
                                        if(null!=dictHospitalDeptDOS&&dictHospitalDeptDOS.size()>0){
                                            DictHospitalDeptDO dictHospitalDeptDO=dictHospitalDeptDOS.get(0);
                                            baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                                        }
                                        baseDoctorHospitalDO.setDel("1");
                                        baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                                    }
                                    i++;
                                }
                            }
                        }
                    }
                }
            }}
        return i;
    }
}

+ 92 - 0
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java

@ -1083,159 +1083,214 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            case "0":
                res[0] = "1";
                res[1] = "预防保健科";
                break;
            case "1120000":
                res[0] = "1";
                res[1] = "预防保健科";
                break;
            case "1170000":
                res[0] = "1";
                res[1] = "预防保健科";
                break;
            case "3160000":
                res[0] = "1";
                res[1] = "预防保健科";
                break;
            case "1310000":
                res[0] = "2";
                res[1] = "全科医疗科";
                break;
            case "1000001":
                res[0] = "3";
                res[1] = "内科";
                break;
            case "1010000":
                res[0] = "3";
                res[1] = "内科";
                break;
            case "1010200":
                res[0] = "3.01";
                res[1] = "呼吸内科专业";
                break;
            case "1010100":
                res[0] = "3.02";
                res[1] = "消化内科专业";
                break;
            case "1140000":
                res[0] = "3.03";
                res[1] = "神经内科专业";
                break;
            case "1400000":
                res[0] = "3.04";
                res[1] = "心血管内科专业";
                break;
            case "1410000":
                res[0] = "3.04";
                res[1] = "心血管内科专业";
                break;
            case "1210000":
                res[0] = "3.05";
                res[1] = "血液内科专业";
                break;
            case "1010300":
                res[0] = "3.06";
                res[1] = "肾病学专业";
                break;
            case "1220000":
                res[0] = "3.07";
                res[1] = "内分泌专业";
                break;
            case "1010400":
                res[0] = "3.08";
                res[1] = "免疫学专业";
                break;
            case "1020000":
                res[0] = "4";
                res[1] = "外科";
                break;
            case "1020200":
                res[0] = "4";
                res[1] = "外科";
                break;
            case "1260000":
                res[0] = "4";
                res[1] = "外科";
                break;
            case "1520000":
                res[0] = "4";
                res[1] = "外科";
                break;
            case "1020100":
                res[0] = "4.01";
                res[1] = "普通外科专业";
                break;
            case "1150000":
                res[0] = "4.02";
                res[1] = "神经外科专业";
                break;
            case "1030000":
                res[0] = "4.03";
                res[1] = "骨科专业";
                break;
            case "1031000":
                res[0] = "4.03";
                res[1] = "骨科专业";
                break;
            case "1032000":
                res[0] = "4.03";
                res[1] = "骨科专业";
                break;
            case "1033000":
                res[0] = "4.03";
                res[1] = "骨科专业";
                break;
            case "1020300":
                res[0] = "4.04";
                res[1] = "泌尿外科专业";
                break;
            case "1020400":
                res[0] = "4.05";
                res[1] = "胸外科专业";
                break;
            case "1250000":
                res[0] = "4.06";
                res[1] = "心脏大血管外科专业";
                break;
            case "1300000":
                res[0] = "4.06";
                res[1] = "心脏大血管外科专业";
                break;
            case "1040000":
                res[0] = "5";
                res[1] = "妇产科";
                break;
            case "1050000":
                res[0] = "7";
                res[1] = "儿科";
                break;
            case "1510000":
                res[0] = "8";
                res[1] = "小儿外科";
                break;
            case "1090000":
                res[0] = "10";
                res[1] = "眼科";
                break;
            case "1100000":
                res[0] = "11";
                res[1] = "耳鼻咽喉科";
                break;
            case "1110000":
                res[0] = "12";
                res[1] = "口腔科";
                break;
            case "1160000":
                res[0] = "13";
                res[1] = "皮肤科";
                break;
            case "1230000":
                res[0] = "14";
                res[1] = "医疗美容科";
                break;
            case "1000002":
                res[0] = "15";
                res[1] = "精神科";
                break;
            case "3150000":
                res[0] = "16";
                res[1] = "传染科";
                break;
            case "1200000":
                res[0] = "19";
                res[1] = "肿瘤科";
                break;
            case "1190006":
                res[0] = "20";
                res[1] = "急诊医学科";
                break;
            case "1190007":
                res[0] = "20";
                res[1] = "急诊医学科";
                break;
            case "1280000":
                res[0] = "21";
                res[1] = "康复医学科";
                break;
            case "1130100":
                res[0] = "26";
                res[1] = "麻醉科";
                break;
            case "1130400":
                res[0] = "27";
                res[1] = "疼痛科";
                break;
            case "1400400":
                res[0] = "28";
                res[1] = "重症医学科";
                break;
            case "2070000":
                res[0] = "31";
                res[1] = "病理科";
                break;
            case "1020600":
                res[0] = "32.09";
                res[1] = "介入放射学专业";
                break;
            case "1240000":
                res[0] = "32.1";
                res[1] = "放射治疗专业";
                break;
            case "1080000":
                res[0] = "50";
                res[1] = "中医科";
                break;
            case "1060000":
                res[0] = "50.12";
                res[1] = "老年病科专业";
                break;
            default:
                res[0] = "1";
                res[1] = "预防保健科";
        }
        return  res;
    }
@ -1246,12 +1301,18 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        switch (status) {
            case "-1":
                res = "0";
                break;
            case "0":
                res = "1";
                break;
            case "1":
                res = "1";
                break;
            case "2":
                res = "1";
                break;
            default:
                res = "";
        }
        return res;
    }
@ -1290,96 +1351,127 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            case "1303":
                res[0] = "243";
                res[1] = "主管药师";
                break;
            case "1304":
                res[0] = "243";
                res[1] = "主管药师";
                break;
            case "1101":
                res[0] = "231";
                res[1] = "主任医师";
                break;
            case "065":
                res[0] = "231";
                res[1] = "主任医师";
                break;
            case "1201":
                res[0] = "232";
                res[1] = "副主任医师";
                break;
            case "067":
                res[0] = "232";
                res[1] = "副主任医师";
                break;
            case "1301":
                res[0] = "233";
                res[1] = "主治医师";
                break;
            case "066":
                res[0] = "233";
                res[1] = "主治医师";
                break;
            case "1310":
                res[0] = "233";
                res[1] = "主治医师";
                break;
            case "1401":
                res[0] = "234";
                res[1] = "医师";
                break;
            case "061":
                res[0] = "234";
                res[1] = "医师";
                break;
            case "1501":
                res[0] = "235";
                res[1] = "医士";
                break;
            case "1103":
                res[0] = "241";
                res[1] = "主任药师";
                break;
            case "1104":
                res[0] = "241";
                res[1] = "主任药师";
                break;
            case "1203":
                res[0] = "242";
                res[1] = "副主任药师";
                break;
            case "1403":
                res[0] = "244";
                res[1] = "药师";
                break;
            case "1404":
                res[0] = "244";
                res[1] = "药师";
                break;
            case "1503":
                res[0] = "245";
                res[1] = "药士";
                break;
            case "1102":
                res[0] = "251";
                res[1] = "主任护师";
                break;
            case "1204":
                res[0] = "252";
                res[1] = "副主护师";
                break;
            case "1302":
                res[0] = "253";
                res[1] = "主管护师";
                break;
            case "1402":
                res[0] = "254";
                res[1] = "护师";
                break;
            case "1502":
                res[0] = "255";
                res[1] = "护士";
                break;
            case "1107":
                res[0] = "261";
                res[1] = "主任技师";
                break;
            case "1207":
                res[0] = "262";
                res[1] = "副主任技师";
                break;
            case "1307":
                res[0] = "263";
                res[1] = "主管技师";
                break;
            case "056":
                res[0] = "263";
                res[1] = "主管技师";
                break;
            case "1407":
                res[0] = "264";
                res[1] = "技师";
                break;
            case "006":
                res[0] = "264";
                res[1] = "技师";
                break;
            case "053":
                res[0] = "264";
                res[1] = "技师";
                break;
            case "1202":
                res[0] = "252";
                res[1] = "副主护师";
                break;
            default:
                res[0] = "0";
                res[1] = "未知";

+ 191 - 28
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -1,5 +1,6 @@
package com.yihu.jw.wlyy.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,19 +11,16 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by Trick on 2019/8/21.
@ -85,7 +83,7 @@ public class WlyyBusinessService {
            param.put("title","协同门诊消息");
            param.put("type",500);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyySendMes",param);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyySendMes",param,null);
            if(rs!=null){
                return true;
            }
@ -108,7 +106,7 @@ public class WlyyBusinessService {
            param.put("type",500);
            param.put("relationCode",outPatientId);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyReadMes",param);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyReadMes",param,null);
            if(rs!=null){
                return true;
            }
@ -126,39 +124,204 @@ public class WlyyBusinessService {
        JSONObject param = new JSONObject();
        param.put("idCard",idCard);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyCheckSignFamily",param);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyCheckSignFamily",param,null);
        if(rs!=null){
            return true;
        }
        return false;
    }
    
    public String getPatientCodeByWlyyIdcard(String idcard) {
    /**
     * 根据身份证获取i健康居民信息
     * @param idcard
     * @return
     */
    public String getPatientCodeByWlyyIdcard(String idcard) throws Exception {
        BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
        String result = "";
        if(patientDO == null){
            /**
             * todo 调用i健康接口获取居民信息
             */
    
            Map<String,String> params = new HashMap<>();
            params.put("idcard",idcard);
    
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient",null,params);
            if(rs!=null){
                Integer status = rs.getInteger("status");
                if(200 == status){
                    JSONObject data = rs.getJSONObject("data");
                    BasePatientDO patient = new BasePatientDO();
                    String salt = UUID.randomUUID().toString().substring(0,5);
                    String mobile = data.getString("mobile");
                    String pw = null;
    
                    if(StringUtils.isNotBlank(mobile)){
                        pw = mobile.substring(mobile.length()-6);
                    }else{
                        pw = idcard.substring(idcard.length()-6);
                    }
    
                    patient.setIdcard(idcard);
                    patient.setName(data.getString("name"));
                    patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                    patient.setSalt(salt);
                    patient.setMobile(mobile);
                    patient.setDel("1");
                    patient.setEnabled(1);
                    patient.setLocked(0);
                    patient.setCreateTime(new Date());
                    patient.setUpdateTime(new Date());
                    patient.setBirthday(DateUtil.strToDate(data.getString("birthday"),"yyyyMMdd"));
                    patient = basePatientDao.save(patient);
                    result = patient.getId();
                }else{
                    throw new Exception("请求i健康接口,获取居民信息失败");
                }
            }
        }else{
            result =  patientDO.getId();
        }
        return result;
    }
    
    
    /**
     * (健康咨询)转发消息
     * @param senderIdcard
     * @param reciverIdcard
     * @param messageids
     * @param title
     * @param sessionType
     * @return
     * @throws Exception
     */
    public Boolean wlyyMessageForward(String senderIdcard, String reciverIdcard, String messageids, String title, String sessionType) throws Exception {
    
        Map<String,String> params = new HashMap<>();
        params.put("senderIdcard",senderIdcard);
        params.put("reciverIdcard",reciverIdcard);
        params.put("messageids",messageids);
        params.put("title",title);
        params.put("sessionType",sessionType);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyMessageForward",null,params);
        if(rs!=null){
            Integer status = rs.getInteger("status");
            if(200 == status){
                return true;
            }else{
                return false;
            }
        }
        return false;
    }
    
    /**
     * 根据居民CODE换取居民请求秘钥
     * @param patientId
     * @return
     * @throws Exception
     */
    public String wlyyGetPatientAccetokenByIdcard(String patientId) throws Exception {
        
        String idcard = "";
        String result = "";
        BasePatientDO basePatientDO = basePatientDao.findById(patientId);
        if(basePatientDO != null){
            idcard = basePatientDO.getIdcard();
    
            Map<String,String> params = new HashMap<>();
            params.put("idcard",idcard);
            
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
            if(rs!=null){
                Integer status = rs.getInteger("status");
                if(200 == status){
                    JSONObject data = rs.getJSONObject("data");
                    result = data.getString("patientCode");
                }else{
                    logger.info(rs.toJSONString());
                    throw new Exception("请求i健康接口失败");
                }
            }
        }else {
            throw new Exception("该居民不存在");
        }
        return result;
    }
    /**
     * 查询I健康接口获取居民信息
     */
    public Map<String,Object> findWlyyPatient(String idcard)throws Exception{
        JSONObject param = new JSONObject();
        param.put("idcard",idcard);
        JSONObject re = wlyyHttpService.sendWlyyMes("wlyyGetSignFamily",param,null);
        if(re!=null){
            JSONObject p = re.getJSONObject("data");
            BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
            if(patientDO == null){
                BasePatientDO patient = new BasePatientDO();
                String salt = UUID.randomUUID().toString().substring(0,5);
                String mobile = p.getString("mobile");
                String pw = mobile.substring(mobile.length()-6);
                patient.setIdcard(idcard);
                patient.setName(p.getString("name"));
                patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                patient.setSalt(salt);
                patient.setMobile(mobile);
                patient.setDel("1");
                patient.setEnabled(1);
                patient.setLocked(0);
                patient.setCreateTime(new Date());
                patient.setUpdateTime(new Date());
                patient.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                BasePatientDO temp = basePatientDao.save(patient);
                return getPatientInfoMap(temp);
            }
            return getPatientInfoMap(patientDO);
        }
        return patientDO.getId();
        return null;
    }
    public Map<String,Object> getPatientInfoMap(BasePatientDO basePatientDO){
        Map<String,Object> rs = new HashedMap();
        rs.put("id",basePatientDO.getId());
        rs.put("name",basePatientDO.getName());
        rs.put("sex",basePatientDO.getSex());
        rs.put("provinceCode",basePatientDO.getProvinceCode());
        rs.put("provinceName",basePatientDO.getProvinceName());
        rs.put("cityCode",basePatientDO.getCityCode());
        rs.put("cityName",basePatientDO.getCityName());
        rs.put("townCode",basePatientDO.getTownCode());
        rs.put("townName",basePatientDO.getTownName());
        rs.put("idcard",basePatientDO.getIdcard());
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile",basePatientDO.getMobile());
        return rs;
    }
    public JSONArray findPatientListBySscOrIdCard(String idcard,String ssc){
//    public String getPatientInfo(String ){
//        List<NameValuePair> params = new ArrayList<>();
//        params.add(new BasicNameValuePair("clientId", getClientId()));
//        ClientDetails clientDetails = clientDetailsService.loadClientByClientId(getClientId());
//        params.add(new BasicNameValuePair("clientSecret", clientDetails.getClientSecret()));
//        params.add(new BasicNameValuePair("code", username));
//        params.add(new BasicNameValuePair("openid", getOpenid()));
//        String res = null;
//        try{
//            res = httpClientUtil.post(getSynPath(getWechatId()), params, "UTF-8");
//        }catch (Exception e){
//            logger.error("远程请求i健康用户信息异常:" + e.getMessage());
//            return users;
//        }
//    }
        Map<String,String> mapParams = new HashedMap();
        if(StringUtils.isNotBlank(idcard)){
            mapParams.put("idcard",idcard);
        }
        if(StringUtils.isNotBlank(ssc)){
            mapParams.put("ssc",ssc);
        }
        JSONObject re = wlyyHttpService.sendWlyyMes("findPatientListBySscOrIdCard",null,mapParams);
        JSONArray list =null;
        if(re!=null){
            list = re.getJSONArray("data");
            return list;
        }
        return null;
    }
}

+ 22 - 3
business/base-service/src/main/java/com/yihu/jw/wlyy/wlyyhttp/WlyyHttpService.java

@ -32,7 +32,13 @@ public class WlyyHttpService {
    @Autowired
    private HttpClientUtil httpClientUtil;
    public JSONObject sendWlyyMes(String configId,JSONObject param) {
    /**
     * @param configId 配置ID
     * @param param key为param,的参数
     * @param mapParams map形式的传参
     * @return
     */
    public JSONObject sendWlyyMes(String configId,JSONObject param,Map<String,String> mapParams) {
        try{
@ -50,13 +56,26 @@ public class WlyyHttpService {
            if (status == 10000) {
                //设置入参
                List<NameValuePair> p = new ArrayList<>();
                p.add(new BasicNameValuePair("param", param.toJSONString()));
                //组装key为param的入参
                if(param != null){
                    p.add(new BasicNameValuePair("param", param.toJSONString()));
                }
                //组装map形式的传参
                if(mapParams!= null && !mapParams.keySet().isEmpty()){
                    for (String paramkey:mapParams.keySet()){
                        p.add(new BasicNameValuePair(paramkey, mapParams.get(paramkey)));
                    }
                }
                //设置头部
                token = rsjson.getJSONObject("result").getString("accesstoken");
                Map<String,Object> headerMap = new HashedMap();
                headerMap.put("accesstoken",token);
                logger.info("sendWlyyMes url :"+oauthWlyyConfigDO.getUrl());
                String rs = httpClientUtil.headerPost(oauthWlyyConfigDO.getUrl(),p,"UTF-8",headerMap);
                logger.info("sendWlyyMes headerPost :"+rs);

+ 0 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1604,7 +1604,6 @@ public class ImService {
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		return result;
	}
	

+ 0 - 12
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -53,10 +53,6 @@ public class SystemMessageDO extends UuidIdentityEntity {
     *是否已读
     */
    private String isRead;
    /**
     *业务处理状态
     */
    private String handleState;
    /**
     *是否删除
     */
@ -144,14 +140,6 @@ public class SystemMessageDO extends UuidIdentityEntity {
        this.isRead = isRead;
    }
    @Column(name = "handle_state")
    public String getHandleState() {
        return handleState;
    }
    public void setHandleState(String handleState) {
        this.handleState = handleState;
    }
    @Column(name = "del")
    public String getDel() {
        return del;

+ 13 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -265,7 +265,15 @@ public class BaseHospitalRequestMapping {
         */
        public static final String readWlyyOutpatientMes = "/readWlyyOutpatientMes";
        /**
         * 厦门I健康签约信息接口
         */
        public static final String findWlyyPatient = "/findWlyyPatient";
        /**
         *  厦门I健康获取居民身份证
         */
        public static final String findPatientListBySscOrIdCard = "/findPatientListBySscOrIdCard";
        //=================end=======================================
        /**
@ -321,6 +329,10 @@ public class BaseHospitalRequestMapping {
        public static final String getDoctorIntroduction ="/getDoctorIntroduction";
        public static final String findByDict ="/findByDict";
    
    
        //根据居民CODE换取居民请求秘钥
        public static final String getPatientAccetokenByIdcard="getPatientAccetokenByIdcard";
    }
@ -485,6 +497,7 @@ public class BaseHospitalRequestMapping {
    
        //医生端:医生提醒居民上线
        public static final String alertPatientOnline="alertPatientOnline";
    }
    /**

+ 8 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java

@ -319,4 +319,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setPostCount(String postCount) {
        this.postCount = postCount;
    }
    public String getComm() {
        return comm;
    }
    public void setComm(String comm) {
        this.comm = comm;
    }
}

+ 5 - 0
gateway/ag-basic/pom.xml

@ -113,6 +113,11 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>
    </dependencies>
    <build>

Plik diff jest za duży
+ 98 - 4
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java


+ 7 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -543,5 +543,12 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return success(obj);
    }
    @GetMapping(value = "/sysDoctorInfo")
    @ApiOperation(value = "单个同步医生")
    public ObjEnvelop sysDoctorInfo(
            @ApiParam(name = "idcard", value = "医生同步")
            @RequestParam(value = "idcard",defaultValue = "") String idcard) throws Exception {
        return success(entranceService.sysDoctorInfo(idcard,demoFlag));
    }
    //==================预约挂号end================
}

+ 12 - 4
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DataUploadJob.java

@ -21,17 +21,18 @@ public class DataUploadJob implements Job {
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========DataUploadJob========");
        try {
            //1、获取 JOB 执行区间  执行时间点的前一天  时间点定在每天的 00:00:00 执行,同步前一天的数据
            String endDate = DateUtil.dateToStrLong(DateUtil.getNow());
            String startDate = DateUtil.dateToStrLong(DateUtil.getPreDays(DateUtil.getNow(),1));
            //1、获取 JOB 执行区间  执行时间点的前一天  时间点定在每天的 02:00:00 执行,同步前一天的数据
            String endDate = DateUtil.dateToStr(DateUtil.getNow(),"yyyy-MM-dd")+" 00:00:00";
            String startDate = DateUtil.dateToStr(DateUtil.getPreDays(DateUtil.getNow(),-1),"yyyy-MM-dd")+" 00:00:00";
            String res = "";
            // 2、分步执行需要JOB执行的服务
            //2、分步执行需要JOB执行的服务
            logger.info("START========2.5 网上预约挂号上传开始========");
            try {
                res = internetService.upAppointmentOnline(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.5 网上预约挂号上传结束========" + res);
@ -42,6 +43,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upMedicalOnline(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.6 网上医技预约上传结束========" + res);
@ -52,6 +54,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upNsDoctorScore(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.7 医生评价信息结束========" + res);
@ -62,6 +65,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upNsOnlineAsk(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.8 网络咨询服务信息结束========" + res);
@ -72,6 +76,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upNsOnlineMed(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.9 网络诊疗服务信息========" + res);
@ -82,6 +87,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upPrescription(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.10 电子处方表结束========" + res);
@ -92,6 +98,7 @@ public class DataUploadJob implements Job {
            try {
                res = internetService.upPrescriptionDrug(startDate,endDate,null);
            }catch (Exception e){
                e.printStackTrace();
                logger.error(e.toString());
            }
            logger.info("END==========2.11 电子处方_药品明细表结束 ========" + res);
@ -103,4 +110,5 @@ public class DataUploadJob implements Job {
            logger.error("END===ERROE===DataUploadJob,message:"+e.getMessage());
        }
    }
}

+ 15 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/QuartzHelper.java

@ -1,5 +1,6 @@
package com.yihu.jw.job;
import org.apache.commons.collections.map.HashedMap;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@ -7,6 +8,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
@ -28,6 +31,15 @@ public class QuartzHelper {
        }
    }
    public Map<String,Object> getCalendar()throws Exception{
        Map<String,Object> rs = new HashedMap();
        rs.put("JobGroupNames ",scheduler.getJobGroupNames());
        rs.put("SchedulerName ",scheduler.getSchedulerName());
        rs.put("TriggerGroups ",scheduler.getPausedTriggerGroups());
        return rs;
    }
    public void addJob(Class jobClass, String cronString, String jobKey,
                       Map<String, Object> params) throws Exception {
        if (!CronExpression.isValidExpression(cronString)) {
@ -55,7 +67,9 @@ public class QuartzHelper {
    public void removeJob(String jobKeyString) throws Exception {
        TriggerKey triggerKey = new TriggerKey("trigger-name:" + jobKeyString,
                "trigger-group:" + jobKeyString);
        JobKey jobName = new JobKey("job-group:" + jobKeyString, "job-id:"
//        JobKey jobName = new JobKey("job-group:" + jobKeyString, "job-id:"
//                + jobKeyString);
        JobKey jobName = new JobKey("job-id:" + jobKeyString, "job-group:"
                + jobKeyString);
        scheduler.pauseTrigger(triggerKey);// 停止触发器
        scheduler.unscheduleJob(triggerKey);// 移除触发器

+ 8 - 3
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -82,7 +82,7 @@ public class PrescriptionStatusUpdateService {
            Map<String, Object> params = new HashMap<>();
            params.put("registerSn", null);
            params.put("patNo", patientMappingCode);
            params.put("admNo", admNo);
//            params.put("admNo", admNo);
            params.put("realOrder", realOrder);
            //判断处方是否存在
            boolean preExistFlag = true;
@ -279,10 +279,15 @@ public class PrescriptionStatusUpdateService {
                    //结束门诊
                    outpatientDO.setStatus("2");
    
                    //TODO:结束咨询
                    String consultCode = imService.getConsultCodeByOutpatientId(outpatientDO.getId());
                    if(StringUtils.isNoneBlank(consultCode)){
                        imService.finish(consultCode,"admin",2);
                        try {
                            imService.finish(consultCode,"admin",2);
                        }catch(Exception e)  {
                            e.printStackTrace();
                            logger.info("自动结束咨询报错 consultCode: "+consultCode);
                        }
                       
                    }
                }
                outpatientDao.save(outpatientDOs);

+ 15 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/BaseController.java

@ -1,6 +1,7 @@
package com.yihu.jw.web;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -553,4 +554,18 @@ public class BaseController {
        return simplifiedBean;
    }
    protected <J> ObjEnvelop<J> success(J obj){
        return success("success", obj);
    }
    protected <J> ObjEnvelop<J> success(String message, J obj){
        return success(message, 200, obj);
    }
    protected <J> ObjEnvelop<J> success(String message, int status, J obj){
        ObjEnvelop<J> objEnvelop = new ObjEnvelop<>();
        objEnvelop.setMessage(message);
        objEnvelop.setStatus(status);
        objEnvelop.setObj(obj);
        return objEnvelop;
    }
}

+ 62 - 18
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -4,12 +4,13 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.internet.service.DataGeneratorService;
import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.job.PrescriptionOverdueJob;
import com.yihu.jw.job.PrescriptionStatusUpdateJob;
import com.yihu.jw.job.QuartzHelper;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@ -52,31 +54,73 @@ public class JobController extends BaseController {
        this.quartzHelper = quartzHelper;
    }
    /**
     * 启动任务
     *
     * @param id id
     * @return
     */
    @RequestMapping(value = "startNowById", method = RequestMethod.GET)
    public String startNowById(String id) {
        try {
            jobService.startNowById(id);
            return success("启动成功!");
    @RequestMapping(value = "removeJob", method = RequestMethod.GET)
    public String removeJob(String taskId) {
        try {
            if(quartzHelper.isExistJob(taskId)){
                quartzHelper.removeJob(taskId);
                return success("删除成功!");
            }
            return success("删除成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
            return invalidUserException(e, -1, "删除失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "getCalendar", method = RequestMethod.GET)
    public ObjEnvelop getCalendar() throws Exception{
       return success(quartzHelper.getCalendar());
    }
    @RequestMapping(value = "isExist", method = RequestMethod.GET)
    public String isExist(String id) {
    public String isExist(String taskId) {
        try {
            if(quartzHelper.isExistJob(id)){
                return success("启动成功!");
            if(quartzHelper.isExistJob(taskId)){
                return success("job已经存在!");
            }
            return success("启动失败!");
            return success("job不存在!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "执行失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "reStartById", method = RequestMethod.GET)
    public String reStartById(String taskId) {
        try {
            if(quartzHelper.isExistJob(taskId)){
                quartzHelper.removeJob(taskId);
            }
            switch(taskId){
                case "prescription_overdue_job":
                    if (!quartzHelper.isExistJob("prescription_overdue_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_overdue_job");
                        quartzHelper.addJob(PrescriptionOverdueJob.class, trigger, "prescription_overdue_job", new HashMap<String, Object>());
                        logger.info("prescription_overdue_job  job success");
                    } else {
                        logger.info("prescription_overdue_job  job exist");
                    }
                    break;
                case "data_upload_job" :
                    //互联网医院 监管平台上报
                    if (!quartzHelper.isExistJob("data_upload_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("data_upload_job");
                        quartzHelper.addJob(DataUploadJob.class, trigger, "data_upload_job", new HashMap<String, Object>());
                        logger.info("data_upload_job  job success");
                    } else {
                        logger.info("data_upload_job  job exist");
                    }
                    break;
                default :
            }
            return success("启动成功!");
        } catch (Exception e) {
            error(e);

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-internet-hospital-job
    name: svr-internet-hospital-job-yx
  cloud:
    config:
      failFast: true

+ 2 - 0
svr/svr-internet-hospital-job/src/main/resources/quartz.properties

@ -14,6 +14,8 @@ org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
#是否集群
org.quartz.jobStore.isClustered=false
 
#============================================================================
# Configure JobStore

+ 2 - 2
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -5,8 +5,8 @@ prescriptionStatus_update_job=0 */2 * * * ?
# 门诊记录过期job,每天1 点触发
prescription_overdue_job=0 0 1 * * ?
#每天1 点触发
data_upload_job=0 0 2 * * ?
#每天13 点触发
data_upload_job=0 0 13 * * ?
#data_upload_25_job=0 0 1 * * ?
#

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

@ -248,8 +248,10 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "获取正在进行中的视频复诊/协同门诊", notes = "获取正在进行中的视频复诊/协同门诊")
	public ListEnvelop getVideoPrescriptionByDoctor(
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor)throws Exception{
		return success("请求成功",prescriptionService.getVideoPrescriptionByDoctor(doctor));
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "general_doctor", value = "全科医生CODE")
			@RequestParam(value = "general_doctor",required = false) String general_doctor)throws Exception{
		return success("请求成功",prescriptionService.getVideoPrescriptionByDoctor(doctor,general_doctor));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getWaitingForVisitVideoPrescriptionByDoctor)
@ -699,10 +701,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                              @ApiParam(name = "sessionType", value = "原会话的会话类型", defaultValue = "")
	                              @RequestParam(value = "sessionType", required = true) String sessionType
	) throws Exception {
		/**
		 * todo 请求i健康接口发送转发的聊天消息
		 */
		return success("请求成功");
		return success("转发成功",wlyyBusinessService.wlyyMessageForward(senderIdcard,reciverIdcard,messageids,title,sessionType));
	}
	
}

+ 0 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/SystemMessageController.java

@ -90,7 +90,6 @@ public class SystemMessageController extends EnvelopRestEndpoint {
        List<SystemMessageDO> list  = systemMessageService.search(fields,filters,sorts,page,pageSize);
        int count = (int) systemMessageService.getCount(filters);
        return success(list, count, page, pageSize, SystemMessageDO.class);
    }

+ 39 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -23,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@ -83,15 +84,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
    @ApiOperation(value = "门诊下所有处方信息")
    public ListEnvelop findOriginPrescriptionList(
            @ApiParam(name = "registerSn", value = "流水号", required = false)
            @RequestParam(value = "registerSn",required = true) String registerSn,
            @ApiParam(name = "patNo", value = "病人id", required = false)
            @RequestParam(value = "patNo",required = true) String patNo,
            @ApiParam(name = "admNo", value = "住院唯一号", required = false)
            @RequestParam(value = "admNo",required = true) String admNo,
            @ApiParam(name = "realOrder", value = "处方号", required = false)
            @ApiParam(name = "registerSn", value = "流水号")
            @RequestParam(value = "registerSn",required = false) String registerSn,
            @ApiParam(name = "patNo", value = "病人id")
            @RequestParam(value = "patNo",required = false) String patNo,
            @ApiParam(name = "admNo", value = "住院唯一号")
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, admNo, demoFlag);
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        return success(obj);
    }
@ -751,4 +752,34 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "hospital", required = true)String hospital) {
        return success(prescriptionService.findByDict(name,hospital));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatientAccetokenByIdcard)
    @ApiOperation(value = "根据居民CODE换取居民请求秘钥")
    public Envelop getPatientAccetokenByIdcard(@ApiParam(name = "patientCode", value = "居民CODE")
                                       @RequestParam(value = "patientCode",required = true) String patientCode)throws Exception{
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWlyyPatient)
    @ApiOperation(value = "获取居民信息")
    public Envelop findWlyyPatient(@ApiParam(name = "idcard", value = "idcard")
                                               @RequestParam(value = "idcard",required = true) String idcard)throws Exception{
        return success(wlyyBusinessService.findWlyyPatient(idcard));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientListBySscOrIdCard)
    @ApiOperation(value = "获取居民身份证信息")
    public Envelop findPatientListBySscOrIdCard(@ApiParam(name = "idcard", value = "idcard")
                                                @RequestParam(value = "idcard",required = false) String idcard,
                                                @ApiParam(name = "ssc", value = "社保卡")
                                                @RequestParam(value = "ssc",required = false) String ssc)throws Exception{
        if(StringUtils.isNotBlank(idcard)&&idcard.length()>=6){
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(idcard,null));
        }
        if(StringUtils.isNotBlank(ssc)&&ssc.length()>=6){
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(null,ssc));
        }
        return failed("身份证或医保卡格式有误");
    }
}

+ 1 - 1
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-internet-hospital
    name:  svr-internet-hospital
  cloud:
    config:
      failFast: true