Browse Source

Merge branch 'srdev' of yeshijie/patient-co-management into srdev

yeshijie 7 years ago
parent
commit
3ea82a2f8c

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -62,13 +62,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor, String patient, String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12,14) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12) and (a.del = '1' or a.del is null) ")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,14) and (a.del = '1' or a.del is null) ")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/concern/ConcernService.java

@ -120,6 +120,7 @@ public class ConcernService extends BaseService {
        message.setType(14);
        message.setSignStatus("1");
        message.setReadonly(1);//是否只读消息
        message.setData(concern.getCode());
        message.setDel("1");
        message.setRelationCode(patient.getCode());
        messageDao.save(message);
@ -185,6 +186,7 @@ public class ConcernService extends BaseService {
        message.setContent(content);
        message.setType(14);
        message.setSignStatus("-1");
        message.setData(concern.getCode());
        message.setReadonly(1);//是否只读消息
        message.setDel("1");
        message.setRelationCode(concern.getPatient());

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

@ -768,10 +768,10 @@ public class ConsultTeamService extends ConsultService {
        //自动关注 咨询关注
        ConcernDO concernDO = concernDao.findByPatientAndDoctor(patient,doctorCode);
        if(concernDO==null){
            concernService.addConcern(patient,doctorCode,3);
            concernDO = concernDao.findByPatientAndDoctor(patient,doctorCode);
        }
//        if(concernDO==null){
//            concernService.addConcern(patient,doctorCode,3);
//            concernDO = concernDao.findByPatientAndDoctor(patient,doctorCode);
//        }
        if (exist(patient, ct.getType(),doctorCode)) {
            re.put("status",-1);
@ -812,11 +812,12 @@ public class ConsultTeamService extends ConsultService {
        ct.setConsult(consult.getCode());
        //设置服务团队
        ct.setTeam(concernDO.getTeamCode());
        ct.setDoctor(doctorCode);
        //推送给IM去创建议题,取得成员消息
        JSONObject messages = imUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
        users.put(patient, 0);
        JSONObject obj = imUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
        JSONObject obj = imUtill.createTopics(patient + "_" + ct.getDoctor() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
        if (obj == null) {
            throw new RuntimeException("IM消息发送异常!");
        }

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

@ -1853,7 +1853,7 @@ public class FamilyContractService extends BaseService {
            filters.put("id", new SearchFilter("id", Operator.LT, id));
        }
        // 只查询未处理的消息
        filters.put("type", new SearchFilter("type", Operator.EQ, 1));
        filters.put("type", new SearchFilter("type", Operator.EQ, 14));
        filters.put("over", new SearchFilter("over", Operator.EQ, 1));
        filters.put("read", new SearchFilter("read", Operator.EQ, 1));
        Specification<Message> spec = DynamicSpecifications.bySearchFilter(filters.values(), Message.class);

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

@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.address.Street;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.concern.ConcernDO;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -17,6 +18,7 @@ import com.yihu.wlyy.repository.address.CountryDao;
import com.yihu.wlyy.repository.address.StreetDao;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.concern.ConcernDao;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
@ -130,6 +132,8 @@ public class SignWebService extends BaseService {
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private ConcernDao concernDao;
    /**
     * 厦门市
     */
@ -1051,23 +1055,19 @@ public class SignWebService extends BaseService {
        return object;
    }
    public JSONObject getSignServiceInfo(String signCode) throws Exception{
        SignFamily signFamily = signFamilyDao.findByCode(signCode);
        if (signFamily == null) {
            return new JSONObject();
        }
        String doctorHealth = signFamily.getDoctorHealth();
        String doctor = signFamily.getDoctor();
        Patient p = patientService.findByCode(signFamily.getPatient());
        String patient = p.getCode();
        String yearBegin = DateUtil.dateToStrShort(signFamily.getBegin()) + " 00:00:00";
        String yearEnd = DateUtil.dateToStrShort(signFamily.getEnd()) + " 23:59:59";
    public JSONObject getSignServiceInfo(String doctor,String patient) throws Exception{
//        ConcernDO concernDO = concernDao.findByPatientAndDoctor(patient,doctor);
//        Patient p = patientService.findByCode(patient);
//        String yearBegin = DateUtil.dateToStrShort(concernDO.getCreateTime()) + " 00:00:00";
//        String yearEnd = DateUtil.dateToStrShort(DateUtil.getNow()) + " 23:59:59";
        //获取咨询
        String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team  w where w.doctor = ? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team  w where w.doctor = ? and w.patient =? ";
        //获取随访
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and w.create_time>='"+yearBegin+"' and w.create_time<'"+yearEnd+"' and w.followup_class is not null";
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where w.doctor_code =? and w.patient_code =? and w.followup_class is not null";
        //获取待预约
        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
//        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where w.doctor =? and w.patient =? and w.czrq>='"+yearBegin+"' and w.czrq<'"+yearEnd+"'";
        //获取健康教育
//        String article_sql = "select w.id,w.article,w2.title,w2.summary,w.czrq,w.doctor,w.doctor_name,w.is_read,4 as type from wlyy_health_edu_article_patient  w,wlyy_health_edu_article w2 where w.article = w2.code and  (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
//        Date startTime = DateUtil.getBeginDayOfYear();
@ -1075,21 +1075,21 @@ public class SignWebService extends BaseService {
//        String startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
//        String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
        String start = elasticsearchUtil.changeTime(yearBegin);
        String end = elasticsearchUtil.changeTime(yearEnd);
        String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and (doctorCode='"+doctorHealth+"' or doctorCode='"+doctor+"') and createTime>='"+start+"' and createTime<'"+end+"'";
//        String start = elasticsearchUtil.changeTime(yearBegin);
//        String end = elasticsearchUtil.changeTime(yearEnd);
        String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and doctorCode='"+doctor+"'";
        //获取健康指导
        String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type  from wlyy_patient_health_guidance  w where (w.doctor = ? or w.doctor =?) and w.patient =? and w.czrq>='"+yearBegin+"' and  w.czrq<'"+yearEnd+"'";
        String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type  from wlyy_patient_health_guidance  w where  w.doctor =? and w.patient =? ";
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"));
        int year = calendar.get(Calendar.YEAR);
        //咨询量
        List<Map<String, Object>> consultResult = jdbcTemplate.queryForList(consult_sql, new Object[]{doctorHealth, patient});
        List<Map<String, Object>> consultResult = jdbcTemplate.queryForList(consult_sql, new Object[]{doctor, patient});
        //随访量
        List<Map<String, Object>> followupResult = jdbcTemplate.queryForList(followup_sql, new Object[]{doctorHealth, doctor, patient});
        List<Map<String, Object>> followupResult = jdbcTemplate.queryForList(followup_sql, new Object[]{ doctor, patient});
        //待预约量
        List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql, new Object[]{doctorHealth, doctor, patient});
//        List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql, new Object[]{doctor, patient});
        //健康教育量
//        List<Map<String, Object>> articleResult = jdbcTemplate.queryForList(article_sql, new Object[]{doctorHealth, doctor, patient, year});
//        List<HealthEduArticleES> esList = elasticsearchUtil.excute(article_sql, HealthEduArticleES.class, esIndex, esType);
@ -1103,13 +1103,14 @@ public class SignWebService extends BaseService {
            map.put("summary",str!=null?(str.length()>40?str.substring(0,40):str):"");
        }
        //健康指导量
        List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctorHealth, doctor, patient});
        List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctor, patient});
        List<JSONObject> objects = new ArrayList<>();
        int amount = consultResult.size() + followupResult.size() + reservationResult.size() + articleResult.size() + guidanceResult.size();
//        int amount = consultResult.size() + followupResult.size() + reservationResult.size() + articleResult.size() + guidanceResult.size();
        int amount = consultResult.size() + followupResult.size() + articleResult.size() + guidanceResult.size();
        int activeAmount = 0;
        objects.addAll(convertResult(consultResult));
        objects.addAll(convertResult(followupResult));
        objects.addAll(convertResult(reservationResult));
//        objects.addAll(convertResult(reservationResult));
        objects.addAll(convertResult(articleResult));
        objects.addAll(convertResult(guidanceResult));
        for (JSONObject object : objects) {

+ 14 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -1,22 +1,24 @@
package com.yihu.wlyy.web.doctor.sign;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.sign.PatientRemindService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -34,14 +36,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.WeixinBaseController;
import springfox.documentation.spring.web.json.Json;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
 * 医生端:家庭签约控制类
@ -691,7 +691,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    // 消息内容
                    json.put("message", msg.getContent());
                    // 签约code
                    json.put("signCode", StringUtils.isEmpty(msg.getData()) ? "" : msg.getData());
                    json.put("concernCode", StringUtils.isEmpty(msg.getData()) ? "" : msg.getData());
                    // 消息类型
                    json.put("type", msg.getType());
                    // 发送人标识

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

@ -343,6 +343,7 @@ public class ConsultController extends WeixinBaseController {
     * @param images   图片URL地址,多图以逗号分隔
     * @param voice    语音URL地址
     * @param doctor   咨询医生code
     * @param guidance   指导id
     * @return
     */
    @RequestMapping(value = "add")
@ -1109,7 +1110,7 @@ public class ConsultController extends WeixinBaseController {
            JSONArray participants = imUtill.getSessions(sessionId);
            //过滤续签
            consultTeamService.removeRenewPerson(participants,getRepUID());
//            consultTeamService.removeRenewPerson(participants,getRepUID());
            return write(200, "查询成功", "list", participants);
        } catch (Exception e) {

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignController.java

@ -288,9 +288,10 @@ public class PatientSignController extends BaseController {
    }
    @RequestMapping("/sign_service_info")
    public String getSignServiceInfo(@RequestParam(required = true) String signCode) {
    @ApiOperation(value = "获取关注服务信息")
    public String getSignServiceInfo(@RequestParam(required = true) String doctor) {
        try {
            JSONObject resultObj = signWebService.getSignServiceInfo(signCode);
            JSONObject resultObj = signWebService.getSignServiceInfo(doctor,getRepUID());
            return write(200, "查询成功!", "data", resultObj);
        } catch (Exception ex) {
            error(ex);

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

@ -31,8 +31,8 @@ wlyy:
  hospital: 49229004X # 默认医院code
im:
  im_list_get: http://172.19.103.88:3000/
  data_base_name: ichat
  im_list_get: http://192.168.131.24:3000/
  data_base_name: im_sr
#物联网配置
iot: