Bladeren bron

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

huangwenjie 4 jaren geleden
bovenliggende
commit
da666753e2
40 gewijzigde bestanden met toevoegingen van 1093 en 668 verwijderingen
  1. 20 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/DictDeptDescDao.java
  2. 258 178
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  4. 59 1
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  5. 100 3
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  6. 4 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java
  7. 1 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  8. 54 2
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  9. 14 6
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  10. 45 18
      common/common-entity-es/src/main/java/com/yihu/jw/datainput/DataBodySignsDO.java
  11. 80 0
      common/common-entity-es/src/main/java/com/yihu/jw/datainput/MeasureData.java
  12. 37 0
      common/common-entity-es/src/main/java/com/yihu/jw/datainput/PositionData.java
  13. 1 5
      common/common-entity/pom.xml
  14. 63 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictDeptDescDO.java
  15. 15 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  16. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  17. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  18. 14 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  19. 1 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  20. 10 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyScreenResultVo.java
  21. 3 3
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  22. 11 0
      svr/svr-internet-hospital/pom.xml
  23. 7 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  24. 75 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  25. 3 28
      svr/svr-iot-job/pom.xml
  26. 0 96
      svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/IotDeviceSimService.java
  27. 1 40
      svr/svr-iot-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  28. 1 141
      svr/svr-iot-job/src/main/resources/application.yml
  29. 1 1
      svr/svr-iot-job/src/main/resources/bootstrap.yml
  30. 51 49
      svr/svr-iot/sql-scripts/body_health_data_es.txt
  31. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  32. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java
  33. 13 25
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java
  34. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java
  35. 9 0
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/RowKeyUtils.java
  36. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/model/BaseResultModel.java
  37. 91 49
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java
  38. 11 3
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java
  39. 10 0
      svr/svr-wlyy-health-bank/pom.xml
  40. 7 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java

+ 20 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/DictDeptDescDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.DictDeptDescDO;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/18
 */
public interface DictDeptDescDao extends PagingAndSortingRepository<DictDeptDescDO, String>, JpaSpecificationExecutor<DictDeptDescDO> {
    DictDeptDescDO findByDeptCodeAndOrgCode(String deptCode,String orgCode);
    List<DictDeptDescDO> findByOrgCode(String orgCode);
}

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

@ -2,11 +2,13 @@ package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorPatientDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictDeptDescDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
@ -58,6 +60,8 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
@ -236,6 +240,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private DictDeptDescDao dictDeptDescDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -682,7 +689,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyPrescriptionDO findPrescriptionDo(String prescriptionId){
        return prescriptionDao.findOne(prescriptionId);
    }
    
    public Map<String,Object> findPrescriptionInfo(String prescriptionId){
        //续方信息
        Map<String,Object> rs = new HashedMap();
@ -746,7 +753,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        Double price = 0.0;
        if(doctorDO!=null&&StringUtils.isNoneBlank(doctorDO.getFee())){
             price = Double.parseDouble(doctorDO.getFee());
            price = Double.parseDouble(doctorDO.getFee());
        }
        if(price==0.0){
            outpatientDO.setPayStatus(1);
@ -1036,6 +1043,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    /**
     * 获取医生列表.
     *
@ -2264,7 +2275,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if ("0".equals(rs)) {
            String admNo = jsonObject.getString("@ADM_NO");
            String realOrder = jsonObject.getString("@real_order");
            String voucherNo = jsonObject.getString("@xtgzh0");
            prescription.setAdmNo(admNo);
            prescription.setRealOrder(realOrder);
            prescriptionDao.save(prescription);
@ -2272,6 +2283,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            outpatientDao.save(outpatientDO);
            result.put("code", 1);
            result.put("voucherNo",voucherNo);
            result.put("mes", "开方提交成功");
            return result;
@ -2475,7 +2487,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql =sql+  "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql=sql+" e.name as \"name\", " +
        sql=sql+" e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
@ -3002,21 +3014,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            if(hospitalDOs!=null&&hospitalDOs.size()>0){
               rs.put("hospital",hospitalDOs.get(0));
               BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
               rs.put("winNo",org.getWinNo());
               rs.put("deptName",hospitalDOs.get(0).getDeptName());
               rs.put("dept",hospitalDOs.get(0).getDeptCode());
               if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
                  List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
                  rs.put("workTime",times);
               }
                rs.put("hospital",hospitalDOs.get(0));
                BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
                rs.put("winNo",org.getWinNo());
                rs.put("deptName",hospitalDOs.get(0).getDeptName());
                rs.put("dept",hospitalDOs.get(0).getDeptCode());
                if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
                    rs.put("workTime",times);
                }
            }else{
               rs.put("hospital",null);
               rs.put("winNo",null);
               rs.put("deptName",null);
               rs.put("dept",null);
                rs.put("hospital",null);
                rs.put("winNo",null);
                rs.put("deptName",null);
                rs.put("dept",null);
                rs.put("workTime",null);
            }
@ -3067,13 +3079,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //专家咨询
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
    
            if(zjList!=null&&zjList.size()>0){
                rs.put("zjCount",zjList.size());
            }else{
                rs.put("zjCount",0);
            }
    
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS \"score\"," +
@ -3084,9 +3096,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "AND b.doctor='"+doctor+"' " +
                    "GROUP BY a.score_type ORDER BY  a.score_type ASC ";
            List<Map<String,Object>> listscore = jdbcTemplate.queryForList(sqlscore);
    
            Double doctorScore = new Double("0");
    
            if(listscore!=null&&listscore.size()>0){
                for(Map<String,Object> _listscore :listscore){
                    doctorScore += Double.parseDouble(_listscore.get("score").toString());
@ -3094,13 +3106,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            doctorScore = doctorScore/3;
            rs.put("doctorScore",doctorScore);
    
            if(listscore!=null&&listscore.size()>0){
                rs.put("scoreDoctor",listscore);
            }else{
                rs.put("scoreDoctor",null);
            }
    
            //查询评价明细
            String sqlScoreList = "SELECT " +
                    "a.score as \"score\"," +
@ -3119,21 +3131,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='"+doctor+"' " +
                    "WHERE a.relation_code=b.id AND b.doctor='"+doctor+"' ";
            List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
    
            if(scoreList!=null&&scoreList.size()>0){
    
//                Set<String> datelist = new HashSet<>();
    
                HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
    
                if(scoreList!=null&&scoreList.size()>0){
                    for(Map<String,Object> scorepatient :scoreList){
                        String id = (String)scorepatient.get("id");
            
                        if(id == null){
                            continue;
                        }
                        
                        if(waitinglist.keySet().contains(id)){
                            waitinglist.get(id).add(scorepatient);
                        }else{
@ -3179,6 +3191,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                BaseOrgDO org = baseOrgDao.findByCode(orgCode);
                if (org!=null){
                    doctorHospitalDO.setWinNo(org.getWinNo());
                    doctorHospitalDO.setHisId(org.getHisId());
                    hospitalDOList.add(doctorHospitalDO);
                }
            }
@ -3230,7 +3243,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    
    /**
     * 居民取消复诊或者医生拒绝接诊
     * @param outPatientId
@ -3295,8 +3308,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String msg="";
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","9");
                   msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                   sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
                    msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                    sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","16");
@ -3488,7 +3501,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return times;
    }
    
    /**
     * 医生可接单列表(图文复诊、视频复诊、协同门诊)
     * @param doctor
@ -3498,7 +3511,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type,Integer query_status,String dept) {
        
        String sql ="SELECT " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
@ -3538,9 +3551,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //图文复诊医生抢单列表
                sql +=  "AND room.doctor IS NULL  ";
            }
            
        }
        
        //协同门诊
        if(3 == type){
            sql += " AND room.reservation_type=2 ";
@ -3548,13 +3561,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //在线复诊
            sql += " AND room.reservation_type=1 AND room.consult_type="+type ;
        }
        
        if(StringUtils.isNoneBlank(dept)){
            sql += " AND outpatient.dept='"+dept+"' ";
        }
        
        
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
@ -3563,12 +3576,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
            }
        }
        
        return list;
    }
    
    public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
        
        String sql ="SELECT " +
                "patient.id AS \"id\"," +
                "patient.name AS \"name\"," +
@ -3582,7 +3595,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_hospital_waiting_room waitingroom," +
                "base_patient patient " +
                "WHERE waitingroom.consult_type=2 AND doctor IS NOT NULL ";
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
@ -3591,12 +3604,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                roompatient.put("age",DateUtil.getAgeForIdcard(idcard));
            }
        }
        
        return list;
    }
    
    public JSONObject findWaitingRoomStatusCount(String dept,String wxId) {
        
        String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
        if("xm_ykyy_wx".equals(wxId)){
            totalSql +=" and reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
@ -3610,38 +3623,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        
        JSONObject result = new JSONObject();
        result.put("waiting_count",count);
        result.put("outpatient_count",count);
        result.put("waiting_count_difference",count);
        result.put("outpatient_count_difference",count);
        result.put("yesterday_waiting_count",count);
        
        return result;
    }
    
    public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status,String wxId) {
        if(StringUtils.isBlank(date)){
            date = DateUtil.getStringDateShort();
        }
        
        //获取今天的排班列表
        String doctorsql ="SELECT doctor AS \"doctor\",doctor_name as \"doctor_name\",dept as \"dept\",dept_name as \"dept_name\" FROM wlyy_doctor_work_time WHERE work_date='"+date+"'";
        
        if(StringUtils.isNoneBlank(dept)){
            doctorsql = doctorsql + " and dept = '"+dept+"' ";
        }
        doctorsql = doctorsql+ " GROUP BY doctor,doctor_name,dept,dept_name";
    
        List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
    
        HashMap<String ,JSONObject> result = new HashMap<>();
    
        for (int i = 0; i < doctorlist.size(); i++) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("id",(String)doctorlist.get(0).get("doctor"));
    
            if(StringUtils.isNoneBlank((String)doctorlist.get(0).get("doctor_name"))){
                jsonObject.put("doctor_name",(String)doctorlist.get(0).get("doctor_name"));
                jsonObject.put("dept_name",(String)doctorlist.get(0).get("dept_name"));
@ -3655,10 +3668,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("waiting_count",0);
            jsonObject.put("patient_name","");
            jsonObject.put("time_cost",0);
            
            result.put((String)doctorlist.get(0).get("doctor"),jsonObject);
        }
        
        //获取预约了今天的候诊居民
        String waitingSql ="SELECT count(op.id) AS \"waitCount\"," +
                "room.doctor AS \"doctor\", " +
@ -3703,7 +3716,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        //获取进行中的居民
        String onlineSql ="SELECT " +
                "room.outpatient_id AS \"id\"," +
@ -3719,7 +3732,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' )  AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
        }
                onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
        onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
@ -3772,7 +3785,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }else{
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id",doctor);
    
                        if(StringUtils.isNoneBlank((String) onlineObj.get("doctorName"))){
                            jsonObject.put("doctor_name",(String) onlineObj.get("doctorName"));
                        }else{
@ -3787,15 +3800,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        List<JSONObject> finalresult  = new ArrayList<>();
    
        for (JSONObject jsonObject : result.values()) {
            //离线:在线状态=离线
            //空闲:在线状态=在线 and 接诊状态=空闲
            //接诊中:在线状态=在线 and 接诊状态=接诊中
            
            //过滤空闲或者接诊中的居民
            if(StringUtils.isBlank(consult_status)){
                finalresult.add(jsonObject);
@ -3822,10 +3835,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("room_name",roomname);
            room_no ++;
        }
        
        return finalresult;
    }
    
    public WlyyDoctorClinicRoomDO findClinicRoomStatus(String id) {
        return wlyyDoctorClinicRoomDao.findOne(id);
    }
@ -3859,7 +3872,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return times;
    }
    
    /**
     * 根据疾病名称,热门部门查询医生
     * @param orgCode 机构码
@ -3884,7 +3897,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
    
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
@ -3966,28 +3979,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+=" AND sp.disease_name like :diseaseKey";
            params.put("diseaseKey","%"+diseaseKey+"%");
        }
    
        if(StringUtils.isNotBlank(doctorNameKey)){
            sql+=" AND d.name like :doctorNameKey";
            params.put("doctorNameKey","%"+doctorNameKey+"%");
        }
        
        if(StringUtils.isNotBlank(dept)){
            sql+=" AND h.dept_code = :dept ";
            params.put("dept",dept);
        }
    
        if(StringUtils.isNotBlank(jobTitleNameKey)){
            sql+=" AND d.job_title_name  = :jobTitleNameKey ";
            params.put("jobTitleNameKey",jobTitleNameKey);
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
            if(outpatientType.contains("or")){
                String[] outpatientTypeArray = outpatientType.split("or");
                sql+= " AND ( ";
            
                for (int i = 0; i < outpatientTypeArray.length; i++) {
                    sql +=" d.outpatient_type like'%"+outpatientTypeArray[i]+"%'";
                    if(i != outpatientTypeArray.length -1){
@ -4001,23 +4014,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql+=" AND d.outpatient_type is not null ";
        }
    
        if(StringUtils.isNotBlank(keyName)){
            sql+=" AND (h.dept_name like '%"+keyName+"%' or d.name like '%"+keyName+"%' or d.expertise like '%"+keyName+"%' )";
        }
    
        if(StringUtils.isNotBlank(workingTime)){
            sql+=" AND wk.work_date = :workingTime ";
            params.put("workingTime",workingTime);
        }
    
    
        if(StringUtils.isNotBlank(consultStatus)){
            sql+=" AND d.consult_status = :consultStatus ";
            params.put("consultStatus",consultStatus);
        }
    
        sql += " and d.del='1' order by a.total "+ consutlSort;
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pagesize);
@ -4098,7 +4111,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
            List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
            saveDoctorWorkTime(workTimeDOs,date,doctors);
        //科室
            //科室
        }else if("2".equals(type)){
            String sql ="SELECT " +
@ -4514,7 +4527,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    /**
     * 获取正在进行中的视频复诊/协同门诊
     * @param doctor
@ -4561,8 +4574,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            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){
            //根据身份证计算年龄
@ -4570,19 +4583,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String idcard = (String)outpatient.get("idcard");
                String patient_id = (String)outpatient.get("patient_id");
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
    
                String outpatient_id = (String)outpatient.get("id");
	
	            String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
	            if(StringUtils.isBlank(isAlert)){
		            outpatient.put("alert_tag",0);//已提醒
	            }else{
		            outpatient.put("alert_tag",1);//未提醒
	            }
                String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
                if(StringUtils.isBlank(isAlert)){
                    outpatient.put("alert_tag",0);//已提醒
                }else{
                    outpatient.put("alert_tag",1);//未提醒
                }
                outpatient.put("online_tag",1);//未提醒
            }
        }
    
        return list;
    }
@ -4643,7 +4656,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return waitCount.toString();
    }
    
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
@ -4691,20 +4704,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql+=" order by room.reservation_time ASC ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        
        Set<String> datelist = new HashSet<>();
        
        HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
        
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
            for(Map<String,Object> outpatient :list){
                String idcard = (String)outpatient.get("idcard");
                String patient_id = (String)outpatient.get("patient_id");
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
    
                String group_date = (String)outpatient.get("group_date");
                
                if(waitinglist.keySet().contains(group_date)){
                    waitinglist.get(group_date).add(outpatient);
                }else{
@ -4712,7 +4725,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    _cu.add(outpatient);
                    waitinglist.put(group_date,_cu);
                }
    
                //全科医生来源
                outpatient.put("general_doctor_info","");//全科医生名字
                outpatient.put("general_doctor_hospital","");//全科医生社区
@ -4722,24 +4735,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else{
                    outpatient.put("alert_tag",1);//未提醒
                }
                
                outpatient.put("online_tag",1);//在线状态
    
                String outpatient_mobile = (String)outpatient.get("outpatient_mobile");
                if(StringUtils.isNoneBlank(outpatient_mobile)){
                    outpatient.put("mobile",outpatient_mobile);//复诊有手机号,传递复诊手机号
                }
            }
        }
    
        Collection<String> keyset= waitinglist.keySet();
        List<String> _list = new ArrayList<String>(keyset);
    
        //对key键值按字典升序排序
        Collections.sort(_list);
        com.alibaba.fastjson.JSONArray result = new com.alibaba.fastjson.JSONArray();
    
    
        for (int i = 0; i < _list.size(); i++) {
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if(_list.get(i).equals(DateUtil.getStringDateShort())){
@ -4752,7 +4765,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return result;
    }
    
    /**
     * 医生抢单(视频)
     * @param outpatientCode
@ -4763,9 +4776,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
        if(roomDOs!=null&&roomDOs.size()>0){
            for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
                    roomDO.setDoctor(doctor);
                    roomDO.setDoctorName(baseDoctorDO.getName());
                    hospitalWaitingRoomDao.save(roomDO);
                roomDO.setDoctor(doctor);
                roomDO.setDoctorName(baseDoctorDO.getName());
                hospitalWaitingRoomDao.save(roomDO);
            }
        }
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
@ -4774,7 +4787,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDao.save(wlyyOutpatientDO);
    }
    
    /**
     * 复诊视频咨询人数, 协同门诊人数
     * @param doctor
@ -4782,8 +4795,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Long doctorIndexConsultCount(String doctor,String outpatient_type) {
    
    
        String sql ="SELECT " +
                "count(room.outpatient_id) AS total " +
                "FROM " +
@ -4802,19 +4815,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql = sql + " AND room.consult_type= 2 ";
        }else if("2".equals(outpatient_type)){
        }else{}
        
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
        Long videoOnlineCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            videoOnlineCount = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
    
        return videoOnlineCount;
        
    }
    
    
    /**
     * 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息
     * @param admNo 门诊唯一号
@ -4822,14 +4835,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Object getSFExpressInfo(String admNo,String realOrder,String wxId)throws Exception {
    
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,realOrder);
        
        Object result = "";
    
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null="+wlyyPrescriptionDOS != null);
        if(wlyyPrescriptionDOS != null){
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId",wlyyPrescriptionDOS.getOutpatientId());
@ -4862,19 +4875,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//                    }
                    //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
                        //请求顺丰接口下单,成功下单后,返回快递单号
                    //请求顺丰接口下单,成功下单后,返回快递单号
                    sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息:5");
                    //保存快递单号和增加处方物流记录为配送
                    sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息:6");
                    
                }
                
                if(sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())){
                    System.out.println("获取顺丰物流面单信息:7");
                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
    
                    sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "标准快递");
                    sfJsonObject.put("destcode", "592");
@ -4910,7 +4923,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        System.out.println("获取顺丰物流面单信息:9");
        return result;
    }
    
    /**
     * 根据类型获取候诊居民数量
     * @param doctor
@ -4948,12 +4961,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
        Long waitVideoCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
        }
    
        return waitVideoCount;
    }
@ -5486,10 +5499,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public com.alibaba.fastjson.JSONObject findWaitingRoomOutpatientNumberByDoctor(String doctor,String dept) {
    
        com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
        
    
        //总数
        String sqlAll = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5499,16 +5512,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> alltotal = jdbcTemplate.queryForList(sqlAll);
    
        Long totalsqlAll = 0l;
        if (alltotal != null && alltotal.size() > 0) {
            totalsqlAll = Long.parseLong(alltotal.get(0).get("total").toString());
        }
    
        object.put("all",totalsqlAll);
    
        //图文复诊
        String imgAll = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5518,16 +5531,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=1 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> imgtotal = jdbcTemplate.queryForList(imgAll);
    
        Long twCount = 0l;
        if (imgtotal != null && imgtotal.size() > 0) {
            twCount = Long.parseLong(imgtotal.get(0).get("total").toString());
        }
    
        object.put("twCount",twCount);
    
        //视频复诊
        String spsql = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5537,17 +5550,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=2 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> sptotal = jdbcTemplate.queryForList(spsql);
    
        Long spcount = 0l;
        if (sptotal != null && sptotal.size() > 0) {
            spcount = Long.parseLong(sptotal.get(0).get("total").toString());
        }
    
        object.put("spCount",spcount);
    
        
        //协同门诊
        String xtsql = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5557,21 +5570,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=2 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> xttotal = jdbcTemplate.queryForList(xtsql);
    
        Long xtcount = 0l;
        if (xttotal != null && xttotal.size() > 0) {
            xtcount = Long.parseLong(xttotal.get(0).get("total").toString());
        }
    
        object.put("xtCount",xtcount);
        
        
        return object;
    }
	
	public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
    public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
        Map<String,Object> rs = new HashedMap();
        //判断医生是否接诊
        List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
@ -5587,7 +5600,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
        wlyyOutpatientDO.setStatus("-1");
@ -5595,26 +5608,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        wlyyOutpatientDO.setDoctorCancelType(cancelType);
        wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
        outpatientDao.save(wlyyOutpatientDO);
        
        //删除门诊号源
        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
        if(list!=null&&list.size()>0){
            patientRegisterTimeDao.delete(list);
        }
        
        rs.put("code",1);
        rs.put("mes","取消成功");
        return  rs;
	}
    
    }
    /**
     * 获取居民当日就诊列表
     * @param patient
     * @return
     */
	public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
    public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
	    String condition = "";
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
            condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
        }else{
@ -5632,7 +5645,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
	}
    }
    /**
     * 获取doctormappingcode
@ -5679,10 +5692,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        ArchiveVO archiveVO = objectMapper.readValue(json,ArchiveVO.class);
        if(archiveVO!=null){
            if(StringUtils.isBlank(archiveVO.getBrnl00())){
               archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
                archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
            }
            if(StringUtils.isBlank(archiveVO.getCsrq00())){
               archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
                archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
            }
            //1为需要同步建档
            if("1".equals(type)){
@ -5739,7 +5752,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNotBlank(patient)){
            patientId = patientMappingService.findHisPatNoByPatient(patient);
        }
       return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
        return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
    }
    /**
@ -5845,7 +5858,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return list;
    }
    
    public void followOrgByPatient(String patientid, String doctorid, String type) {
        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(doctorid,patientid);
        if("1".equals(type)){//关注
@ -5864,9 +5877,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
    }
    
    public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
    
        String sql ="SELECT " +
                "dept.code AS \"deptCode\"," +
                "dept.name AS \"deptName\"," +
@ -5877,7 +5890,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "base_org org " +
                "WHERE org.CODE=dept.org_code " +
                "AND org.del=1 ";
        
        if(StringUtils.isNoneBlank(keyWord)){
            sql = sql + "AND dept.NAME LIKE '%"+keyWord+"%' ";
        }
@ -5950,10 +5963,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql +="\tp.status as \"status\",\n" +
                        "\tp.check_status as \"checkStatus\",\n" +
                        "\tp.check_reason as \"checkReason\",\n" +
                        "\tp.pay_type as \"payType\"\n" +
        sql +="\tp.status as \"status\",\n" +
                "\tp.check_status as \"checkStatus\",\n" +
                "\tp.check_reason as \"checkReason\",\n" +
                "\tp.pay_type as \"payType\"\n" +
                "FROM\n" +
                "\twlyy_prescription P\n" +
                "WHERE\n" +
@ -6106,7 +6119,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free  = prescriptionDO.getDrugFee()+"";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(),"yyyyMMddHHmmss");
                        String applyDepaName = prescriptionDO.getDeptName();
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
                        String applyDepaName = null;
                        if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                            applyDepaName = doctorHospitalDOS.get(0).getDeptName();
                        }
                        String voucherNo = map.get("voucherNo")+"";
                        String applyDoctorName = prescriptionDO.getDoctorName();
                        BasePatientDO patientDO = basePatientDao.findById(patientCode);
                        String userName = null;
@ -6121,10 +6139,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            userNo = patientMappingDO.getMappingCode();
                        }
                        String cardNo = null;
                        if (!StringUtils.isNoneBlank(outpatientDO.getCardNo())){
                        if (StringUtils.isNoneBlank(outpatientDO.getCardNo())){
                            cardNo = outpatientDO.getCardNo();
                        }
                        ylzPayService.msgPush("01",cardNo,"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                        logger.info("cardNo:"+cardNo);
                        ylzPayService.msgPush("01",cardNo,"01",patientDO.getMobile(),"00",userNo,userName,idcard,voucherNo,applyDepaName,applyDoctorName,recipeTime,free,"1");
                    }
                    //sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
@ -6138,6 +6157,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(20);
            wlyyPrescriptionDO.setPrescribeTime(new Date());
            wlyyPrescriptionDO.setId(prescriptionId);
            //发送系统消息 处方支付提醒
            SystemMessageDO messageDO = new SystemMessageDO();
@ -6168,6 +6188,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }else{
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(11);
@ -6544,7 +6565,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
        xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
        xmlStr+="<TREAT_DOCTOR_ID>"+doctorId+"</TREAT_DOCTOR_ID>";
        xmlStr+="<TREAT_DOCTOR_NAME>"+doctorName+"</REAT_DOCTOR_NAME>";
        xmlStr+="<TREAT_DOCTOR_NAME>"+doctorName+"</TREAT_DOCTOR_NAME>";
        xmlStr+="<IS_SGIN>Y</IS_SGIN>";
        xmlStr+="<OUTPATIENT_INFO>";
        xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
@ -6781,9 +6802,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
        String uid = userAgent.getUID();
        StringBuffer sql = new StringBuffer("SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
        StringBuffer sql = new StringBuffer(" SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
        StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
        sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id ");
        sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNotEmpty(status)){
@ -6811,8 +6832,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " OR b.real_order LIKE '%"+keyName+"%' " +
                    ")");
        }
        sql.append(" order by b.prescribe_time DESC limit ").append((page-1)*size).append(",").append(size);
        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        sql.append(" order by b.prescribe_time DESC ");
        List<WlyyPrescriptionVO>  list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=sql.toString();
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            logger.info("oracleSql="+oracleSql);
            list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }else {
//            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            sql.append("  limit ").append((page-1)*size).append(",").append(size);
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        logger.info("sql="+sql.toString());
@ -6897,4 +6949,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,openid);
    }
    /**
     * 查询科室简介
     * @param orgCode
     * @param deptCode
     * @return
     */
    public MixEnvelop findDeptDesc(String orgCode, String deptCode) {
        DictDeptDescDO deptDescDO = dictDeptDescDao.findByDeptCodeAndOrgCode(deptCode, orgCode);
        if (deptDescDO!=null){
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deptDescDO);
        }else {
            return MixEnvelop.getError("无该科室简介");
        }
    }
    /**
     * 查询机构科室
     * @param orgCode
     * @return
     */
    public MixEnvelop findDeptByOrgCode(String orgCode) {
        List<DictDeptDescDO> deptDescDOList = dictDeptDescDao.findByOrgCode(orgCode);
        if (deptDescDOList==null || deptDescDOList.size()==0){
            return MixEnvelop.getError("无科室信息");
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,deptDescDOList);
    }
}

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

@ -220,10 +220,10 @@ public class YkyyEntranceService {
        }
        String sql ="select * from VLIS_REPORT_MASTER where PATIENT_ID = '"+patientMappingDO.getMappingCode()+"'";
        if(StringUtils.isNoneBlank(startTime)){
            sql+=" and to_char(REPORT_TIME,'yyyy-mm-dd hh24:mi:ss') >= '"+startTime+"' ";
            sql+=" and REPORT_TIME >= '"+startTime.replace("-",".")+"' ";
        }
        if(StringUtils.isNoneBlank(endTime)){
            sql+=" and to_char(REPORT_TIME,'yyyy-mm-dd hh24:mi:ss') >= '"+endTime+"' ";
            sql+=" and REPORT_TIME <= '"+endTime.replace("-",".")+"' ";
        }
        sql+="  order by REPORT_TIME desc";
        Map<String,Object> params = new HashedMap();

+ 59 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
/**
@ -35,6 +36,7 @@ public class YkyyService {
    private BasePatientDao patientDao;
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    private static String yktUrl_90 = "http://www.yanketong.com:90/";
@ -73,6 +75,62 @@ public class YkyyService {
    }
    /**
     * 获取充值订单号接口
     * @param mzhm 卡号
     * @param jkje  交款金额
     * @param type  类型0 就诊卡号 1 门诊卡号
     * @param PaymentType  1支付宝 2微信
     * @param UserId  用户Id
     * @param HospitalId  医院Id
     * @return
     */
    public String getNewSerialNumber(String mzhm,Integer jkje,Integer type,Integer PaymentType,String UserId,String HospitalId){
        String response="";
        Map<String, String> map = new HashMap<>();
        map.put("mzhm",mzhm);
        map.put("jkje",Integer.toString(jkje));
        map.put("type",Integer.toString(type));
        map.put("PaymentType",Integer.toString(PaymentType));
        map.put("UserId",UserId);
        if (StringUtils.isNotEmpty(HospitalId)){
            map.put("HospitalId",HospitalId);
        }
        logger.info("眼科获取充值订单号接口入参:"+map.toString());
        String url=yktUrl_90+"api/His/GetNewSerialNumber";
        try {
            response=httpClientUtil.httpPost(url,map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    /**
     * 充值接口(充值成功后在回调中调用此接口)
     * @param guid  订单号
     * @param jkje  交款金额
     * @param type  类型0 就诊卡号 1 门诊卡号
     * @return
     */
    public String upRecharge4Jkzl(String guid,Integer jkje,Integer type){
        String response="";
        Map<String, String> map = new HashMap<>();
        map.put("guid",guid);
        map.put("jkje",Integer.toString(jkje));
        map.put("type",Integer.toString(type));
        logger.info("眼科充值接口入参:"+map.toString());
        String url=yktUrl_90+"api/His/UpRecharge4Jkzl";
        try {
            response=httpClientUtil.httpPost(url,map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    /**
     * 互联网-添加就诊卡
     * @param patient
@ -561,7 +619,7 @@ public class YkyyService {
        jsonObject.put("total_fee",total_fee);
        jsonObject.put("spbill_create_ip",spbill_create_ip);
        jsonObject.put("notify_url",notify_url);
        String url = "http://www.yanketong.com/api/Doctor/GetPayCDATA4Jkzl";
        String url = "http://www.yanketong.com:90/api/Doctor/GetPayCDATA4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("眼科通支付:"+response);
        return response;

+ 100 - 3
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -47,6 +47,7 @@ import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.mysql.query.BaseJpaService;
import com.ylzinfo.ehc.common.utils.DateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -626,6 +627,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
            String totalFee=wxrs.get("total_fee")+"";
            // 微信充值流水号
            String wxSeqNo = wxrs.get("transaction_id")+"";
            // 微信分配的终端设备号
@ -660,9 +662,24 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                            e.printStackTrace();
                        }
                    }
                }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("5")){
                    String price = Integer.parseInt(totalFee)/100+"";
                    if (businessOrderDO.getOrderType()==10){
                        String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 0);
                        logger.info("调用结果="+re);
                    }
                    if (businessOrderDO.getOrderType()==11){
                        String re = ykyyService.upRecharge4Jkzl(businessOrderDO.getYkOrderNo(), Integer.parseInt(price), 1);
                        logger.info("调用结果="+re);
                    }
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            else if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")){
                ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            }
            //操作微信日志表记录
            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
            WxPayLogDO wxPayLogDO = wxPayLogDOs.get(0);
@ -833,6 +850,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    public List<BusinessOrderDO> selectListStatus(String relationCode){
        List<BusinessOrderDO> businessOrderDOList = businessOrderDao.selectListByRelationCode(relationCode);
        return businessOrderDOList;
    }
    /**
     * 易联众退款
     * @param wechatId
@ -1111,6 +1135,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 眼科通app支付
     * @param relationCode
     * @return
     * @throws UnknownHostException
     */
    public String yktAppPayJson(String relationCode) throws UnknownHostException {
        String serverIp = getServerIp();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKT_NOTIFY_URL");
@ -1119,8 +1149,75 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        businessOrderDO.setPayType(5);
        businessOrderDao.save(businessOrderDO);
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getDescription(),businessOrderDO.getOrderNo(),totalFee,serverIp,url);
        String totalFee =(int)(businessOrderDO.getPayPrice()*100)+"";
        return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getRematk(),businessOrderDO.getOrderNo(),totalFee,serverIp,notifyUrl);
    }
    /**
     * 眼科就诊卡充值
     * @param mzhm
     * @param jkje
     * @param type
     * @param paymentType
     * @param patientId
     * @param wechatId
     * @param hospitalId
     * @return
     * @throws Exception
     */
    public Map yktMedicalCardTopUp(String mzhm,Double jkje,Integer type,Integer paymentType,String patientId,String wechatId,String hospitalId,String wxPayType) throws Exception {
        BasePatientDO patientDO = patientDao.findById(patientId);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        businessOrderDO.setPatient(patientId);
        businessOrderDO.setPatientName(patientDO.getName());
        businessOrderDO.setCreateTime(DateUtil.getNowDate());
        businessOrderDO.setOrderCategory("5");
        businessOrderDO.setDescription("就诊卡充值");
        businessOrderDO.setPayPrice(jkje);
        businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setRelationCode(mzhm);
        businessOrderDO.setRelationName("就诊卡充值");
        businessOrderDO.setStatus(0);
        if (paymentType==1){
            businessOrderDO.setPayType(2);
        }
        if (paymentType==2){
            businessOrderDO.setPayType(1);
        }
        if (type==0){
            businessOrderDO.setOrderType(10);
        }
        if (type==1){
            businessOrderDO.setOrderType(11);
        }
        Map<String,Object> map= new HashMap<>();
        String rs = ykyyService.getNewSerialNumber(mzhm, jkje.intValue(), type, paymentType, patientDO.getUserId(), hospitalId);
        logger.info("眼科获取充值订单接口调用结果:"+rs);
        Map<String,Object> rsMap = JSONObject.parseObject(rs, Map.class);
        if ("10000".equalsIgnoreCase(rsMap.get("code").toString())){
            businessOrderDO.setYkOrderNo(rsMap.get("value").toString());
        }else {
            logger.info("error=眼科接口调用失败");
            return rsMap;
        }
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        List<BasePatientWechatDo> patientWechatDoList = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
        if (patientWechatDoList==null || patientWechatDoList.size()==0){
            map.put("error","无openId");
            logger.info("error=无openId");
            return map;
        }
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        String price = (int)(businessOrderDO.getPayPrice()*100)+"";
        map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl);
        logger.info("success="+JSONObject.toJSONString(map));
        return map;
    }
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java

@ -22,6 +22,10 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    BusinessOrderDO selectByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.relationCode = ?1 order by createTime desc ")
    List<BusinessOrderDO> selectListByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.traceNo = ?1 ")
    BusinessOrderDO selectByTraceNo(String traceNo);

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -281,6 +281,7 @@ public class YlzPayService {
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("fee",fee);//总费用
            jsonObject.put("recipeNum",recipeNum);//处方数
            System.out.println("推送模板消息参数"+jsonObject.toJSONString());
            //jsonObject.put("extra")
            ResponseParams<MmpPushResult> response = onepayClient.mmpMsgPush(jsonObject);
            if (response.getRespCode().equals("000000")){

+ 54 - 2
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -14,12 +14,15 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
@ -75,6 +78,13 @@ public class WlyyBusinessService {
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    /**
     * 推送系统门诊wlyy系统消息
     * @param doctor
@ -254,7 +264,7 @@ public class WlyyBusinessService {
     * @return
     * @throws Exception
     */
    public String wlyyGetPatientAccetokenByIdcard(String patientId) throws Exception {
    public String wlyyGetPatientAccetokenByIdcard(String patientId,String wxId) throws Exception {
        
        String idcard = "";
        String result = "";
@ -264,7 +274,49 @@ public class WlyyBusinessService {
    
            Map<String,String> params = new HashMap<>();
            params.put("idcard",idcard);
            
            String patientCardNo = null;
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                net.sf.json.JSONArray array =prescriptionService.findPatientCard(patientId);
                for (int i=0;i<array.size();i++){
                    net.sf.json.JSONObject object = array.getJSONObject(i);
                    String cardType = object.getString("CARD_TYPE");
                    String cardNo = object.getString("CARD_NO");
                    String cardTypeName = object.getString("CARD_TYPE_NAME");
                    PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByCode(cardNo);
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setCode(cardNo);
                        patientMedicareCardDO.setParentType("A");
                        if (cardType.equalsIgnoreCase("2")){
                            patientMedicareCardDO.setType("A_01");
                            patientCardNo = cardNo;
                        }else {
                            patientMedicareCardDO.setType("A_03");
                        }
                        patientMedicareCardDO.setPatientCode(patientId);
                        patientMedicareCardDO.setOrgCode("350211A1002");
                        patientMedicareCardDO.setCityCode("350200");
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setRemark(cardTypeName);
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    }
                }
            }else {
                //TODO
            }
            //查询i健康信息,没有就注册;
            Map<String,String> patientSccParams = new HashMap<>();
            patientSccParams.put("scc",patientCardNo);
            patientSccParams.put("name",basePatientDO.getName());
            patientSccParams.put("idCard",basePatientDO.getIdcard());
            patientSccParams.put("sex",basePatientDO.getSex().toString());
            patientSccParams.put("phone",basePatientDO.getPhone());
            patientSccParams.put("birthday",basePatientDO.getBirthday().toString());
            JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
            if(rs!=null){
                Integer status = rs.getInteger("status");

+ 14 - 6
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -782,12 +782,18 @@ public class ImService {
	 */
	public InputStream getInputStream(String mediaId,String wechat_appid) throws Exception {
		String accessToken = "";
//		//中山医院互联网医院
//		if("xm_zsyy_wx".equals(wechat_appid)){
//			accessToken = entranceService.getAccessToken("100033");
//		}else{
//			accessToken = wxAccessTokenService.getWxAccessTokenById(wechat_appid).getAccessToken();
//		}
		//中山医院互联网医院
		if("xm_zsyy_wx".equals(wechat_appid)){
			accessToken = entranceService.getAccessToken("100033");
			net.sf.json.JSONObject object1 = net.sf.json.JSONObject.fromObject(accessToken);
			if (null != object1&&null!=object1.get("respCode") && "00".equals(object1.get("respCode"))) {
				accessToken  = object1.getJSONObject("respEntity").getString("access_token");
			} else {
				throw new Exception("获取ACCESSTOKEN失败");
			}
		}else{
			accessToken = wxAccessTokenService.getWxAccessTokenById(wechat_appid).getAccessToken();
		}
		InputStream is = null;
		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
//		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=30_OBJbMMPW9TnyGHKf32bcjkXtxWnzBrtqWlSMBnNk8MWpJ6qis2TnsecRYNZImgahdx30WrsI1bGco6K67-j4sT1QkDxYKBrVvjaYF6QgbY8dgBMzuoARKoaxtX3ehiYvdCLSUHvogrpF3n0GANIfCHAHUP&media_id=R_060hnyXAFyHD9HaOLl15xhDIzDvcA61-Wz34GkXmCakdrsFJqxrPEBHewmAEK9";
@ -817,6 +823,8 @@ public class ImService {
					} else {
						throw new Exception("获取ACCESSTOKEN失败");
					}
					is = getInputStreamReLoad(mediaId,wechat_appid,accessToken);
					return is;
				}else{
					wxAccessTokenService.deleteByWechatId(wechat_appid);
					accessToken = wxAccessTokenService.updateAccessToken(wechat_appid);

+ 45 - 18
common/common-entity-es/src/main/java/com/yihu/jw/datainput/DataBodySignsDO.java

@ -13,16 +13,19 @@ public class DataBodySignsDO {
    @JestId
    private String id;
    private String access_token; //访问token
    private String data_source; //数据来源
    private String sn;          //设备序列码
    private String ext_code;    //设备A,B键,取值为0,1,代表绑定不同的用户,
    private String device_name; //设备名称
    private String device_model;//设备型号
    private List<Data> data;    //设备所测量的数据内容
    private List<MeasureData> measure_data;    //设备所测量的数据内容
    private List<PositionData> position_data;    //设备所测量的数据内容
    private String idCard;      //设备绑定的用户身份证号
    private String username;    //用户名
    private String usercode;    //用户在系统中的code,唯一识别
    private String rid; // 存到hbase中的id
    private Integer status =0; //状态:0为标准,1为异常
    private Integer del = 1; //删除标记,1代表正常,0代表删除
    public String getId() {
        return this.id;
@ -32,14 +35,6 @@ public class DataBodySignsDO {
        this.id = id;
    }
    public String getAccess_token() {
        return access_token;
    }
    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }
    public String getData_source() {
        return data_source;
    }
@ -80,14 +75,6 @@ public class DataBodySignsDO {
        this.device_model = device_model;
    }
    public List<Data> getData() {
        return data;
    }
    public void setData(List<Data> data) {
        this.data = data;
    }
    public String getIdCard() {
        return idCard;
    }
@ -111,4 +98,44 @@ public class DataBodySignsDO {
    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }
    public String getRid() {
        return rid;
    }
    public void setRid(String rid) {
        this.rid = rid;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public List<MeasureData> getMeasure_data() {
        return measure_data;
    }
    public void setMeasure_data(List<MeasureData> measure_data) {
        this.measure_data = measure_data;
    }
    public List<PositionData> getPosition_data() {
        return position_data;
    }
    public void setPosition_data(List<PositionData> position_data) {
        this.position_data = position_data;
    }
}

+ 80 - 0
common/common-entity-es/src/main/java/com/yihu/jw/datainput/MeasureData.java

@ -0,0 +1,80 @@
package com.yihu.jw.datainput;
/**
 * Created by yeshijie on 2020/6/18.
 */
public class MeasureData {
    private String type;//体征类型
    private String measure_time;//测量时间
    private String sign_name;//体征指标名称
    private String sign_value;//体征指标值
    private String sign_unit;//体征指标单位
    private String explain;//测量结果的解释分析
    private String filepath;// 测量附件
    private String reference;//测量结果参考标准
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getMeasure_time() {
        return measure_time;
    }
    public void setMeasure_time(String measure_time) {
        this.measure_time = measure_time;
    }
    public String getSign_name() {
        return sign_name;
    }
    public void setSign_name(String sign_name) {
        this.sign_name = sign_name;
    }
    public String getSign_value() {
        return sign_value;
    }
    public void setSign_value(String sign_value) {
        this.sign_value = sign_value;
    }
    public String getSign_unit() {
        return sign_unit;
    }
    public void setSign_unit(String sign_unit) {
        this.sign_unit = sign_unit;
    }
    public String getExplain() {
        return explain;
    }
    public void setExplain(String explain) {
        this.explain = explain;
    }
    public String getFilepath() {
        return filepath;
    }
    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }
    public String getReference() {
        return reference;
    }
    public void setReference(String reference) {
        this.reference = reference;
    }
}

+ 37 - 0
common/common-entity-es/src/main/java/com/yihu/jw/datainput/PositionData.java

@ -0,0 +1,37 @@
package com.yihu.jw.datainput;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
/**
 * Created by yeshijie on 2020/6/18.
 */
public class PositionData {
    private GeoPoint location;//坐标 lat lon
    private String altitude; //海拨
    private String position; //位置描述,例如几号病房几床
    public GeoPoint getLocation() {
        return location;
    }
    public void setLocation(GeoPoint location) {
        this.location = location;
    }
    public String getAltitude() {
        return altitude;
    }
    public void setAltitude(String altitude) {
        this.altitude = altitude;
    }
    public String getPosition() {
        return position;
    }
    public void setPosition(String position) {
        this.position = position;
    }
}

+ 1 - 5
common/common-entity/pom.xml

@ -23,10 +23,6 @@
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.13.Final</version>
        </dependency>
    </dependencies>
</project>

+ 63 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictDeptDescDO.java

@ -0,0 +1,63 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.aspectj.weaver.ast.Test;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/18
 */
@Entity
@Table(name = "dict_dept_desc")
@SequenceGenerator(name="id_generated", sequenceName="DICT_HOSPITAL_DEPT_SEQ")
public class DictDeptDescDO extends UuidIdentityEntityWithOperator {
    @Column(name = "org_code")
    private String orgCode;
    @Column(name = "dept_code")
    private String deptCode;
    @Column(name = "dept_name")
    private String deptName;
    @Column(name = "dept_description")
    private String deptDescription;
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getDeptCode() {
        return deptCode;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDeptDescription() {
        return deptDescription;
    }
    public void setDeptDescription(String deptDescription) {
        this.deptDescription = deptDescription;
    }
}

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java

@ -61,6 +61,12 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
	 */
	private String del;
    /**
     * hisid
     *
     */
	private String hisId;
	public BaseDoctorHospitalDO(){}
	public BaseDoctorHospitalDO(String orgCode, String orgName, String doctorDutyCode, String doctorDutyName){
@ -144,4 +150,13 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
    @Transient
    public String getHisId() {
        return hisId;
    }
    public void setHisId(String hisId) {
        this.hisId = hisId;
    }
}

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -160,6 +160,11 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
     * 机构分部号,每个机构都不一样,例如中山医院:6总部7金榜8夏禾 默认1
     */
    private String winNo;
    /**
     * 医院code
     */
    private String hisId;
	
//	/**
//	 * 排序
@ -421,4 +426,13 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
    @Column(name = "his_id")
    public String getHisId() {
        return hisId;
    }
    public void setHisId(String hisId) {
        this.hisId = hisId;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -24,7 +24,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String patientName;//居民名字
    private String orderNo;//订单号
    private Integer orderType;//订单类型订单类型:目前只能1表示图文,3表示视频大类细分如下:专家咨询:1图文咨询 |2电话咨询|3视频咨询|4免费义诊图文诊室:1图文复诊视频诊室:3视频复诊| 5社区协同
    private String orderCategory;//1:专家咨询|2:图文诊室|3:视频诊室|)
    private String orderCategory;//1:专家咨询|2:图文诊室|3:视频诊室|4处方结算|5就诊卡充值)
    private String relationCode;//业务关联code
    private String relationName;//业务关联名称
    private String description;//支付备注

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

@ -109,6 +109,18 @@ public class BaseHospitalRequestMapping {
         * 查询机构底下部门
         */
        public static final String findDeptByHospital ="/findDeptByHospital";
        /**
         * 查询机构底下部门
         */
        public static final String findDeptDescByDeptCodeAndOrgCode ="/findDeptDescByDeptCodeAndOrgCode";
        /**
         * 查询机构底下部门
         */
        public static final String findDeptByOrgCode ="/findDeptByOrgCode";
    
        /**
         * 查询有所有已开放的科室
@ -415,6 +427,7 @@ public class BaseHospitalRequestMapping {
        public static final String selectOrderByRelationCode = "/selectOrderByRelationCode";
        public static final String ylzRechargeJson="ylzRechargeJson";
        public static final String yktMedicalCardTopUp="/yktMedicalCardTopUp";
        public static final String ylzRefund = "/ylzRefund";
@ -422,6 +435,7 @@ public class BaseHospitalRequestMapping {
        public static final String tradeQuery= "/tradeQuery";
        public static final String selectOrderStatus="/selectOrderStatus";
        public static final String selectOrderListStatus="/selectOrderListStatus";
        public static final String selectPrescriptionList = "/selectPrescriptionList";

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

@ -59,7 +59,7 @@ public class IotRequestMapping {
     * 第三方调用物联网接口 需要accesstoken
     */
    public static class ThirdOpen{
        public static final String bindUser = "bindUser";
        public static final String registedevice = "registedevice";
        public static final String inputWeRunData = "inputWeRunData";
        public static final String uploadData = "uploadData";
        public static final String updateData = "updateData";

+ 10 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyScreenResultVo.java

@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
@ -37,6 +36,8 @@ public class SurveyScreenResultVo{
    //
    @ApiModelProperty("居民code")
    private String patientCode;
    @ApiModelProperty("居民头像")
    private String photo;
    //
    @ApiModelProperty("居民openid")
    private String openId;
@ -442,4 +443,12 @@ public class SurveyScreenResultVo{
    public void setStartTimeReservation(String startTimeReservation) {
        this.startTimeReservation = startTimeReservation;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}

+ 3 - 3
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -142,7 +142,7 @@ express:
spring:
  profiles: jwprod
  datasource:
    url: jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: im
    password: 2oEq3Kf7
@ -150,7 +150,7 @@ spring:
demo:
  flag: false
hospital:
  url: https://172.16.1.34
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
@ -278,7 +278,7 @@ spring:
demo:
  flag: false
hospital:
  url: https://172.16.1.34
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60

+ 11 - 0
svr/svr-internet-hospital/pom.xml

@ -126,6 +126,17 @@
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <!-- <scope>runtime</scope> -->
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu</groupId>-->

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

@ -304,8 +304,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    
        //医生咨询
        result.put("zxCount",imService.SessionsUnreadMessageCount(doctor.getId(),"1"));//专家咨询咨询数量
        result.put("fzCount",imService.SessionsUnreadMessageCount(doctor.getId(),"9"));//图文复诊数量
        Integer zxCount = imService.SessionsUnreadMessageCount(doctor.getId(), "1");
        Integer fzCount = imService.SessionsUnreadMessageCount(doctor.getId(), "9");
        Integer spCount = imService.SessionsUnreadMessageCount(doctor.getId(), "16");
        result.put("zxCount",zxCount);//专家咨询咨询数量
        result.put("fzCount",fzCount);//图文复诊数量
        result.put("spCount",spCount);//图文复诊数量
        result.put("totalCount",zxCount+fzCount+spCount);
        return success("请求成功",result);
    }

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

@ -37,6 +37,7 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -267,6 +268,24 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "consultDeptFlag", required = false)String consultDeptFlag) {
        return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptDescByDeptCodeAndOrgCode)
    @ApiOperation(value = "查询科室介绍", notes = "查询科室介绍")
    public MixEnvelop findDeptDesc(@ApiParam(name = "orgCode", value = "机构code")
                                          @RequestParam(value = "orgCode", required = true)String orgCode,
                                          @ApiParam(name = "deptCode", value = "部门code")
                                          @RequestParam(value = "deptCode", required = true)String deptCode) {
        return prescriptionService.findDeptDesc(orgCode,deptCode);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByOrgCode)
    @ApiOperation(value = "查询机构下所有科室", notes = "查询机构下所有科室")
    public MixEnvelop findDeptByOrgCode(@ApiParam(name = "orgCode", value = "机构code")
                                   @RequestParam(value = "orgCode", required = true)String orgCode) {
        return prescriptionService.findDeptByOrgCode(orgCode);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByKeyWord)
    @ApiOperation(value = "查询有所有已开放的科室", notes = "查询有所有已开放的科室")
@ -1020,7 +1039,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @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));
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode,wxId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWlyyPatient)
@ -1248,7 +1267,42 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 充值卡一支付
     * @param mzhm
     * @param jkje
     * @param type
     * @param paymentType
     * @param patientId
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.yktMedicalCardTopUp)
    @ApiOperation("眼科--充值卡支付")
    public ObjEnvelop yktMedicalCardTopUp(
            @ApiParam(name = "mzhm", value = "卡号", required = true)
            @RequestParam(required = true)String mzhm,
            @ApiParam(name = "jkje", value = "充值金额", required = true)
            @RequestParam(required = true)Double jkje,
            @ApiParam(name = "type", value = "类型0 就诊卡号 1 门诊卡号", required = true)
            @RequestParam(required = true)Integer type,
            @ApiParam(name = "paymentType", value = "1支付宝 2微信", required = true)
            @RequestParam(required = true)Integer paymentType,
            @ApiParam(name = "patientId", value = "居民Ccode", required = true)
            @RequestParam(required = true)String patientId,
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @RequestParam(required = true)String hospitalId,
            @ApiParam(name = "wxPayType", value = "微信交易类型 公众号支付:JSAPI  原生扫码支付:NATIVE", required = true)
            @RequestParam(required = true)String wxPayType) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.yktMedicalCardTopUp(mzhm,jkje,type,paymentType,patientId,wxId,hospitalId,wxPayType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 查询支付状态
@ -1267,7 +1321,25 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 查询支付info
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderListStatus)
    @ApiOperation("查询支付info")
    public ObjEnvelop selectOrderListStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectListStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 易联众统一退款

+ 3 - 28
svr/svr-iot-job/pom.xml

@ -32,10 +32,6 @@
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
@ -82,17 +78,15 @@
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>${parent.version}</version>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>im-service</artifactId>
            <version>2.0.0</version>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
            <artifactId>common-web</artifactId>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
@ -106,18 +100,6 @@
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
@ -151,13 +133,6 @@
            <version>2.4.4</version>
        </dependency>
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <build>

+ 0 - 96
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/IotDeviceSimService.java

@ -1,17 +1,11 @@
package com.yihu.jw.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.repository.device.IotDeviceDao;
import com.yihu.jw.repository.device.IotDeviceSimDao;
import com.yihu.jw.repository.device.IotPatientDeviceDao;
import com.yihu.jw.repository.dict.IotSystemDictDao;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
@ -23,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
@ -72,96 +65,7 @@ public class IotDeviceSimService extends BaseJpaService<IotDeviceSimDO, IotDevic
        iotDeviceSimDao.save(simDO);
    }
    /**
     *新增SIM卡
     * @param json
     */
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(String json) {
        IotDeviceSimDO sim = JSONObject.parseObject(json, IotDeviceSimDO.class);
        IotDeviceSimDO deviceSimDaoBySim = iotDeviceSimDao.findBySim(sim.getSim());
        if(deviceSimDaoBySim!=null){
            return MixEnvelop.getError("SIM已存在");
        }
        IotPatientDeviceDO patientSim = iotPatientDeviceDao.findBySim(sim.getSim());
        if (patientSim!=null){
            sim.setDeviceName(patientSim.getDeviceName());
            sim.setDeviceSn(patientSim.getDeviceSn());
            sim.setContactsName(patientSim.getPatientName());
            sim.setContactsMobile(patientSim.getMobile());
        } else {
            IotDeviceDO deviceSim = iotDeviceDao.findBySimNo(sim.getSim());
            if (deviceSim!=null){
                sim.setDeviceName(deviceSim.getName());
                sim.setDeviceSn(deviceSim.getDeviceSn());
            }
        }
        sim.setRemainingBalance(sim.getAdvancePayment()-sim.getPayment());
        sim.setStatus(1);
        sim.setDel("0");
        iotDeviceSimDao.save(sim);
        return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_add);
    }
    /**
     * 条件分页查找
     * @param page
     * @param size
     * @param status
     * @param sim
     * @param sn
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE 1=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_sim c  WHERE 1=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append("and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(sim)){
            sql.append(" and (c.sim like '%").append(sim).append("%')");
            sqlCount.append(" and (c.sim like '%").append(sim).append("%')");
        }
        if(StringUtils.isNotBlank(sn)){
            sql.append(" and (c.device_sn like '%").append(sn).append("%')");
            sqlCount.append(" and (c.device_sn like '%").append(sn).append("%')");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list, page, size,count);
    }
    /**
     * 分页查找所有应用SIM卡信息
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> findAllSim(Integer page, Integer size) {
        StringBuffer sql= new StringBuffer("SELECT DISTINCT * FROM iot_device_sim ");
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list,page, size,count);
    }
    /**

+ 1 - 40
svr/svr-iot-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -1,10 +1,6 @@
package com.yihu.jw.web.quota;
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.ykyy.YkyyInternetService;
import com.yihu.jw.job.*;
import com.yihu.jw.job.QuartzHelper;
import com.yihu.jw.job.wlw.DeviceQualityPlanJob;
import com.yihu.jw.job.wlw.InventoryWarningJob;
import com.yihu.jw.job.wlw.SimBalanceJob;
@ -26,7 +22,6 @@ 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;
/**
@ -43,15 +38,6 @@ public class JobController extends BaseController {
    private final JobService jobService;
    private final QuartzHelper quartzHelper;
    @Autowired
    private ImService imService;
    @Autowired
    private DataGeneratorService dataGeneratorService;
    @Autowired
    private YkyyInternetService ykyyInternetService;
    @Autowired
    private SimBalanceService simBalanceService;
@ -302,31 +288,6 @@ public class JobController extends BaseController {
    }
    @RequestMapping(value = "/delData", method = RequestMethod.POST)
    @ApiOperation("删除数据")
    public String delData(String doctor,String date) {
        try {
            List<WlyyOutpatientDO> list = dataGeneratorService.delData(doctor,date);
            imService.deleteJobData(list,date);
            return write(200, "数据已经删除");
        } catch (Exception e) {
            error(e);
            return error(-1, "数据已经删除");
        }
    }
    @RequestMapping(value = "/testImg", method = RequestMethod.GET)
    @ApiOperation("测试图片")
    public String testImg(String path) {
      return write(200, ykyyInternetService.testImg(path));
    }
    @RequestMapping(value = "/deviceInventoryWarning", method = RequestMethod.GET)
    @ApiOperation("设备库存预警提醒")
    public String deviceInventoryWarning() {

+ 1 - 141
svr/svr-iot-job/src/main/resources/application.yml

@ -120,81 +120,6 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwOracleTest
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@172.26.0.141:1521:helowin
    username: normal
    password: normal
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
hlwyyEntrance:
  url: http://172.16.1.42:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwOracleProd
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@10.10.10.16:1521/rac
    username: HLWYY
    password: Xmykzxhlwyy963
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
hlwyyEntrance:
  url: http://172.16.1.42:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwprod
@ -224,78 +149,13 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: xzprod
  datasource:
    url: jdbc:mysql://172.16.100.240:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: jkzl
    password: jkzl@2020
hlwyyEntrance:
  url: http://172.16.100.63:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.100.241:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://172.16.100.240:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: xzprod_in
  datasource:
    url: jdbc:mysql://192.168.103.155:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: jkzl
    password: jkzl@2020
hlwyyEntrance:
  url: http://172.16.100.63:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://192.168.103.150:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.168.103.159:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: iotprod
  datasource:
    url: jdbc:mysql://59.61.92.90:20002/xmiot?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://10.90.32.2:20002/xmiot?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123
  redis:
    host: 59.61.92.90 # Redis server host.
    port: 9054  # Redis server port.
    password: jkzlehr
wlyy:
  url: http://www.xmtyw.cn/wlyy/

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

@ -74,5 +74,5 @@ spring:
  profiles: iotprod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.120.174:1221}
      uri: ${wlyy.spring.config.uri:http://192.168.120.216:1221}
      label: ${wlyy.spring.config.label:master}

+ 51 - 49
svr/svr-iot/sql-scripts/body_health_data_es.txt

@ -6,57 +6,25 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
{
    "signs_data": {
        "properties": {
            "access_token": {
            "device_name": {
                "type": "string",
                "index": "not_analyzed"
            },
            "device_name": {
            "del": {
                "type": "string",
                "index": "not_analyzed"
            },
            "data": {
            "rid": {
                "type": "string",
                "index": "not_analyzed"
            },
            "status": {
                "type": "string",
                "index": "not_analyzed"
            },
            "measure_data": {
                "properties": {
                    "value1": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value2": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value3": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value4": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value5": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value6": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value7": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value8": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value9": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value10": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "del": {
                    "type": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
@ -64,15 +32,42 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "rid": {
                        "type": "string",
                        "index": "not_analyzed"
                     "sign_name": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                     "sign_value": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                     "sign_unit": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                      "explain": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "filepath": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "reference": {
                          "type": "string",
                          "index": "not_analyzed"
                      }
                }
            },
            "position_data": {
                "properties": {
                    "location": {
                        "type": "geo_point"
                    },
                    "type": {
                    "altitude": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "status": {
                    "position": {
                        "type": "string",
                        "index": "not_analyzed"
                    }
@ -90,6 +85,10 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
                "type": "string",
                "index": "not_analyzed"
            },
            "idcard": {
                "type": "string",
                "index": "not_analyzed"
            },
            "sn": {
                "type": "string",
                "index": "not_analyzed"
@ -109,3 +108,6 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
        }
    }
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -360,7 +360,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                size = 10;
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotInterfaceLogService.findInterfaceLog(page,size,interfaceName,addressIp));
            return iotInterfaceLogService.findInterfaceLog(page,size,interfaceName,addressIp);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java

@ -31,9 +31,9 @@ public class ThirdDataInputController {
    @Autowired
    private DataSearchService dataSearchService;
    @PostMapping(value = IotRequestMapping.ThirdOpen.bindUser)
    @PostMapping(value = IotRequestMapping.ThirdOpen.registedevice)
    @ApiOperation(value = "设备注册绑定", notes = "设备注册并绑定用户")
    public MixEnvelop bindUser(@ApiParam(name = "jsonData", value = "", defaultValue = "") @RequestParam String jsonData){
    public MixEnvelop registedevice(@ApiParam(name = "jsonData", value = "", defaultValue = "") @RequestParam String jsonData){
        try{
            return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success,dataInputService.bindUser(jsonData));
        } catch (ApiException e){

+ 13 - 25
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -138,7 +138,6 @@ public class DataInputService {
        //提取json某些项值
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(json,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -168,7 +167,7 @@ public class DataInputService {
                    measuretime = DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss);
                }
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                rowkey = RowKeyUtils.makeRowKey();
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
@ -264,6 +263,7 @@ public class DataInputService {
        if(StringUtils.isEmpty(json)){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter json is null");
            result.put("status",-1);
            return result.toString();
        }
        String fileName = "";
@ -277,11 +277,11 @@ public class DataInputService {
            logger.error("json parse error,invalid json string");
            result.put("msg","json parse error,invalid json string");
            result.put("response",ConstantUtils.FAIL);
            result.put("status",-1);
            return result.toString();
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -293,44 +293,31 @@ public class DataInputService {
            updateBindUser(dataSource,deviceSn,idcard,username);
        }*/
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        JSONArray jsonArray = jsonObject.getJSONArray("measure_data");
        if(null == jsonArray || jsonArray.size() == 0){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter 'data' of json no exist");
            result.put("status",-1);
            return result.toString();
        }
        List<String> rowkeyList = new ArrayList<>();
        List<Map<String,Map<String,String>>> familyList = new ArrayList<>();
        //生成一份json数据的rowkey
        rowkey = RowKeyUtils.makeRowKey();
        jsonObject.put("rid",rowkey);//hbase的rowkey
        rowkeyList.add(rowkey);
        //循环数据,一组数据存一行,生成一个rowkey,并将该rowkey存到es中
        for(Object obj:jsonArray){
            JSONObject data = (JSONObject)obj;
            data.put("del","1"); //添加删除标记
            try {
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
                logger.error("make rowkey error");
                result.put("msg","make rowkey error");
                result.put("response",ConstantUtils.FAIL);
                return result.toString();
            }
            //组装B列
            Map<String, Map<String, String>> family = new HashMap<>();
            Map<String, String> columnsB = new HashMap<>();
            for(String key:data.keySet()){
                if(StringUtils.equalsIgnoreCase("rid",key)){ //存到hbase里的数据不需要rid
                    continue;
                }
                columnsB.put(key,data.getString(key));
            }
            if(data.containsKey("ecg")){
                fileName = data.getString("fileName");
                fileAbsPath = data.getString("filepath");
            }
            family.put(ConstantUtils.familyB,columnsB);
            familyList.add(family);
        }
@ -350,8 +337,10 @@ public class DataInputService {
            rids.addAll(rowkeyList);
            result.put("rid",rids);
            result.put("response",ConstantUtils.SUCCESS);
            result.put("status",200);
        }else{
            result.put("response",ConstantUtils.FAIL);
            result.put("status",-1);
        }
        /*try {
@ -400,7 +389,6 @@ public class DataInputService {
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -428,7 +416,7 @@ public class DataInputService {
            data.put("del","1"); //添加删除标记
            try {
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                rowkey = RowKeyUtils.makeRowKey();
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java

@ -54,7 +54,7 @@ public class DataStandardConvertService {
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(oldJson,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(oldJson);
        //如果没有授权或者数据来源,则表示数据异常
        if(null == dataBodySignsDO.getAccess_token() || (null != dataBodySignsDO.getAccess_token() && null == dataBodySignsDO.getData_source())){
        if(null == dataBodySignsDO.getData_source()){
            logger.warn("传过来的数据无有效access_token或data_source",oldJson);
            return "";
        }

+ 9 - 0
svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/RowKeyUtils.java

@ -11,6 +11,7 @@ import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.security.Key;
import java.security.spec.AlgorithmParameterSpec;
import java.util.UUID;
public class RowKeyUtils {
@ -26,6 +27,14 @@ public class RowKeyUtils {
    }
    /**
     * 用uuid做rowkey
     * @return
     */
    public static String makeRowKey(){
        return UUID.randomUUID().toString();
    }
    /**
     * 将rowkey里的信息还原回去
     */

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/model/BaseResultModel.java

@ -31,8 +31,8 @@ public class BaseResultModel {
    public enum statusEm {
        success(10000, "请求成功"),//请求成功
        error_Appid(-9000, "appid不存在"),//appid不存在
        error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
        error_Appid(40004, "appid不存在"),//appid不存在
        error_AppSecret(40001, "AppSecret不存在"),//AppSecret不存在
        token_out_effect(-9002, "无效的token"),//token无效
        token_no_power(-9003, "用户没权限"),// 没权限 包括未授权 或者uri错误
        token_out_time(-9004, "accesstoken已过期"),//token无效

+ 91 - 49
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java

@ -10,10 +10,8 @@ import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.jw.datainput.DataBodySignsDO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -52,6 +50,14 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
    @Autowired
    private DeviceHealthyInfoMappingDao deviceHealthyInfoMappingDao;
    private String bloodSugarUnit = "mmol/L";
    private String bloodPressureUnit = "mmHg";
    private String pulseUnit = "bpm";
    private String heightUnit = "cm";
    private String weightUnit = "kg";
    private String bmiUnit = "kg/m^2";
    private String waistUnit = "cm";
    public void initIHealthIntoEs(){
        try {
            Integer id = 0;
@ -74,7 +80,7 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
                        DeviceHealthyInfoMapping info = new DeviceHealthyInfoMapping();
                        info.setCreateTime(new Date());
                        info.setIndexId(one.getLong("id"));
                        info.setRid(tmp.getJSONArray("data").getJSONObject(0).getString("rid"));
                        info.setRid(tmp.getString("rid"));
                        infos.add(info);
                    }
                }
@ -94,7 +100,7 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
                deviceHealthyInfoMappingDao.save(infos);
                //下一次
                id = list.get(list.size()-1).getInteger("id");
                list = myJdbcTemplate.queryJson(sql,new Object[]{id});
//                list = myJdbcTemplate.queryJson(sql,new Object[]{id});
            }
        }catch (Exception e){
@ -110,7 +116,6 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
    public String initUpload(JSONObject jsonObject){
        JSONObject json = new JSONObject();
        Integer type = jsonObject.getInteger("type");
        json.put("access_token","iHealth");
        json.put("data_source","iHealth");
        json.put("sn",StringUtils.trimToEmpty(jsonObject.getString("device_sn")));
        json.put("ext_code",StringUtils.trimToEmpty(jsonObject.getString("user_type")));
@ -119,54 +124,111 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
            json.put("device_model",StringUtils.trimToEmpty(jsonObject.getString("device_name")));
        }else{
            //历史数据未绑定居民
            String sql = "SELECT i.device_code,i.device_model,i.device_name from device.wlyy_devices i WHERE device_code = '"+jsonObject.getString("device_sn")+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            if(list.size()>0){
                json.put("device_name",StringUtils.trimToEmpty(list.get(0).get("device_name").toString()));
                json.put("device_model",StringUtils.trimToEmpty(list.get(0).get("device_model").toString()));
            if(StringUtils.isNotEmpty(jsonObject.getString("device_sn"))){
                String sql = "SELECT i.device_code,i.device_model,i.device_name from device.wlyy_devices i WHERE device_code = '"+jsonObject.getString("device_sn")+"'";
                List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
                if(list.size()>0){
                    json.put("device_name",StringUtils.trimToEmpty(list.get(0).get("device_name").toString()));
                    json.put("device_model",StringUtils.trimToEmpty(list.get(0).get("device_model").toString()));
                }
            }
        }
        json.put("idcard",StringUtils.trimToEmpty(jsonObject.getString("idcard")));
        json.put("username",StringUtils.trimToEmpty(jsonObject.getString("name")));
        json.put("usercode",StringUtils.trimToEmpty(jsonObject.getString("user")));
        json.put("del",StringUtils.trimToEmpty(jsonObject.getString("del")));
        json.put("status",getStatus(jsonObject.getString("status")));
        JSONArray jsonArray = new JSONArray();
        JSONObject js = new JSONObject();
        js.put("measure_time",subStringTime(jsonObject.getString("record_date")));
        js.put("del",StringUtils.trimToEmpty(jsonObject.getString("del")));
        js.put("status",getStatus(jsonObject.getString("status")));
        js.put("type",String.valueOf(type));
        String measure_time = subStringTime(jsonObject.getString("record_date"));
        switch (type){
            case 1:
                //血糖
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject blood_sugar = new JSONObject();
                blood_sugar.put("measure_time",measure_time);
                blood_sugar.put("type","BloodSugar");
                blood_sugar.put("sign_name","blood_sugar");
                blood_sugar.put("sign_value",jsonObject.getString("value1"));
                blood_sugar.put("sign_unit",bloodSugarUnit);
                jsonArray.add(blood_sugar);
                JSONObject blood_sugar_result = new JSONObject();
                blood_sugar_result.put("measure_time",measure_time);
                blood_sugar_result.put("type","BloodSugar");
                blood_sugar_result.put("sign_name","blood_sugar_result");
                blood_sugar_result.put("sign_value",jsonObject.getString("value2"));
                jsonArray.add(blood_sugar_result);
                break;
            case 2:
                //血压
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject systolic = new JSONObject();
                systolic.put("measure_time",measure_time);
                systolic.put("type","BloodPressure");
                systolic.put("sign_name","systolic");
                systolic.put("sign_value",jsonObject.getString("value1"));
                systolic.put("sign_unit",bloodPressureUnit);
                jsonArray.add(systolic);
                JSONObject diastolic = new JSONObject();
                diastolic.put("measure_time",measure_time);
                diastolic.put("type","BloodPressure");
                diastolic.put("sign_name","diastolic");
                diastolic.put("sign_value",jsonObject.getString("value2"));
                diastolic.put("sign_unit",bloodPressureUnit);
                jsonArray.add(diastolic);
                if(StringUtils.isNotBlank(jsonObject.getString("value3"))){
                    js.put("value3",jsonObject.getString("value3"));
                    JSONObject pulse = new JSONObject();
                    pulse.put("measure_time",measure_time);
                    pulse.put("type","BloodPressure");
                    pulse.put("sign_name","pulse");
                    pulse.put("sign_value",jsonObject.getString("value3"));
                    pulse.put("sign_unit",pulseUnit);
                    jsonArray.add(pulse);
                }
                break;
            case 3:
                //体重/身高/BMI
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject height = new JSONObject();
                height.put("measure_time",measure_time);
                height.put("type","Height");
                height.put("sign_name","height");
                height.put("sign_value",jsonObject.getString("value1"));
                height.put("sign_unit",heightUnit);
                jsonArray.add(height);
                JSONObject weight = new JSONObject();
                weight.put("measure_time",measure_time);
                weight.put("type","Height");
                weight.put("sign_name","weight");
                weight.put("sign_value",jsonObject.getString("value2"));
                weight.put("sign_unit",weightUnit);
                jsonArray.add(weight);
                if(StringUtils.isNotBlank(jsonObject.getString("value3"))){
                    js.put("value3",jsonObject.getString("value3"));
                    JSONObject bmi = new JSONObject();
                    bmi.put("measure_time",measure_time);
                    bmi.put("type","Height");
                    bmi.put("sign_name","bmi");
                    bmi.put("sign_value",jsonObject.getString("value3"));
                    bmi.put("sign_unit",bmiUnit);
                    jsonArray.add(bmi);
                }
                break;
            case 4:
                //腰围
                js.put("value1",jsonObject.getString("value1"));
                JSONObject waist = new JSONObject();
                waist.put("measure_time",measure_time);
                waist.put("type","Waist");
                waist.put("sign_name","waist");
                waist.put("sign_value",jsonObject.getString("value1"));
                waist.put("sign_unit",waistUnit);
                jsonArray.add(waist);
                break;
            default:
                break;
        }
        jsonArray.add(js);
        json.put("data",jsonArray);
        json.put("measure_data",jsonArray);
        //上传
        return json.toJSONString();
    }
@ -289,36 +351,16 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
            logger.error("json parse error,invalid json string");
            return null;
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        JSONArray jsonArray = jsonObject.getJSONArray("measure_data");
        if(null == jsonArray || jsonArray.size() == 0){
            logger.error("msg","parameter 'data' of json no exist");
            return null;
        }
        rowkey = RowKeyUtils.makeRowKey();
        jsonObject.put("rid",rowkey);//hbase的rowkey
        //循环数据,一组数据存一行,生成一个rowkey,并将该rowkey存到es中
        for(Object obj:jsonArray){
            JSONObject data = (JSONObject)obj;
            data.put("del","1"); //添加删除标记
            try {
                String measuretime = jsonObject.getString("measure_time");
                if(null == measuretime){
                    measuretime = DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss);
                }
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                data.put("rid",rowkey);//hbase的rowkey
            } catch (Exception e) {
                logger.error("make rowkey error");
                return null;
            }
        }
        return jsonObject;
    }

+ 11 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

@ -69,13 +69,17 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size,String name) throws ParseException {
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b   ");
        StringBuffer countSql = new StringBuffer("SELECT COUNT(b.id) count FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b   ");
        if (StringUtils.isNotBlank(name)){
            sql.append(" where b.method LIKE '%").append(name).append("%'OR b.interface_name LIKE '%").append(name).append("%'");
            countSql.append(" where b.method LIKE '%").append(name).append("%'OR b.interface_name LIKE '%").append(name).append("%'");
        }
        sql.append(" GROUP BY b.interface_name limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceLogDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
@ -85,7 +89,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
            resultList.add(target);
        });
        long count =list.size();
        long count = (long) mapList.get(0).get("count");
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);
    }
@ -101,17 +105,21 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE 1=1 ");
        StringBuffer countSql=new StringBuffer("SELECT COUNT(c.id) count FROM iot_interface_log c WHERE 1=1 ");
        if (StringUtils.isNotBlank(interfaceName)){
            sql.append(" and c.interface_name like'%").append(interfaceName).append("%'");
            countSql.append(" and c.interface_name like'%").append(interfaceName).append("%'");
        }
        if (StringUtils.isNotBlank(addressIP)){
            sql.append(" and c.address_ip='").append(addressIP).append("'");
            countSql.append(" and c.address_ip='").append(addressIP).append("'");
        }
        sql.append(" order by c.time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(IotInterfaceLogDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
        list.forEach(one->{
@ -120,7 +128,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
            resultList.add(target);
        });
        long count =list.size();
        long count = (long) mapList.get(0).get("count");
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);

+ 10 - 0
svr/svr-wlyy-health-bank/pom.xml

@ -25,6 +25,10 @@
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
@ -111,6 +115,12 @@
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>

File diff suppressed because it is too large
+ 7 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java