Procházet zdrojové kódy

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

# Conflicts:
#	common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
mengkang před 5 roky
rodič
revize
e5f7a80695
24 změnil soubory, kde provedl 744 přidání a 53 odebrání
  1. 7 0
      app/app-iot-server/pom.xml
  2. 19 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 56 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 235 11
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  5. 1 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  6. 0 1
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  7. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java
  8. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java
  9. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  10. 167 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotHospitalDO.java
  11. 13 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  12. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  13. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java
  14. 1 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  15. 27 4
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  16. 2 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java
  17. 6 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  18. 19 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  19. 69 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/HospitalController.java
  20. 9 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotHospitalDao.java
  21. 42 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java
  22. 16 14
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  23. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml
  24. 4 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

+ 7 - 0
app/app-iot-server/pom.xml

@ -157,6 +157,13 @@
            <artifactId>mime-util</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>
    <build>

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

@ -24,6 +24,7 @@ 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.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
@ -38,6 +39,7 @@ 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.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -163,6 +165,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Value("${demo.flag}")
@ -297,6 +301,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String condition = "";
        if("xm_ykyy_wx".equals(wechatId)){
            condition= "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\"," ;
        }else{
            condition=  "date_format(o.register_date ,'%Y-%m-%d %H:%i:%S' ) AS registerDate," ;
        }
        String sql ="SELECT " +
                " o.id AS \"id\", " +
                " o.adm_no AS \"admNo\", " +
@ -326,8 +336,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.disease_img AS \"diseaseImg\", " +
                " o.create_time AS \"createTime\", " +
                " o.status AS \"status\"," +
                " o.register_date AS \"registerDate\"," +
                " o.evaluate_status AS \"evaluateStatus\"" +
                condition+
              /*  " o.register_date AS \"registerDate\"," +*/
                " o.evaluate_status AS \"evaluateStatus\"," +
                " o.pay_status as \"payStatus\" "+
                " FROM " +
                " wlyy_outpatient o " +
@ -1784,12 +1795,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDO = new WlyyPrescriptionDO();
            prescriptionDO.setOutpatientId(outPatientId);
        }
        prescriptionDO.setType(1);
        prescriptionDO.setDept(outpatientDO.getDept());
        prescriptionDO.setCreateTime(new Date());
        prescriptionDO.setStatus(10);
        prescriptionDO.setPatientCode(outpatientDO.getPatient());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getOutpatientId());
            prescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        //========================处方操作结束=============================================================

+ 56 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -94,8 +94,6 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private static final Logger logger = LoggerFactory.getLogger(YkyyPrescriptionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
@ -119,8 +117,6 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private DoctorMappingService doctorMappingService;
@ -175,6 +171,25 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Value("${demo.flag}")
    private boolean demoFlag;
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @param startTime
     * @param endTime
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findHisPatNoByPatient(patient);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        return ykyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag);
    }
    /**
     * 发起图文和视频复诊
@ -371,6 +386,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            JSONObject object = new JSONObject();
            object.put("supply_code",map.get("pydm"));
            object.put("supply_name",map.get("xmmc"));
            object.put("ypyf",map.get("ypyf"));
            array.add(object);
        }
        return array;
@ -455,4 +471,40 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return array;
    }
    /**
     * 获取卡记录
     *  "PAT_NO": "P5616242-0  ",
     "CARD_NO": "D40136791",
     "CARD_STAT": "旧卡停用",
     "OP_DATE": "2011-09-27 15:35:57",
     "CARD_TYPE": "2",
     "CARD_TYPE_NAME": "社保卡",
     "social_no": "350211198411053024"
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard());
            JSONArray rs = new JSONArray();
            if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("PAT_NO",jsonObject.get("pat_no"));
                    jsonObject.put("CARD_NO",jsonObject.get("card_no"));
                    jsonObject.put("OP_DATE",jsonObject.get("op_date"));
                    jsonObject.put("CARD_STAT",jsonObject.get("card_stat"));
                    jsonObject.put("CARD_TYPE",jsonObject.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",jsonObject.get("card_type_name"));
                }
            }
            return rs;
        }
        return null;
    }
}

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

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

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -106,7 +106,7 @@ public class WechatInfoService {
                    JsApiTicket newJsApiTicket = new JsApiTicket();
                    newJsApiTicket.setJsapi_ticket(ticket);
                    newJsApiTicket.setExpires_in(Long.parseLong(expires_in));
                    if("xm_zsyy_wx".equals(wxId)){
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
                        newJsApiTicket.setAcc_id(wxId);
                    }else{
                        newJsApiTicket.setAcc_id(wxWechat.getAppOriginId());

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

@ -710,7 +710,6 @@ public class ImUtil {
	 *获取所有会话未读消息数。
	 * @param userid
	 * @param type
	 * @param status
	 * @return
	 */
	public Integer SessionsUnreadMessageCount(String userid,Integer type){

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java

@ -63,6 +63,7 @@ public class HlwCf01DO {
    private Integer fKZT;//	NUMBER(1)	Y	0		0 未付款  1付款
    private String sPGH;//	VARCHAR2(10)	Y			审批工号
    private String gUID;//
    private Integer sJLY;//1互联网
    @Basic
    @Id
@ -558,4 +559,13 @@ public class HlwCf01DO {
    public void setGUID(String gUID) {
        this.gUID = gUID;
    }
    @Column(name = "SJLY")
    public Integer getSJLY() {
        return sJLY;
    }
    public void setSJLY(Integer sJLY) {
        this.sJLY = sJLY;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java

@ -11,7 +11,7 @@ import java.util.Date;
 * */
@Entity
@Table(name = "HLW_CF02")
@SequenceGenerator(name="id_generated", sequenceName="HLW_CF02_SEQ")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_HLW_CF02")
public class HlwCf02DO {
    private Integer sBXH;//NUMBER(18)   N注释
    private Integer cFSB;//NUMBER(18)   N识别序号

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -147,6 +147,11 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
     */
    private Integer packQuantity;
    /**
     * 用法id
     */
    private Integer ypyf;
    @Column(name = "prescription_id")
    public String getPrescriptionId() {
@ -370,4 +375,13 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
    @Column(name = "ypyf")
    public Integer getYpyf() {
        return ypyf;
    }
    public void setYpyf(Integer ypyf) {
        this.ypyf = ypyf;
    }
}

+ 167 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotHospitalDO.java

@ -0,0 +1,167 @@
package com.yihu.jw.entity.iot.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author humingfen on 2020/4/27.
 */
@Entity
@Table(name = "iot_hospital")
public class IotHospitalDO extends UuidIdentityEntity {
    @Column(name = "saas_id")
    private String saasId;
    // 医院名稱
    private String name;
    // 作废标志,1有效 0 失效
    private String del;
    //省份标志
    private String province;
    //省份名称
    @Column(name = "province_name")
    private String provinceName;
    //城市标志
    private String city;
    //城市名称
    @Column(name = "city_name")
    private String cityName;
    //区县标志
    private String town;
    //区县名称
    @Column(name = "town_name")
    private String townName;
    //级别,1医院,2社区医院
    private int level;
    //医院等级
    private int grade;
    //医院详细地址
    private String address;
    //医院简介
    private String intro;
    //医院图片
    private String photo;
    private String phone;//联系方式
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public int getLevel() {
        return level;
    }
    public void setLevel(int level) {
        this.level = level;
    }
    public int getGrade() {
        return grade;
    }
    public void setGrade(int grade) {
        this.grade = grade;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getIntro() {
        return intro;
    }
    public void setIntro(String intro) {
        this.intro = intro;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 13 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -23,6 +23,7 @@ public class IotRequestMapping {
        public static final String wlyy = api_iot_common + "/wlyy";
        public static final String figereLabel = api_iot_common + "/figereLabel";
        public static final String platform = api_iot_common + "/platform";
        public static final String hospital = api_iot_common + "/hospital";
        public static final String message_success_update = "update success";
@ -65,7 +66,6 @@ public class IotRequestMapping {
     */
    public static class Company{
        public static final String findCompanyPage = "findCompanyPage";
        public static final String conditionQueryPage = "conditionQueryPage";
        public static final String addCompany = "addCompany";
        public static final String findCompanyById = "findCompanyById";
        public static final String findByBusinessLicense = "findByBusinessLicense";
@ -302,4 +302,16 @@ public class IotRequestMapping {
    }
    /**
     * 单位模块常量
     */
    public static class Hospital{
        public static final String getListByName = "getListByName";
        public static final String create = "createHospital";
        public static final String delete = "deleteHospital";
        public static final String message_success_find = "hospital find success";
        public static final String message_success_create = "hospital create success";
        public static final String message_success_delete = "hospital delete success";
    }
}

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

@ -149,6 +149,9 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "药房包装", example = "药房包装")
    private Integer packQuantity;
    @ApiModelProperty(value = "给药途径", example = "给药途径")
    private Integer ypyf;
    private String comm;
@ -349,4 +352,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
    public Integer getYpyf() {
        return ypyf;
    }
    public void setYpyf(Integer ypyf) {
        this.ypyf = ypyf;
    }
}

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java

@ -1,10 +1,12 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
/**
@ -40,6 +42,9 @@ public class SpecialistTeamVO {
    private String hospitalName;
    @ApiModelProperty("医生团队成员")
    private List<AdminTeamMemberVO> members;
    @ApiModelProperty("签约时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date signDate;
    public String getPatient() {
@ -145,4 +150,13 @@ public class SpecialistTeamVO {
    public void setMembers(List<AdminTeamMemberVO> members) {
        this.members = members;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSignDate() {
        return signDate;
    }
    public void setSignDate(Date signDate) {
        this.signDate = signDate;
    }
}

+ 1 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -215,7 +215,7 @@ public class BasicZuulFilter extends ZuulFilter {
    private static boolean sqlValidate(String str) {
        str = str.toLowerCase();//统一转为小写,比较简单的单词加入右边空格,避免单词中包含字段
        String badStr = "and |exec |execute |insert |select |delete |update |drop |*|chr |mid |master |truncate |" +
        String badStr = "and |exec |execute |insert |select |delete |update |drop |chr |mid |master |truncate |" +
                "declare | sitename |net user|xp_cmdshell|or |exec |execute |create |" +
                "table |from |grant |use |group_concat|column_name|" +
                "information_schema.columns|table_schema|union |where |select |update |order |by |like |" +

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

@ -11,8 +11,10 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.web.Envelop;
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.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -47,6 +49,8 @@ public class YkyyController extends EnvelopRestEndpoint {
    
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
@ -63,16 +67,35 @@ public class YkyyController extends EnvelopRestEndpoint {
    @GetMapping(value = "/save")
    @ApiOperation(value = "视图统一查询")
    public Envelop save(@ApiParam(name = "json", value = "json", required = true)
    @ApiOperation(value = "保存01和02表")
    public ObjEnvelop save(@ApiParam(name = "json", value = "json", required = true)
                                      @RequestParam(value = "json",required = true)String json,
                        @ApiParam(name = "table", value = "table", required = true)
                           @ApiParam(name = "table", value = "table", required = true)
                        @RequestParam(value = "table",required = true)String table) throws IOException {
        Envelop envelop = new Envelop();
        ObjEnvelop envelop = new ObjEnvelop();
        JSONObject object = JSONObject.parseObject(json);
        if (table.equalsIgnoreCase("HLW_CF01")){
            HlwCf01DO hlwCf01VO =  JSONObject.toJavaObject(object,HlwCf01DO.class);
            String cfsbSql =" select dqz + 1 as total  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01'";
            String cfhmSql="select dqz + 1 as total  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01_CFHM'";
            List<Map<String,Object>> cfsbList = hibenateUtils.createSQLQuery(cfsbSql);
            List<Map<String,Object>> cfhmList = hibenateUtils.createSQLQuery(cfhmSql);
            Long cfsb = 0L;
            Long cfhm = 0L;
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
            }
            hlwCf01VO.setCFSB(cfsb.intValue());
            hlwCf01VO.setCFHM(cfhm+"");
            JSONObject object1 = new JSONObject();
            object1.put("cfsb",cfsb);
            object1.put("cfhm",cfhm);
            ykyyEntranceService.save(hlwCf01VO);
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwCf02DO hlwCf01VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            ykyyEntranceService.save(hlwCf01VO);

+ 2 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java

@ -7,6 +7,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.wechat.service.WxTemplateService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 *
 * @author yeshijie.
 */
@DisallowConcurrentExecution
public class UnSettledHISPrescriptionJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UnSettledHISPrescriptionJob.class);

+ 6 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -244,14 +244,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }else{
            return success("该身份证无法找到医生",-1);
        }
        //专家咨询
        if("412821198807284025".equals(doctorIdcard)){//测试用写死的数据
            result.put("zxCount",2);//咨询数量
            result.put("fzCount",4);//图文复诊数量
        }else{
            result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));//咨询数量
            result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        }
    
        //医生咨询
        Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor.getId(),1);
        result.put("zxCount",unreadMessageCount);//咨询数量
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        return success("请求成功",result);
    }

+ 19 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -78,6 +78,18 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @Value("${demo.flag}")
    private boolean demoFlag;
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                                          @RequestParam(value = "patient",required = false) String patient,
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
        return success(vos);
    }
    @PostMapping(value = BaseHospitalRequestMapping.YkyyPrescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
@ -146,4 +158,11 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
    }
}

+ 69 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/HospitalController.java

@ -0,0 +1,69 @@
package com.yihu.iot.controller.dict;
import com.yihu.iot.service.dict.IotHospitalService;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(IotRequestMapping.Common.hospital)
@Api(tags = "单位管理相关操作", description = "单位管理相关操作")
public class HospitalController extends EnvelopRestEndpoint {
    @Autowired
    private IotHospitalService hospitalService;
    @PostMapping(value = IotRequestMapping.Hospital.create)
    @ApiOperation(value = "创建编辑单位字典")
    public MixEnvelop create(
            @ApiParam(name = "jsonData", value = "设备体征字典json数据")
            @RequestParam(value = "jsonData", required = false) String jsonData){
        try {
            IotHospitalDO hospitalDO = toEntity(jsonData, IotHospitalDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, hospitalService.create(hospitalDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Hospital.getListByName)
    @ApiOperation(value = "获取机构单位列表接口")
    public MixEnvelop getListByName(
            @ApiParam(name = "name", value = "机构名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "page", value = "当前页,从1开始")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "页面大小")
            @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            List<IotHospitalDO> hospitalDOList = hospitalService.getListByName(name, page, pageSize);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find, hospitalDOList);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Hospital.delete)
    @ApiOperation(value = "删除单位字典")
    public MixEnvelop delete(
            @ApiParam(name = "id", value = "单位id")
            @RequestParam(value = "id", required = true) String id){
        try {
            hospitalService.delete(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 9 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotHospitalDao.java

@ -0,0 +1,9 @@
package com.yihu.iot.dao.dict;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotHospitalDao extends PagingAndSortingRepository<IotHospitalDO, String>,
        JpaSpecificationExecutor<IotHospitalDO> {
}

+ 42 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java

@ -0,0 +1,42 @@
package com.yihu.iot.service.dict;
import com.yihu.iot.dao.dict.IotHospitalDao;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author humingfen on 2020/4/27.
 */
@Service
public class IotHospitalService extends BaseJpaService<IotHospitalDO, IotHospitalDao> {
    @Autowired
    private IotHospitalDao hospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public IotHospitalDO create(IotHospitalDO hospitalDO) {
        hospitalDO.setSaasId(getCode());
        hospitalDO.setDel("1");
        hospitalDao.save(hospitalDO);
        return hospitalDO;
    }
    public List<IotHospitalDO> getListByName(String name, Integer page, Integer pageSize) {
        String sql = "SELECT * FROM `iot_hospital` h WHERE h.del = 1 ";
        if(StringUtils.isNotBlank(name)){
            sql += "and h.name like '%" + name + "%' ";
        }
        if(page != null && pageSize != null){
            sql += "limit " + (page-1)*pageSize + "," + pageSize;
        }
        List<IotHospitalDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(IotHospitalDO.class));
        return list;
    }
}

+ 16 - 14
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -45,22 +45,24 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
        String value = dictDO.getValue();
        String parentCode = dictDO.getParentCode();
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getCode())){
        if(StringUtils.isNotBlank(dictDO.getCode())) {
            dictDO = iotSystemDictDao.findByDictNameAndCodeAndDel(dictDO.getDictName(), dictDO.getCode(), 1);
            dictDO.setValue(value);
            dictDO.setParentCode(parentCode);
            dictDO.setUpdateTime(new Date());
        }else {
            //获取最近一条添加记录的code
            List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
            if(dictDOList.size() > 0){
                dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
            }else {
                dictDO.setCode("1");
            if (StringUtils.isNotBlank(dictDO.getId())) {
                dictDO.setValue(value);
                dictDO.setParentCode(parentCode);
                dictDO.setUpdateTime(new Date());
            } else {
                //获取最近一条添加记录的code
                List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
                if (dictDOList.size() > 0) {
                    dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
                } else {
                    dictDO.setCode("1");
                }
                dictDO.setSaasId(getCode());
                dictDO.setDel(1);
                dictDO.setCreateTime(new Date());
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,3 +1,3 @@
spring:
  application:
    name: svr-iot  #注册到发现服务的id 如果id一样 eurika会自动做负载
    name: svr-iot-shw #注册到发现服务的id 如果id一样 eurika会自动做负载

+ 4 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -607,16 +607,16 @@ public class SpecialistService{
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.team_code, " +
                " r.team_code,r.sign_date , " +
                " t.`name` AS name," +
                " d.photo," +
                " md.code AS doctor," +
                " md.name AS doctorName" +
                " d.code AS doctor," +
                " d.name AS doctorName,d.hospital,d.hospital_name " +
                " FROM " +
                " wlyy_specialist_patient_relation r  " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN "+basedb+".wlyy_doctor d ON t.leader_code = d.`code` " +
                " JOIN "+basedb+".wlyy_doctor md ON md.code = r.doctor " +
//                " JOIN "+basedb+".wlyy_doctor md ON md.code = r.doctor " +
                " WHERE " +
                " r.patient = '"+patient+"' " +
                " AND r.`status` >=0  " +