Browse Source

代码修改

yeshijie 7 years ago
parent
commit
083ac8e025

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/HealthMessageJob.java

@ -95,7 +95,7 @@ public class HealthMessageJob implements Job {
                String teamLeader=jdbcTemplate.queryForObject(sql,String.class,entry.getKey());
                Message message=new Message();
                message.setType(3);
                message.setRead(0);
                message.setRead(1);
                message.setOver("0");
                message.setDel("1");
                message.setSender("system");

File diff suppressed because it is too large
+ 11 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/Message.java


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

@ -6,6 +6,7 @@
package com.yihu.wlyy.repository.message;
import com.yihu.wlyy.entity.message.Message;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@ -51,10 +52,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) 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) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2)")
    @Query("select a from Message a where a.receiver = ?1 and a.read=?2 and a.type=?3 order by a.createTime desc")
    List<Message> getSysTemMessageByTypeAndRead(String doctor, Integer read, Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6)")
    List<Message> getSystemMessage(String doctor,Pageable pageRequest);
@ -66,7 +70,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    int setMessageReaded(String doctor,Integer type);
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2)")
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2,6)")
    @Modifying
    int setSysMessageReaded(String doctor);

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

@ -10,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.SignFamily;
@ -882,18 +883,20 @@ public class ConsultTeamService extends ConsultService {
            Prescription prescription = new Prescription();
            savePrescription(prescription,jwCode,doctor,p,ct,reason);
            String symptoms = p.getName()+"申请续方\n体征信息:";
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("title",p.getName()+"申请续方");
            //获取体征记录
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            if(devices!=null||devices.iterator().hasNext()){
                int count = messageDao.findTzMessage(patient);
                symptoms +="最近七天有"+count+"条异常记录";
                jsonObject.put("tzMsg","最近七天有"+count+"条异常记录");
            }else{
                symptoms +="居民未绑定体征设备";
                jsonObject.put("tzMsg","居民未绑定体征设备");
            }
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            jsonObject.put("lastTime","");
            String symptoms = jsonObject.toString();
            //创建咨询
            JSONObject users = new JSONObject();//咨询参与者
@ -956,6 +959,9 @@ public class ConsultTeamService extends ConsultService {
            cd.setTo(doctorCode);
            consultTeamDoctorDao.save(cd);
            //发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription,p);
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
@ -965,6 +971,32 @@ public class ConsultTeamService extends ConsultService {
        }
    }
    /**
     * 保存审核提醒消息
     * @param prescription
     * @param patient
     */
    public void addCheckMessage(Prescription prescription,Patient patient){
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setRead(1);//设置未读
        message.setOver("1");
        message.setReceiver(prescription.getDoctor());
        message.setSender(prescription.getPatient());
        message.setCode(getCode());
        message.setSex(patient.getSex());
        message.setSenderName(patient.getName());
        message.setSenderPhoto(patient.getPhoto());
        message.setTitle("续方申请");
        message.setContent("您有一条新的续方申请待处理!");
        message.setType(6);//续方咨询待审核提醒
        message.setReadonly(1);//是否只读消息
        message.setDel("1");
        message.setRelationCode(prescription.getConsult());
        messageDao.save(message);
    }
    /**
     * 保存续方信息
     * @param prescription

+ 17 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -11,7 +11,6 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -152,11 +151,28 @@ public class MessageService extends BaseService {
            systemJson.put("amount", 0);
        }
        //获取续方消息
        List<Message> prescriptionMessage = messageDao.getSysTemMessageByTypeAndRead(doctor,1,6);
        JSONObject prescriptionJson = new JSONObject();
        if (prescriptionMessage != null && prescriptionMessage.size() > 0) {
            prescriptionJson.put("amount", prescriptionMessage.size());
            JSONObject msgJson = new JSONObject();
            msgJson.put("title", systemMessage.get(0).getTitle());
            msgJson.put("type", systemMessage.get(0).getType());
            msgJson.put("msg", systemMessage.get(0).getContent());
            msgJson.put("msgTime", DateUtil.dateToStrLong(systemMessage.get(0).getCreateTime()));
            prescriptionJson.put("lastMessage", msgJson);
        } else {
            prescriptionJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
        json.put("healthIndex", indexJson);//健康指标
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        return json;
    }

+ 20 - 16
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
@ -13,7 +14,6 @@ import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
@ -162,7 +162,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -181,7 +181,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -199,7 +199,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -217,7 +217,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -235,7 +235,7 @@ public class ConsultController extends WeixinBaseController {
            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -254,7 +254,7 @@ public class ConsultController extends WeixinBaseController {
            JSONArray result = new JSONArray(unfinishedConsult);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -278,7 +278,7 @@ public class ConsultController extends WeixinBaseController {
                return write(200, "查询成功", "data", "");
            }
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -920,6 +920,7 @@ public class ConsultController extends WeixinBaseController {
        try{
            return success(ImUtill.getTopic(consult).get("data").toString());
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
@ -930,6 +931,7 @@ public class ConsultController extends WeixinBaseController {
            ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
            return write(200, "查询成功", "data", consultTeam);
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
@ -940,7 +942,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(String patient){
    public String isPrescriptConsult(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true)String patient){
        try{
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
@ -968,6 +970,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("添加续方咨询")
    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
                                         @RequestParam(value = "jwCode", required = true) String jwCode,
@ -982,8 +985,8 @@ public class ConsultController extends WeixinBaseController {
            consult.setType(8);//续方咨询
            consult.setAdminTeamId(adminTeamId);
            // 保存到数据库
            int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
//            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
//            int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
            if (res == -1) {
                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
            }
@ -1008,12 +1011,13 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方咨询列表")
    public String getPreConsultList(@RequestParam(required = false) String title,
                                    @RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
    public String getPreConsultList(@ApiParam(name = "title", value = "咨询标题") @RequestParam(required = false) String title,
                                    @ApiParam(name = "id", value = "第几页") @RequestParam(required = true) long id,
                                    @ApiParam(name = "pagesize", value = "页面大小") @RequestParam(required = true) int pagesize){
        try {
            JSONArray array = new JSONArray();
            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
//            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
            if (data != null) {
                for (Object consult : data.getContent()) {
                    if (consult == null) {
@ -1055,7 +1059,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "prescriptionDetail",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方信息")
    public String prescriptionDetail(@RequestParam(required = true) String consult){
    public String prescriptionDetail(@ApiParam(name = "consult", value = "咨询code") @RequestParam(required = true) String consult){
        try {
            JSONObject json = new JSONObject();