Переглянути джерело

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wangzhinan 7 роки тому
батько
коміт
6d49d66a5d
29 змінених файлів з 371 додано та 114 видалено
  1. 2 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PayLogController.java
  2. 4 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/httplog/PayLogService.java
  3. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  4. 3 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/pay_log_list.jsp
  5. 13 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/pay_log_list_js.jsp
  6. 5 4
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/AsyncService.java
  7. 1 1
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DeviceTypeConvert.java
  8. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  9. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java
  10. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java
  11. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  12. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/disease/PatientDiseaseService.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  14. 18 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  15. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java
  16. 55 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  17. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java
  18. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/kit/JyKitService.java
  19. 122 50
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java
  20. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  21. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  22. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java
  23. 10 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java
  24. 23 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java
  25. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  26. 39 1
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  27. 2 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  28. 3 2
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  29. 2 1
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 2 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PayLogController.java

@ -38,10 +38,11 @@ public class PayLogController extends BaseController {
            @RequestParam(value = "params",required = false) String params,
            @RequestParam(value = "startDate",required = false) String startDate,
            @RequestParam(value = "endDate",required = false) String endDate,
            @RequestParam(value = "status",required = false) String status,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            Page<PayLog> payLogs = payLogService.searchList(params,startDate, endDate, page, pageSize);
            Page<PayLog> payLogs = payLogService.searchList(params,startDate, endDate, status, page, pageSize);
            return write(200,"操作成功",page,pageSize,payLogs);
        }catch (Exception ex){
            error(ex);

+ 4 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/httplog/PayLogService.java

@ -27,7 +27,7 @@ public class PayLogService extends BaseJpaService<PayLog,PayLogDao> {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Page<PayLog> searchList(String params, String startDate, String endDate, Integer page, Integer pageSize) throws Exception{
    public Page<PayLog> searchList(String params, String startDate, String endDate, String status, Integer page, Integer pageSize) throws Exception{
        List<PayLog> payLogList = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(page == null){
@ -49,7 +49,9 @@ public class PayLogService extends BaseJpaService<PayLog,PayLogDao> {
        if(!StringUtils.isEmpty(endDate)){
            filters.append("and create_time < '"+endDate+"' ");
        }
        if(!StringUtils.isEmpty(status)){
            filters.append("and status = '"+status+"' ");
        }
        payLogList = jdbcTemplate.query(sql+filters.toString()+" order by p.create_time desc"+" limit "+(page-1)*pageSize+","+pageSize, new BeanPropertyRowMapper<>(PayLog.class));
        if(payLogList.size()<=0){
            return new PageImpl<PayLog>(new ArrayList<>(), pageRequest, 0);

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java

@ -176,14 +176,14 @@ public class WlyyDeviceService {
            //判断设备厂商是否存在,不存在则存入
            if(StringUtils.isNotBlank(device.getManufacturerId())) {
                DeviceManufacturer manufacturer = deviceManufacturerDao.findByCode(device.getManufacturerId());
                if (manufacturer == null) {
                if (manufacturer == null && StringUtils.isNotBlank(device.getManufacturerCode()) && StringUtils.isNotBlank(device.getManufacturer())) {
                    manufacturer = new DeviceManufacturer();
                    manufacturer.setCode(device.getManufacturerId());
                    manufacturer.setManufacturerCode(device.getManufacturerCode());
                    manufacturer.setManufacturerName(device.getManufacturer());
                    manufacturer.setCzrq(new Date());
                    deviceManufacturerDao.save(manufacturer);
                }else {
                }else if(manufacturer != null){
                    device.setManufacturerCode(manufacturer.getManufacturerCode());
                    device.setManufacturer(manufacturer.getManufacturerName());
                }

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/pay_log_list.jsp

@ -26,6 +26,9 @@
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_endDate" placeholder="请输入查询结束日期" class="f-ml10" data-attr-scan="endDate"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_status" placeholder="请输入状态" class="f-ml10" data-attr-scan="status"/>
            </div>
            <sec:authorize url="/admin/paylog/list">
                <div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>查询</span>

+ 13 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/pay_log_list_js.jsp

@ -40,6 +40,7 @@
                $params: $("#inp_params"),//参数
                $startDate: $("#inp_startDate"),
                $endDate: $("#inp_endDate"),
                $status: $("#inp_status"),
                init: function () {
                    this.$element.show();
                    this.$element.attrScan();
@ -59,6 +60,17 @@
                        labelAlign: 'center',
                        cancelable: true
                    });
                    this.statusBox = this.$status.ligerComboBox({
                        width: 150,
                        data: [
                            {text: '失败', statusId: '0'},
                            {text: '成功', statusId: '1'},
                            {text: '已重试', statusId: '2'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    $("#inp_startDate").val(date);
                    this.bindEvents();
                },
@ -144,6 +156,7 @@
                reloadGrid: function (msg) {
                    retrieve.$element.attrScan();
                    var values = retrieve.$element.Fields.getValues();
                    values.status = retrieve.statusBox.getValue();
                    reloadGrid.call(this, values);
                },
            };

+ 5 - 4
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/AsyncService.java

@ -584,7 +584,7 @@ public class AsyncService extends BaseService{
     * @param deviceType
     */
    @Async
    public void addIntegral(String deviceSn,String type,String userType,String patientCode,Integer deviceType){
    public void addIntegral(String deviceSn,String type,String userType,String patientCode,Integer deviceType,String uploadTime){
        try {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            String hospital = "";
@ -601,7 +601,8 @@ public class AsyncService extends BaseService{
            PatientDevice patientDevice = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn,type,userType);
            boolean dataUoloadCount = true;
            if (patientDevice!=null){
                String today = DateUtil.getStringDateShort();
                //String today = DateUtil.getStringDateShort();
                uploadTime = uploadTime.substring(0,10);
                /*String startTime = today+" 00:00:00";
                String endTime = today+" 23:59:59";
                int dateType =1;
@ -616,10 +617,10 @@ public class AsyncService extends BaseService{
                //判断今天是否加过体征积分
                String urlSearch = wlyyService + "healthBank/selectByDate";
                List<NameValuePair> paramsSearch1 = new ArrayList<>();
                paramsSearch1.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"BP_MEASURE\",\"startTime\":\""+today+"\",\"endTime\":\""+today+"\",\"patientId\":\""+patientCode+"\"}"));
                paramsSearch1.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"BP_MEASURE\",\"startTime\":\""+uploadTime+"\",\"endTime\":\""+uploadTime+"\",\"patientId\":\""+patientCode+"\"}"));
                String responseSearch1 = HttpClientUtil.post(urlSearch, paramsSearch1, "UTF-8");
                List<NameValuePair> paramsSearch2 = new ArrayList<>();
                paramsSearch2.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"GLU_MEASURE\",\"startTime\":\""+today+"\",\"endTime\":\""+today+"\",\"patientId\":\""+patientCode+"\"}"));
                paramsSearch2.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"GLU_MEASURE\",\"startTime\":\""+uploadTime+"\",\"endTime\":\""+uploadTime+"\",\"patientId\":\""+patientCode+"\"}"));
                String responseSearch2 = HttpClientUtil.post(urlSearch, paramsSearch2, "UTF-8");
                com.alibaba.fastjson.JSONObject object1 = com.alibaba.fastjson.JSONObject.parseObject(responseSearch1);
                com.alibaba.fastjson.JSONObject object2 = com.alibaba.fastjson.JSONObject.parseObject(responseSearch2);

+ 1 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DeviceTypeConvert.java

@ -41,7 +41,7 @@ public class DeviceTypeConvert implements Convert {
        for (Map<String,Object> one : dict){
            String result = one.get("name")+"";
            if(dataModel.getServerType().equals(result)||dataModel.getServerType().indexOf(result)>0){
            if(dataModel.getServerType().equals(result)||dataModel.getServerType().indexOf(result)>=0){
                return one.get("code")+"";
            }
        }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -125,7 +125,7 @@ public class DoctorInterceptor extends BaseInterceptor {
            }
            Token token = null;
            Map<String, Token> tempMap = null;
            //Map<String, Token> tempMap = null;
            //1.50 登录缓存存储为redis
            if (platform == 2) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java

@ -36,7 +36,7 @@ public interface DoctorAdminTeamMemberDao extends
            "AND m.doctorCode = d.code AND t.available = true AND m.available = true ORDER BY d.level")
    List<Doctor> findAllMembers(@Param(value = "teamId") long teamId);
    @Query("SELECT d,m.available as available FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId " +
    @Query("SELECT distinct m.doctorCode,d,m.available as available FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId " +
            "AND m.doctorCode = d.code AND t.available = true ORDER BY d.level")
    List<Object[]> findMembers(@Param(value = "teamId") long teamId);

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java

@ -12,6 +12,7 @@ import java.util.List;
 */
public interface SpecialDiseaseDao extends PagingAndSortingRepository<SpecialDisease, Long>, JpaSpecificationExecutor<SpecialDisease> {
    @Query("from SpecialDisease where code=?1 and del=1")
    SpecialDisease findByCode(String code);
    List<SpecialDisease> findByDel(String del);

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -2828,5 +2828,21 @@ public class ConsultTeamService extends ConsultService {
        re.put("list",ja);
        return re.toString();
    }
    
    //判断居民家庭医生专科是否有共管关系
    public int getSpecialDoctorFamilyDoctorPatientCount(String patient,String special_doctor,String family_doctor){
        String sql = "SELECT " +
                "count(a.id) FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                "JOIN wlyy.wlyy_sign_family b " +
                "ON a.patient=b.patient " +
                "AND b.`status`=1 " +
                "WHERE a.sign_status> 0 " +
                "AND a.`status`>=0 " +
                "AND a.doctor='"+special_doctor+"' " +
                "AND (b.doctor='"+family_doctor+"' or b.doctor_health='"+family_doctor+"')" +
                "AND a.patient='"+patient+"'";
        int count = jdbcTemplate.queryForObject(sql,Integer.class);
        return  count;
    }
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/disease/PatientDiseaseService.java

@ -497,4 +497,25 @@ public class PatientDiseaseService extends BaseService {
            }
        }
    }
    
    public List<Map<String,Object>> getPatientDiseaseCount(String doctor, Long teamCode) {
        String sql ="SELECT " +
                "count(b.id) AS count," +
                "b.disease_name AS labelName," +
                "b.disease AS label " +
                "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                "JOIN wlyy.wlyy_patient_disease_server b ON a.patient=b.patient and b.del=1 " +
                "WHERE a.sign_status> 0 AND a.`status`>=0 " +
                "AND a.doctor='"+doctor+"' " +
                "GROUP BY b.disease";
    
        List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
        if(!result.isEmpty()){
            for (int i = 0; i < result.size(); i++) {
                result.get(i).put("labelType","7");
            }
        }
        
        return result;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -395,7 +395,7 @@ public class SignWebService extends BaseService {
                    "  (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                    " AND (expenses_status = '0' or expenses_status = '3')  " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +

+ 18 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -5616,6 +5616,8 @@ public class StatisticsESService {
            }
            if (hospitals != null && hospitals.size() > 0) {
                int amount = 0;
                int allNum = 0;
                for (Hospital hos : hospitals) {
                    if (hos.getCode().length() > 10) {
                        continue;
@ -5623,7 +5625,7 @@ public class StatisticsESService {
//                    String sql = " select count(DISTINCT p.doctor,p.device_sn) AS amount,p.doctor as doctorCode,r.name as doctorName from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and  p.doctor =r.code  LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where p.del=0 and p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "'  group by p.doctor,r.name";
                    String sql = " select count(*) as amount,if(a.doctor is null,'other',a.doctor) as doctorCode,if(a.NAME is null,'其他',a.NAME) as doctorName " +
                            " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                            "where p.del=0 and d.is_binding in (1,2) and d.grant_org_code ='" + hos.getCode() + "') a " +
                            "where p.del=0 and d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "') a " +
                            " GROUP BY a.doctor,a.name";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    for (Map<String, Object> one : list) {
@ -5632,9 +5634,23 @@ public class StatisticsESService {
                        obj.put("name", one.get("doctorName"));
                        obj.put("amount", one.get("amount"));
                        obj = deviceRateList(obj,hos);
                        if("other".equals(one.get("doctorCode")+"")){
                            amount += Integer.valueOf(obj.get("amount")+"");
                            allNum += Integer.valueOf(obj.get("allNum")+"");
                            continue;
                        }
                        resultList.add(obj);
                    }
                }
                Map<String, Object> otherObj = new HashMap<>();
                otherObj.put("code", "other");
                otherObj.put("name", "其他");
                otherObj.put("amount", amount);
                otherObj.put("allNum", allNum);
                otherObj.put("bindingNum", amount);
                otherObj.put("rate", getRange(amount, allNum, 2));//续签率是 续签量/去年的签约数
                otherObj.put("rateNum", getRangeNum(amount, allNum, 2));//续签率是 续签量/去年的签约数
                resultList.add(otherObj);
            }
//        }
        return resultList;
@ -5754,7 +5770,7 @@ public class StatisticsESService {
        String temp = "other".equals(reMap.get("code"))? " and p.doctor is null ":" and p.doctor='"+reMap.get("code")+"' ";
        String sql = " select count(1) as amount " +
                " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                " where d.is_binding in (1,2) and  d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
                " where d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
                " GROUP BY a.doctor,a.name";
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql);
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
@ -6159,14 +6175,6 @@ public class StatisticsESService {
//    }
    /**
     * 查询签约
     *
     * @param type      0 按周,1 按月
     * @param startDate
     * @param endDate
     * @return
     */
    /*public JSONArray getDeviceLine(String doctor, String type, String startDate, String endDate) throws Exception {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -442,9 +442,9 @@ public class AdminTeamService extends BaseService {
        int count = 0;
        members = memberDao.findMembers(teamId);
        for(Object[] member : members){
            Object[] obj = new Object[member.length + 1];
            System.arraycopy(member, 0, obj, 0, member.length);
            Doctor d = (Doctor) member[0];
            Object[] obj = new Object[member.length ];
            System.arraycopy(member, 1, obj, 0, member.length-1);
            Doctor d = (Doctor) member[1];
            count = signFamilyDao.countByAdminTeamId(teamId, d.getCode());
            obj[obj.length - 1] = count;
            list.add(obj);

+ 55 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -23,6 +23,9 @@ import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.specialist.TeamDiseaseRelationDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.label.SignPatientLabelService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
@ -71,6 +74,8 @@ public class SpecialistService extends BaseService {
    @Autowired
    private PatientDiseaseServerDao patientDiseaseServerDao;
    @Autowired
    private PatientDiseaseService patientDiseaseService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SpecialDiseaseDao specialDiseaseDao;
@ -84,6 +89,8 @@ public class SpecialistService extends BaseService {
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private AdminTeamService memberService;
    @Autowired
    SignPatientLabelService labelService;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
        if (list != null && list.size() > 0) {
@ -179,7 +186,10 @@ public class SpecialistService extends BaseService {
            List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type, 1, teamCode);
            return setPatientCount(list, doctor);
        } else {
        } else if("7".equals(type)){
            return patientDiseaseService.getPatientDiseaseCount(doctor,teamCode);
        }
        else {
            //非自定义标签
            List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type, 1);
@ -462,17 +472,19 @@ public class SpecialistService extends BaseService {
                String[] str = disease.split(",");
                for (String ds : str) {
                    SpecialDisease dis = specialDiseaseDao.findByCode(ds);
                    // 保存居民病种
                    PatientDiseaseServer server = new PatientDiseaseServer();
                    server.setCode(getCode());
                    server.setDel("1");
                    server.setSpecialistRelationCode(rs.getString("obj"));
                    server.setPatient(patient);
                    server.setPatientName(p.getName());
                    server.setDisease(dis.getCode());
                    server.setDiseaseName(dis.getName());
                    server.setCreateTime(new Date());
                    patientDiseaseServerDao.save(server);
                    if(dis!=null){
                        // 保存居民病种
                        PatientDiseaseServer server = new PatientDiseaseServer();
                        server.setCode(getCode());
                        server.setDel("1");
                        server.setSpecialistRelationCode(rs.getString("obj"));
                        server.setPatient(patient);
                        server.setPatientName(p.getName());
                        server.setDisease(dis.getCode());
                        server.setDiseaseName(dis.getName());
                        server.setCreateTime(new Date());
                        patientDiseaseServerDao.save(server);
                    }
                }
                // 添加签约申请消息
                Message message = new Message();
@ -537,11 +549,18 @@ public class SpecialistService extends BaseService {
        return mes;
    }
    public String agreeSpecialistTeam(String token, String state, String relationCode, String remark, Long mesId) throws Exception {
    public String agreeSpecialistTeam(String token, String state, String relationCode, String remark, Long mesId, String labelcode, String doctorcode) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("state", state);
        param.put("relationCode", relationCode);
        param.put("remark", remark);
        
        if(StringUtils.isNotBlank(doctorcode)){
            Doctor doctor = doctorDao.findByCode(doctorcode);
            param.put("health_assistant", doctorcode);//计管医生
            param.put("health_assistant_name", doctor.getName());//计管医生名称
        }
        HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/agreeSpecialistTeam", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
@ -568,6 +587,26 @@ public class SpecialistService extends BaseService {
                //推送给居民模板消息
                pushWeiTemp(token, "0", remark, p, d);
            } else {
    
                //保存居民健康情况标签
                if(StringUtils.isNotBlank(labelcode)){
                    SignPatientLabel signPatientLabel = labelService.getLabelByCodeAndType(labelcode,"8");
                    //先删除已有健康情况标签
                    signPatientLabelInfoDao.deleteByPatientAndLabelTypeAndStatus(p.getCode(),"8",1);
                    SignPatientLabelInfo signPatientLabelInfo = new SignPatientLabelInfo();
                    signPatientLabelInfo.setLabel(signPatientLabel.getLabelCode());
                    signPatientLabelInfo.setLabelType(signPatientLabel.getLabelType());
                    signPatientLabelInfo.setLabelName(signPatientLabel.getLabelName());
                    signPatientLabelInfo.setCzrq(new Date());
                    signPatientLabelInfo.setPatient(p.getCode());
                    signPatientLabelInfo.setPname(p.getName());
                    signPatientLabelInfo.setStatus(1);
                    //添加新的健康情况标签
                    signPatientLabelInfoDao.save(signPatientLabelInfo);
                    
                }
                
                
                //推送给居民模板消息
                pushWeiTemp(token, "1", "", p, d);
@ -629,6 +668,9 @@ public class SpecialistService extends BaseService {
            Long teamCode = json.getLong("teamCode");
            List<Doctor> members = memberService.getMembers(teamCode);
            json.put("doctors",members);
    
            List<SignPatientLabel> labels = labelService.getLabelsByTypeAndTeam("8", "");
            json.put("labels",labels);
            
            return json;
        }

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java

@ -1255,6 +1255,12 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
        if (p == null) {
            throw new Exception("患者信息不存在!");
        }
        
        //判断居民是否有签约
        List<SignFamily> sign = signFamilyDao.findSSandJTByIdcard(p.getIdcard());
        if(sign == null || sign.size()==0){
            throw new Exception("未签约患者不能预约10天号源!");
        }
        Map<String, String> map = objectMapper.readValue(arrangeDate, Map.class);
        if (map.containsKey("sectionType") && map.containsKey("startTime")) {

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/kit/JyKitService.java

@ -31,6 +31,8 @@ public class JyKitService {
    @Value("${juye.companyCode}")
    private String companyCode;
    @Value("${juye.companySecret}")
    private String companySecret;
    @Value("${juye.url}")
    private String jyUrl;
    @Autowired
@ -41,7 +43,7 @@ public class JyKitService {
    private String timeTermRedisKey = "juye:getToken:time_term";
    private String tokenRedisKey = "juye:getToken:token";
    /****************************************接口路径 start**************************************************/
    /****************************************接口路径 start****************************************************/
    private String kitBinding = "companyBindDevice";//药盒绑定接口
    private String getKitSetInfo = "getInfoByDeviceSn";//获取药盒设置信息接口
    private String getKitToken = "getToken";//获取巨烨token
@ -186,6 +188,7 @@ public class JyKitService {
     */
    public String getRequestPost(List<NameValuePair> params,String url) throws Exception{
        params.add(new BasicNameValuePair("company_code", companyCode));
        params.add(new BasicNameValuePair("company_secret", companySecret));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
@ -198,7 +201,7 @@ public class JyKitService {
     * @throws Exception
     */
    public String getRequestGet(List<NameValuePair> params,String url) throws Exception{
        String paramStr="?company_code="+companyCode;
        String paramStr="?company_code="+companyCode+"&company_secret="+companySecret;
        for(NameValuePair one : params){
            paramStr += "&"+one.getName()+"="+one.getValue();
        }

+ 122 - 50
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -10,18 +10,21 @@ import com.yihu.wlyy.entity.device.PatientDeviceLog;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.manage.User;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.health.repository.DeviceDetailDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.manage.UserDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientDeviceLogDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.device.DeviceDetailService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.util.*;
import net.sf.json.JSONArray;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringEscapeUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -67,6 +70,8 @@ public class DataHandingService {
    private CreditLogService creditLogService;
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Transactional
    public String producePatientAndDoctorPassword() {
@ -298,28 +303,33 @@ public class DataHandingService {
    public boolean updateDeviceDefalut(){
        boolean flag = true;
        try{
            String deviceSql = "SELECT wd.*,dd.category_code,dd.is_multi_user FROM device.wlyy_devices wd LEFT JOIN wlyy.dm_device dd ON wd.device_model = dd.model";
            //String deviceSql = "SELECT wd.*,dd.category_code,dd.is_multi_user FROM device.wlyy_devices wd LEFT JOIN wlyy.dm_device dd ON wd.device_model = dd.model";
            String deviceSql ="SELECT wd.*,dd.category_code,dd.is_multi_user FROM device.wlyy_devices wd LEFT JOIN wlyy.dm_device dd ON wd.device_model = dd.model where dd.category_code IN(1,2) AND (wd.binding_count IS NULL OR wd.binding_count='' OR wd.binding_count='null')";
            List<Map<String,Object>> deviceDetailList = jdbcTemplate.queryForList(deviceSql);
            //把wlyy_devices库里bindCount先补充默认值
            List<String> deviceSqlList = new ArrayList<>();
            for (Map<String,Object> deviceMap : deviceDetailList){
                String bindingCount="";
                if (StringUtils.isEmpty(String.valueOf(deviceMap.get("binding_count"))) || StringUtils.pathEquals("null",String.valueOf(deviceMap.get("binding_count")))){
                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(String.valueOf(deviceMap.get("is_multi_user"))) && StringUtils.pathEquals("0",String.valueOf(deviceMap.get("is_multi_user")))){
               /* if (StringUtils.isEmpty(String.valueOf(deviceMap.get("binding_count"))) || StringUtils.pathEquals("null",String.valueOf(deviceMap.get("binding_count")))){
                    }*/
                if (org.apache.commons.lang3.StringUtils.isNotEmpty(String.valueOf(deviceMap.get("is_multi_user"))) && StringUtils.pathEquals("0",String.valueOf(deviceMap.get("is_multi_user")))){
                    bindingCount="{\"1\":\"0\"}";
                }else if (org.apache.commons.lang3.StringUtils.isNotEmpty(String.valueOf(deviceMap.get("is_multi_user"))) && StringUtils.pathEquals("1",String.valueOf(deviceMap.get("is_multi_user")))){
                    bindingCount="{\"1\":\"0\",\"2\":\"0\"}";
                }else if (StringUtils.isEmpty(String.valueOf(deviceMap.get("is_multi_user"))) || StringUtils.pathEquals("null",String.valueOf(deviceMap.get("is_multi_user")))){
                    if (String.valueOf(deviceMap.get("device_name")).contains("血糖")){
                        bindingCount="{\"1\":\"0\"}";
                    }else if (org.apache.commons.lang3.StringUtils.isNotEmpty(String.valueOf(deviceMap.get("is_multi_user"))) && StringUtils.pathEquals("1",String.valueOf(deviceMap.get("is_multi_user")))){
                    }
                    if (String.valueOf(deviceMap.get("device_name")).contains("血压")){
                        bindingCount="{\"1\":\"0\",\"2\":\"0\"}";
                    }
                    if (StringUtils.isEmpty(String.valueOf(deviceMap.get("device_name")))){
                        bindingCount="{\"1\":\"0\",\"2\":\"0\"}";
                    }else if (StringUtils.isEmpty(String.valueOf(deviceMap.get("is_multi_user"))) || StringUtils.pathEquals("null",String.valueOf(deviceMap.get("is_multi_user")))){
                        if (String.valueOf(deviceMap.get("device_name")).contains("血糖")){
                            bindingCount="{\"1\":\"0\"}";
                        }
                        if (String.valueOf(deviceMap.get("device_name")).contains("血压")){
                            bindingCount="{\"1\":\"0\",\"2\":\"0\"}";
                        }
                    }
                    //String updateDeviceSql = ;
                    deviceSqlList.add("UPDATE device.wlyy_devices SET binding_count='"+bindingCount +"' where device_code='"+String.valueOf(deviceMap.get("device_code"))+"'");
                }
                //String updateDeviceSql = ;
                deviceSqlList.add("UPDATE device.wlyy_devices SET binding_count='"+bindingCount +"' where device_code='"+String.valueOf(deviceMap.get("device_code"))+"'");
            }
            if (deviceSqlList.size()>0){
                String deviceStr[] = new String[deviceSqlList.size()];
@ -329,24 +339,28 @@ public class DataHandingService {
            //更新grant_org_code字段
            List<String> deviceNoCodeSqlList = new ArrayList<>();
            String orgCodeSql = "SELECT * FROM device.wlyy_devices WHERE grant_org_code IS NULL OR grant_org_code =''";
            String orgCodeSql = "SELECT * FROM device.wlyy_devices WHERE grant_org_code IS NULL OR grant_org_code ='' OR grant_org_code='null'";
            List<DeviceDetail> noOrgList = jdbcTemplate.query(orgCodeSql,new BeanPropertyRowMapper<>(DeviceDetail.class));
            if (noOrgList!=null && noOrgList.size()>0){
                for (DeviceDetail deviceDetail:noOrgList){
                    String orgCode = "";
                    if (deviceDetail.getOrgName().contains("嵩屿")){
                        orgCode = "3502050100";
                    }
                    if (deviceDetail.getOrgName().contains("石塘")){
                        orgCode = "3502050200";
                    }
                    if (deviceDetail.getOrgName().contains("东孚")){
                        orgCode = "3502050300";
                    }
                    if (deviceDetail.getOrgName().contains("新阳")){
                        orgCode = "3502050400";
                    if (!StringUtils.isEmpty(deviceDetail.getOrgName())){
                        if (deviceDetail.getOrgName().contains("嵩屿")){
                            orgCode = "3502050100";
                        }
                        if (deviceDetail.getOrgName().contains("石塘")){
                            orgCode = "3502050200";
                        }
                        if (deviceDetail.getOrgName().contains("东孚")){
                            orgCode = "3502050300";
                        }
                        if (deviceDetail.getOrgName().contains("新阳")){
                            orgCode = "3502050400";
                        }
                        if (org.apache.commons.lang3.StringUtils.isNotBlank(orgCode)){
                            deviceNoCodeSqlList.add("UPDATE device.wlyy_devices SET grant_org_code='"+orgCode+"' where id='"+deviceDetail.getId()+"'");
                        }
                    }
                    deviceNoCodeSqlList.add("UPDATE device.wlyy_devices SET grant_org_code='"+orgCode+"' where id='"+deviceDetail.getId()+"'");
                }
                if (deviceNoCodeSqlList.size()>0){
                    String deviceNoCodeStr[] = new String[deviceNoCodeSqlList.size()];
@ -364,7 +378,7 @@ public class DataHandingService {
    @Transactional(rollbackFor = Exception.class)
    public void updateDevice()throws Exception{
        //String patientDeviceSql = "SELECT pd.*,sf.admin_team_code,sf.hospital FROM wlyy_patient_device pd LEFT JOIN wlyy_sign_family sf ON pd.`user` = sf.patient where sf.`status`>0 GROUP BY pd.id";
        String patientDeviceSql = "SELECT pd.id,pd.device_id AS deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.`user`,pd.user_type userType,pd.czrq,sf.admin_team_code,sf.hospital,sf.hospital_name orgName FROM wlyy_patient_device pd LEFT JOIN wlyy_sign_family sf ON pd.`user` = sf.patient where sf.`status`>0 GROUP BY pd.id";
        String patientDeviceSql = "SELECT pd.id,pd.device_id AS deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.`user`,pd.user_type userType,pd.czrq FROM wlyy_patient_device pd where pd.category_code in(1,2) GROUP BY pd.id";
        List<Map<String,Object>> patientDeviceList = jdbcTemplate.queryForList(patientDeviceSql);
        String deviceSql = "SELECT * FROM device.wlyy_devices";
        List<DeviceDetail> deviceDetailList = jdbcTemplate.query(deviceSql,new BeanPropertyRowMapper<>(DeviceDetail.class));
@ -405,36 +419,64 @@ public class DataHandingService {
                if (deviceDetail.getDeviceCode().equals(deviceSn)){
                    i++;
                }
            }
            //判断wlyy_device里的bindCount是否正确 正确无需更新
            DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
            int count = 0;
            if (deviceDetail!=null && org.apache.commons.lang3.StringUtils.isNotBlank(deviceDetail.getBindingCount())){
                JSONObject jsonObject = new JSONObject(deviceDetail.getBindingCount());
                Iterator iterator = jsonObject.keys();
                while(iterator.hasNext()) {
                    count += jsonObject.getInt((String) iterator.next());
                }
            }
            PatientDevice patientDevice = MapListUtils.convertMap2Bean(patientDeviceMap,PatientDevice.class);
            if (i==1){
                List<String> userTypeList = map.get(patientDevice.getDeviceSn());
                String bindCount = "";
                int size = userTypeList.size();
                if (size==1){
                    if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==1){
                        bindCount = "{\"1\":\"1\",\"2\":\"0\"}";
                    }else if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==2){
                        bindCount = "{\"1\":\"0\",\"2\":\"1\"}";
                    }else if (Integer.valueOf(patientDevice.getUserType())<0){
                        bindCount = "{\"1\":\"1\"}";
                    }
                }else if (size>1){
                    if (Integer.valueOf(patientDevice.getUserType())>0){
                        bindCount = "{\"1\":\"1\",\"2\":\"1\"}";
                    }else if (Integer.valueOf(patientDevice.getUserType())<0){
                        bindCount = "{\"1\":\"2\"}";
            if (count!=i){
                if (i==1){
                    List<String> userTypeList = map.get(patientDevice.getDeviceSn());
                    String bindCount = "";
                    int size = userTypeList.size();
                    if (size==1){
                        if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==1){
                            bindCount = "{\"1\":\"1\",\"2\":\"0\"}";
                        }else if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==2){
                            bindCount = "{\"1\":\"0\",\"2\":\"1\"}";
                        }else if (Integer.valueOf(patientDevice.getUserType())<0){
                            bindCount = "{\"1\":\"1\"}";
                        }
                    }else if (size>1){
                        if (Integer.valueOf(patientDevice.getUserType())>0){
                            bindCount = "{\"1\":\"1\",\"2\":\"1\"}";
                        }else if (Integer.valueOf(patientDevice.getUserType())<0){
                            bindCount = "{\"1\":\"2\"}";
                        }
                    }
                   /* String sql = "UPDATE device.wlyy_devices SET is_grant=1,grant_admin_team='"+String.valueOf(patientDeviceMap.get
                            ("admin_team_code"))+"',grant_org_code='"+String.valueOf(patientDeviceMap.get("hospital"))+"',is_binding="+size+",binding_count='"+bindCount
                            +"',grant_time='"+DateUtil.dateToStr(patientDevice.getCzrq(),"yyyy-MM-dd HH:mm:ss")+"',org_name='"+String.valueOf(patientDeviceMap.get("orgName"))+"' where device_code='"+patientDevice.getDeviceSn()+"'";
                    sqlList.add(sql);*/
                    String sql = "UPDATE device.wlyy_devices SET is_grant=1,is_binding="+size+",binding_count='"+bindCount
                            +"',grant_time='"+DateUtil.dateToStr(patientDevice.getCzrq(),"yyyy-MM-dd HH:mm:ss")+"' where device_code='"+patientDevice.getDeviceSn()+"'";
                    sqlList.add(sql);
                }
                String sql = "UPDATE device.wlyy_devices SET is_grant=1,grant_admin_team='"+String.valueOf(patientDeviceMap.get
                        ("admin_team_code"))+"',grant_org_code='"+String.valueOf(patientDeviceMap.get("hospital"))+"',is_binding="+size+",binding_count='"+bindCount
                        +"',grant_time='"+DateUtil.dateToStr(patientDevice.getCzrq(),"yyyy-MM-dd HH:mm:ss")+"',org_name='"+String.valueOf(patientDeviceMap.get("orgName"))+"' where device_code='"+patientDevice.getDeviceSn()+"'";
                sqlList.add(sql);
            }
            //如果wlyy_devices表里没有对应的数据 则增加一条。
            if (i==0){
                String bindCount = "";
                String user= String.valueOf(patientDeviceMap.get("user"));
                SignFamily signFamily = signFamilyDao.findByPatient(user);
                if (signFamily==null && signFamilyDao.findLastJySignByPatient(user,2)!=null){
                    signFamily = signFamilyDao.findLastJySignByPatient(user,2).get(0);
                }
                String adminTeam="";
                String orgName ="";
                String orCode ="";
                if (signFamily!=null){
                    adminTeam=String.valueOf(signFamily.getAdminTeamId());
                    orgName = signFamily.getHospitalName();
                    orCode = signFamily.getHospital();
                }
                if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==1){
                    bindCount = "{\"1\":\"1\",\"2\":\"0\"}";
                }else if (Integer.valueOf(patientDevice.getUserType())>0 && Integer.valueOf(patientDevice.getUserType())==2){
@ -442,12 +484,42 @@ public class DataHandingService {
                }else if (Integer.valueOf(patientDevice.getUserType())<0){
                    bindCount = "{\"1\":\"1\"}";
                }
                deviceDetailService.insertDevice(patientDevice,String.valueOf(patientDeviceMap.get("admin_team_code")),String.valueOf(patientDeviceMap.get("hospital_name")),String.valueOf(patientDeviceMap.get("hospital")),bindCount,1);
                deviceDetailService.insertDevice(patientDevice,adminTeam,orgName,orCode,bindCount,1);
            }
        }
        String[] sqlStr = new String[sqlList.size()];
        sqlStr = sqlList.toArray(sqlStr);
        jdbcTemplate.batchUpdate(sqlStr);
        //更新wlyy_device里的org_name grant_org_code grant_admin_team
        List<String> uSqlList = new ArrayList<>();
        //String noBindSql ="SELECT * FROM device.`wlyy_devices` WHERE (grant_admin_team IS NULL OR grant_admin_team ='' OR grant_admin_team='null' OR grant_org_code IS NULL OR grant_org_code='' OR grant_org_code='null' OR grant_org_code='' OR org_name IS NULL OR org_name= '' OR org_name='null')  AND is_binding>0";
        String noBindSql ="SELECT * FROM device.`wlyy_devices` WHERE (grant_admin_team IS NULL OR grant_admin_team ='' OR grant_admin_team='null' OR grant_org_code IS NULL OR grant_org_code='' OR grant_org_code='null' OR grant_org_code='')  AND is_binding>0";
        List<DeviceDetail> noBindDeviceList = jdbcTemplate.query(noBindSql,new BeanPropertyRowMapper<>(DeviceDetail.class));
        for (DeviceDetail deviceDetail: noBindDeviceList){
            for (Map<String,Object> map1:patientDeviceList){
                String deviceSn = String.valueOf(map1.get("deviceSn"));
                if (deviceDetail.getDeviceCode().equals(deviceSn)){
                    SignFamily signFamily = signFamilyDao.findByPatient(String.valueOf(map1.get("user")));
                    if (signFamily==null){
                        List<SignFamily> signFamilyList = signFamilyDao.findLastJySignByPatient(String.valueOf(map1.get("user")),2);
                        if (signFamilyList!=null && signFamilyList.size()>0){
                            signFamily = signFamilyDao.findLastJySignByPatient(String.valueOf(map1.get("user")),2).get(0);
                        }
                    }
                    if (signFamily!=null){
                        String sql = "UPDATE device.wlyy_devices SET is_grant=1,grant_admin_team='"+signFamily.getAdminTeamId()+"',grant_org_code='"+signFamily.getHospital()+"',is_binding=1 ,org_name='"+signFamily.getHospitalName()+"' where device_code='"+deviceSn+"'";
                        uSqlList.add(sql);
                    }
                }
            }
        }
        String[] uSqlStr = new String[uSqlList.size()];
        uSqlStr = uSqlList.toArray(uSqlStr);
        jdbcTemplate.batchUpdate(uSqlStr);
    }
    public void addPointOldDeviceBind()throws Exception{

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -302,9 +302,9 @@ public class DataHandlingController extends BaseController {
    public String updateDevice(){
        try {
            boolean flag = dataHandingService.updateDeviceDefalut();
            /*if (flag){
            if (flag){
                dataHandingService.updateDevice();
            }*/
            }
            return write(200,"清洗数据成功!");
        }catch (Exception e){
            e.printStackTrace();

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1227,13 +1227,14 @@ public class DoctorConsultController extends WeixinBaseController {
        try {
            String doctorCode = getUID();
            Doctor doctor = doctorService.findDoctorByCode(doctorCode);
            Patient p = patientService.findByCode(patient);
            com.alibaba.fastjson.JSONObject content = new com.alibaba.fastjson.JSONObject();
            content.put("name",p.getName());
            content.put("patient",patient);
            content.put("photo",p.getPhoto());
            content.put("age",IdCardUtil.getAgeForIdcard(p.getIdcard()));
            content.put("sex",IdCardUtil.getSexForIdcard(p.getIdcard()));
            content.put("sex",IdCardUtil.getSexForIdcard_new(p.getIdcard()));
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily!=null){
                content.put("hospitalName",signFamily.getHospitalName());

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -221,9 +221,12 @@ public class SpecialistController extends WeixinBaseController {
    public String agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true) String state,
                                      @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true) String relationCode,
                                      @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false) String remark,
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false) Long mesId) throws Exception {
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false) Long mesId,
                                      @ApiParam(name = "labelcode", value = "健康情况") @RequestParam(required = false) String labelcode,
                                      @ApiParam(name = "doctorcode", value = "协管医生") @RequestParam(required = false) String doctorcode
                                      ) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(getAccessToken(),state, relationCode, remark, mesId));
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(getAccessToken(),state, relationCode, remark, mesId,labelcode,doctorcode));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -231,7 +234,7 @@ public class SpecialistController extends WeixinBaseController {
    }
    @RequestMapping(value = "/findPatientSigninfo", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    @ApiOperation(value = "根据专科医生签约CODE获取相关信息")
    @ObserverRequired
    public String findPatientSigninfo(@ApiParam(name = "code", value = "专科医生签约code")
                                      @RequestParam(required = true) String code,

+ 10 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java

@ -72,16 +72,16 @@ public class PatientSpecialistController extends WeixinBaseController{
        }
    }
    @RequestMapping(value = "/agreeSpecialistTeam", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    public String agreeSpecialistTeam(String state,String relationCode,String remark,Long mesId)throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(getAccessToken(),state, relationCode, remark, mesId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
//    @RequestMapping(value = "/agreeSpecialistTeam", method = RequestMethod.GET)
//    @ApiOperation(value = "医生审核")
//    public String agreeSpecialistTeam(String state,String relationCode,String remark,Long mesId)throws Exception {
//        try {
//            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(getAccessToken(),state, relationCode, remark, mesId, labelcode, doctorcode));
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "请求失败");
//        }
//    }
    @RequestMapping(value = "/findPatientTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.web.third.zysoft;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.message.SMS;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.SMSDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
@ -80,6 +82,9 @@ public class BookingController extends WeixinBaseController {
    
    @Autowired
    private StringRedisTemplate redisTemplate;
    
    @Autowired
    private DoctorDao doctorDao;
    /**
@ -608,6 +613,24 @@ public class BookingController extends WeixinBaseController {
                                      @ApiParam(name="surveyCode",value = "筛选code",defaultValue = "a")
                                      @RequestParam(value = "surveyCode",required = false)String surveyCode) {
        try {
            
            String currentdoctorid = getUID();
            //获取当前登录的医生CODE,判断接口传递的代预约医生CODE是否一致
            if(StringUtils.isBlank(currentdoctorid) || !currentdoctorid.equals(dcode)){
                return error(-1, "创建挂号单失败10001:当前登录医生和代预约医生不一致!");
            }
    
            //判断接口传入的代预约医生CODE是否为空
            if(StringUtils.isBlank(dcode)){
                return error(-1, "创建挂号单失败10002:代预约医生不能为空!");
            }
    
            //判断接口传入的代预约医生CODE查询代预约医生是否存在
            Doctor doctor = doctorDao.findByCode(dcode);
            if(doctor == null || StringUtils.isBlank(doctor.getCode())){
                return error(-1, "创建挂号单失败:代预约的医生不存在!");
            }
            
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
            //获取预约信息查询是否挂号成功
            PatientReservation obj = patientReservationService.findByCode(orderCode);

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -883,8 +883,8 @@ public class WeiXinEventProcess {
        Map<String, String> articleConsult = new HashMap<>();
        articleConsult.put("Url", url);
        articleConsult.put("Title", "您有一个开通专科服务的邀请,点击查看");
        articleConsult.put("Description", "家庭医生协助专科医生团队为您提供专项服务");
        articleConsult.put("Title", "您正在申请开通专科服务,点击查看");
        articleConsult.put("Description", "共同为您提供健康管理保障");
        articleConsult.put("PicUrl", imgWebapp.getSpecialist_sign_url());
        articles.add(articleConsult);

+ 39 - 1
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -97,6 +97,43 @@ wechat:
   template_patient_bind_device: 1GWPw6LFcSuz2LFTo6LhE-YY8abtmcKRvor1fUzfxBE
    #积分到账通知
   template_healthbank_credit: A2L6WBm1p6bDPYGkGnUmoMvpWlRruP2lapYwHfLV7Rg
  imgUrl:
    #居民wifi图片地址
    patient_wifi_pic_url: group1/M00/00/B0/Cl8WjVtgHqaAcNKWAABYgyiykZs906.png
    #居民抽奖图片地址
    patient_draw_pic_url: group1/M00/00/B0/Cl8WjVtgGbWAYqumAADhRnoXe38057.png
    #专科医生签约图片地址
    specialist_sign_url: group1/M00/00/AE/Cl8WjFtgHZqAHpknAAH7mgUpbH0162.png
    #健康金图片地址
    doctor_activity_url: group1/M00/00/B0/Cl8WjVtgGbWAUJixAAAde0sVAJk652.png
    #通用活动图片地址
    currency_url: group1/M00/00/B0/Cl8WjVtgGbWAfZI4AAD7PWeBzLo954.png
    #就诊记录
    patient_visit_pic: group1/M00/00/AE/Cl8WjFtgIK-AAhmHAAEML2dpBxA906.png
    #检查检验
    patient_inspect_pic: group1/M00/00/B0/Cl8WjVtgGy6AAs61AAAxJl28nU8047.png
    #社区体检
    patient_examination_pic: group1/M00/00/B0/Cl8WjVtgGbWAVj77AAAg8pVTY9s660.png
    #处方记录
    patient_prescription_pic: group1/M00/00/AE/Cl8WjFtgHZqAXPgzAAAyHL8RzEU114.png
    #居民取药码
    patient_QRCode_pic: group1/M00/00/B0/Cl8WjVtgG4WAC7JDAAAV7lNAUpY772.png
    #居民产检计划
    patient_prenata_pic: group1/M00/00/AE/Cl8WjFtgHZqAVhwaAACK6PRmuEE754.png
    #居民免疫计划
    patient_immune_pic: group1/M00/00/B0/Cl8WjVtgG4WANg5iAAAckaOvfLQ582.png
    #医生咨询操作指南
    patient_operatinginstrutions_pic_url: group1/M00/00/B0/Cl8WjVtgG4WALvB0AAFkoQR6sbI214.png
    #预约挂号
    patient_booking_pic_url: group1/M00/00/AE/Cl8WjFtgG8qAc0LRAAAh07_OGxo533.png
    #设备绑定
    patient_device_pic_url: group1/M00/00/AE/Cl8WjFtgG8qANy56AAArKMof5DE911.png
    #我的家庭
    patient_family_pic_url: group1/M00/00/AE/Cl8WjFtgHZmAb043AAA5I5LejjI793.png
    #续签
    patient_sign_again_pic_url: group1/M00/00/B0/Cl8WjVtgG4WAV-8SAAAc2gFIWBc275.png
    #家庭医生签约1+1+N
    doctor_qrcode_pic_url: group1/M00/00/AE/Cl8WjFtgJGaAZ1VyAAD3GkV403w850.png
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
@ -184,4 +221,5 @@ ylz:
juye:
  url: http://api.zayata.com/index.php?s=/Company/Device/
  token: YTgzYjc2YWIzZjdjOTA1MTE0ODY2YjcyOGNkYWFmZWR6YXlhdGFjb21wYW55
  companyCode: 86350206000000001
  companyCode: 86350206000000001
  companySecret: ODZhZjg1OWM4YTQyMDNkMWU5MDkxNjE0YmRhODI5YmU=

+ 2 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -226,4 +226,5 @@ ylz:
#药盒请求巨烨的域名以及巨烨给予的公司编号
juye:
  url: http://zayata.oicp.net:30080/index.php?s=/Company/Device/
  companyCode: 86350206000000001
  companyCode: 86350206000000001
  companySecret: ODZhZjg1OWM4YTQyMDNkMWU5MDkxNjE0YmRhODI5YmU=

+ 3 - 2
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -225,7 +225,8 @@ ylz:
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway
#药盒请求巨烨的域名以及巨烨给予的公司编号
# 药盒请求巨烨的域名以及巨烨给予的公司编号
juye:
  url: http://api.zayata.com/index.php?s=/Company/Device/
  companyCode: 86350206000000001
  companyCode: 86350206000000001
  companySecret: ODZhZjg1OWM4YTQyMDNkMWU5MDkxNjE0YmRhODI5YmU=

+ 2 - 1
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -211,4 +211,5 @@ ylz:
    url: http://www.mstpay.com:1300/huangsb
juye:
  url: http://zayata.oicp.net:30080/index.php?s=/Company/Device/
  companyCode: 86350206000000001
  companyCode: 86350206000000001
  companySecret: ODZhZjg1OWM4YTQyMDNkMWU5MDkxNjE0YmRhODI5YmU=