Pārlūkot izejas kodu

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

# Conflicts:
#	patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java
wangzhinan 7 gadi atpakaļ
vecāks
revīzija
4142223736

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -30,7 +30,7 @@ public class Message extends IdEntity {
	/** type
	 *  消息类型(1.是家庭签约信息  2.体征消息  3分配健管师 4.随访提醒 5.咨询回复提醒,6.续方咨询待审核提醒,7.续方消息待取药
	 *  8.续方支付成功后团队长分配健管师,9线下调整完成,10意见反馈 11账号申诉,12.协同服务 13.孕检提醒 14.文章提交审核消息  15、健康文章审核结果
	 *  16.专科医生申请签约消息
	 *  16.专科医生申请签约消息,17、家庭医生转诊预约消息
	 *  101患者申请取消签约、102患者同意取消签约、103患者拒绝取消签约、104患者填写了血糖记录、105患者填写了血压记录、106患者填写了体重记录、
	 *  107患者填写了腰围记录、108患者填写了运动记录、109患者填写了用药记录、110患者填写了饮食记录、111患者提交了问卷随访、112请求添加好友消息、
	 *  113入群消息、114群解散消息、115踢出群消息、116新的网络咨询、117网络咨询追问、

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

@ -3,11 +3,9 @@ package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zhangdan on 2018/7/2.
 */
public interface SurveyScreenResultDao extends PagingAndSortingRepository<SurveyScreenResult, Long> {
}
}

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

@ -60,7 +60,7 @@ 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,101,14,15) 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,101,14,15,16,17) 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")
@ -123,4 +123,17 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" select a from Message a where a.type=?2 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1' order by a.createTime desc ")
    List<Message> findUnReadByReceiverAndType(String receiver,Integer type);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = 16 order by a.czrq desc")
    List<Message> getSpecialistApply(String doctor,Integer read,Integer over);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 17 order by a.czrq desc")
    List<Message> getFamilyTransfer(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 18 order by a.czrq desc")
    List<Message> getFamilySign(String doctor);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = 17 order by a.czrq desc")
    List<Message> getFamilyTransferReadAndOver(String doctor,Integer read,Integer over);
}

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.message;
import com.alibaba.fastjson.JSONArray;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.message.Message;
@ -15,7 +16,6 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -224,6 +224,28 @@ public class MessageService extends BaseService {
            deviceMesJson.put("amount", 0);
        }
        //居民签约申请
        List<Message> familyList = messageDao.getFamilySign(doctor);
        JSONObject familyMesJson = new JSONObject();
        JSONArray array = new JSONArray();
        if (familyList != null && familyList.size() > 0) {
            familyMesJson.put("amount", familyList.size());
            for (int i=0;i<familyList.size();i++){
                JSONObject  familyJson = new JSONObject();
                familyJson.put("title", familyList.get(i).getTitle());
                familyJson.put("type", familyList.get(i).getType());
                familyJson.put("msg", familyList.get(i).getContent());
                familyJson.put("msgTime", DateUtil.dateToStrLong(familyList.get(i).getCreateTime()));
                familyJson.put("relationCode",familyList.get(i).getRelationCode());
                array.add(familyJson);
            }
            familyMesJson.put("lastMessage", array);
        }else{
            familyMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
@ -788,4 +810,57 @@ public class MessageService extends BaseService {
        jsonObject.put("deviceType",String.valueOf(deviceMap.get("deviceType")));
        return  jsonObject;
    }
    /**
     * 待处理状态
     *
     * @param doctor 医生code
     * @return
     */
    public JSONObject selectUntreated(String doctor){
        //专科医生签约平台
        List<Message> specialist = messageDao.getSpecialistApply(doctor,1,1);
        JSONObject specialistJson = new JSONObject();
        JSONArray array = new JSONArray();
        if (specialist != null && specialist.size() != 0){
            specialistJson.put("amount", specialist.size());
            for (int i=0;i<specialist.size();i++){
                JSONObject specialistObject = new JSONObject();
                specialistObject.put("title", specialist.get(i).getTitle());
                specialistObject.put("type", specialist.get(i).getType());
                specialistObject.put("msg", specialist.get(i).getContent());
                specialistObject.put("msgTime", DateUtil.dateToStrLong(specialist.get(i).getCreateTime()));
                specialistObject.put("relationCode",specialist.get(i).getRelationCode());
                array.add(specialistObject);
            }
            specialistJson.put("specialist",array);
        }
        //家庭医生转诊
        List<Message> familyList = messageDao.getFamilyTransferReadAndOver(doctor,1,1);
        JSONObject familyJson = new JSONObject();
        JSONArray arrayFamily = new JSONArray();
        if (familyList != null && familyList.size() != 0){
            familyJson.put("amount", familyList.size());
            for (int i=0;i<familyList.size();i++){
                JSONObject familyObject = new JSONObject();
                familyObject.put("title", familyList.get(i).getTitle());
                familyObject.put("type", familyList.get(i).getType());
                familyObject.put("msg", familyList.get(i).getContent());
                familyObject.put("msgTime", DateUtil.dateToStrLong(familyList.get(i).getCreateTime()));
                familyObject.put("relationCode",familyList.get(i).getRelationCode());
                array.add(familyObject);
            }
            familyJson.put("familyList",arrayFamily);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("specialist",specialistJson);
        jsonObject.put("familyList",familyJson);
        return jsonObject;
    }
}

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

@ -1,12 +1,18 @@
package com.yihu.wlyy.service.third.guahao;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.httplog.LogService;
@ -30,7 +36,7 @@ import java.util.*;
 * 厦门市民健康网挂号服务
 */
@Service
public class GuahaoXMService implements IGuahaoService {
public class GuahaoXMService extends BaseService implements IGuahaoService {
    private int nextDays = 8;  //一周内预约号
    private String ORG_LIST = "GetOrgListNew";//获取医院列表
@ -55,6 +61,13 @@ public class GuahaoXMService implements IGuahaoService {
    JwSmjkService jwSmjkService;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private SurveyScreenResultDao surveyScreenResultDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private LogService logService;
@ -64,10 +77,12 @@ public class GuahaoXMService implements IGuahaoService {
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 解析挂号后
     */
    private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
    private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
        String code = "";
        if (response.startsWith("error") || response.startsWith("System-Error")) {
            throw new Exception(response);
@ -80,6 +95,13 @@ public class GuahaoXMService implements IGuahaoService {
            throw new Exception(response);
        }
        Patient patient1 = null;
        try {
            patient1 = patientDao.findByCode(patient);
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("获取病人信息失败");
        }
        // 查询医生职称和头像
        GuahaoDoctor doctor = null;
        try{
@ -128,12 +150,40 @@ public class GuahaoXMService implements IGuahaoService {
        }
        // 保存预约记录
        patientReservationDao.save(reservation);
        PatientReservation patientReservation = patientReservationDao.save(reservation);
        if(StringUtils.isNotBlank(dcode)){
            Patient p = patientService.findByCode(patient);
            consultService.sendMucMessageBySingnType(dcode,dname,patient,"我已成功为您预约:" + startTime + "," + hospitalName + hosDeptName + doctorName + "医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='" + reservation.getId() + "'>点击查看详情</a>","1",p.getName());
        }
        if (StringUtils.isNoneBlank(surveyCode)){
            SurveyScreenResult surveyScreenResult = surveyScreenResultDao.findByCode(surveyCode);
            surveyScreenResult.setOrder(1);
            surveyScreenResult.setReservationCode(patientReservation.getCode());
            surveyScreenResultDao.save(surveyScreenResult);
            //发送消息
            Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent("您有一个居民开通专科服务");
            message.setRead(1);//设置未读
            message.setReceiver(doctorId);//设置接受医生的code
            message.setSender(patient);//设置发送的用户
            message.setSenderName(patientName);
            message.setCode(getCode());
            message.setSenderPhoto(patient1.getPhoto());
            message.setTitle("专科医生共管通知");
            message.setType(17);//家庭签约取消信息
            message.setReadonly(1);//是否只读消息
            message.setSex(patient1.getSex());
            message.setOver("1");//未处理
            message.setRelationCode(patientReservation.getCode());
            message.setDel("1");
            message.setState(1);
            messageDao.save(message);
        }
        return code;
    }
@ -653,7 +703,7 @@ public class GuahaoXMService implements IGuahaoService {
            verificationXml(response,"获取医生排班表失败!",ORDER_CREATE,content,method,msgBody,res);
            //保存http日志
            logService.saveHttpLog(true,ORDER_CREATE,content,method,null,msgBody,res,null,logService.archiveType);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null,null);
        } else {
            throw new Exception("该排班信息错误或者不存在!");
        }
@ -1161,7 +1211,7 @@ public class GuahaoXMService implements IGuahaoService {
    /**
     * 转诊预约挂号
     */
    public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
    public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
        String re = "";
        Patient p = patientService.findByCode(patient);
@ -1177,7 +1227,7 @@ public class GuahaoXMService implements IGuahaoService {
            String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
        } else {
            throw new Exception("该排班信息错误或者不存在!");
        }

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

@ -2,8 +2,6 @@
package com.yihu.wlyy.service.third.guahao;
import com.yihu.wlyy.entity.patient.PatientReservation;
import java.util.List;
import java.util.Map;

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

@ -604,9 +604,11 @@ public class BookingController extends WeixinBaseController {
                                      @ApiParam(name = "dcode", value = "代预约医生编号", defaultValue = "test00000000005")
                                      @RequestParam(value = "dcode", required = true) String dcode,
                                      @ApiParam(name = "dname", value = "代预约医生名称", defaultValue = "组2全科医生")
                                      @RequestParam(value = "dname", required = true) String dname) {
                                      @RequestParam(value = "dname", required = true) String dname,
                                      @ApiParam(name="surveyCode",value = "筛选code")
                                      @RequestParam(value = "surverCode",required = false)String surveyCode) {
        try {
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
            //获取预约信息查询是否挂号成功
            PatientReservation obj = patientReservationService.findByCode(orderCode);
            if (obj != null) {