Browse Source

Merge branch 'dev' of linzhuo/patient-co-management into dev

linzhuo 8 năm trước cách đây
mục cha
commit
9b10e56ab3

+ 5 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -36,12 +36,12 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status >= 1")
    SignFamily findByPatientAndType(String patient, int type);
    SignFamily findByCode(String code);
    SignFamily findByCodeAndType(String code, Integer type);
    SignFamily findByFamilyCode(String familyCode);
    SignFamily findByTeamCode(String TeamCode);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
    SignFamily findByDoctorPatient(String doctor, String patient);
@ -292,6 +292,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status > 0")
    SignFamily findSignByPatient(String patient, int type);
    SignFamily findByCode(String code);
    @Query(" from SignFamily a where a.patient = ?1 and a.type = ?2 and (a.status=-3 or a.status=-4)  order by a.id desc")
    List<SignFamily> findLastJySignByPatient(String patient, int type);

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

@ -744,7 +744,7 @@ public class ConsultTeamService extends ConsultService {
        //推送给IM去创建议题,取得成员消息
        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), "咨询问题:"+consult.getSymptoms(), consult.getImages());
        users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
        JSONObject obj = ImUtill.createTopics(patient + "_consult_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, "1");
        JSONObject obj = ImUtill.createTopics(patient +"_"+ct.getTeam()+"_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
        if (obj == null) {
            throw new RuntimeException("IM消息发送异常!");
        }

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

@ -2362,6 +2362,86 @@ public class FamilyContractService extends BaseService {
        return result;
    }
    /**
     * 根据会话信息拉取对应的人员信息
     * @param sessionId
     * @return
     */
    public JSONObject getTeamDoctors(String sessionId,String doctor){
        String infos[] = sessionId.split("_");
        String patient  = infos[0];
        JSONObject result = new JSONObject();
        Map<String, JSONObject> docMap = new HashMap<>();
        SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
        SignFamily jtSign = null;
        if(checkPatient(patient)!=null){
            jtSign = signFamilyDao.findSignByPatient(patient, 2);
        }else{
            jtSign = signFamilyDao.findByTeamCode(infos[1]);
        }
        if (ssSign != null) {
            DoctorTeamMember member = doctorTeamDoctor.findSanshiByTeamAndType(ssSign.getTeamCode(), 1);
            if (member != null) {
                Doctor doc = doctorDao.findByCode(member.getMemberCode());
                JSONObject json = new JSONObject(doc);
                if (json.has("password")) {
                    json.remove("password");
                }
                if (json.has("salt")) {
                    json.remove("salt");
                }
                result.put("dutyDoctor", json);
            } else {
                result.put("dutyDoctor", "");
            }
            List<Doctor> doctors = adminTeamService.getMembers(ssSign.getAdminTeamId());
            if (doctors != null) {
                for (Doctor doc : doctors) {
                    if (doc.getCode().equals(doctor)) {
                        continue;
                    }
                    JSONObject json = new JSONObject(doc);
                    if (json.has("password")) {
                        json.remove("password");
                    }
                    if (json.has("salt")) {
                        json.remove("salt");
                    }
                    docMap.put(doc.getCode(), json);
                }
            }
        }
        if (jtSign != null) {
            List<Doctor> doctors = adminTeamService.getMembers(jtSign.getAdminTeamId());
            if (doctors != null) {
                for (Doctor doc : doctors) {
                    if (doc.getCode().equals(doctor)) {
                        continue;
                    }
                    JSONObject json = new JSONObject(doc);
                    if (json.has("password")) {
                        json.remove("password");
                    }
                    if (json.has("salt")) {
                        json.remove("salt");
                    }
                    docMap.put(doc.getCode(), json);
                }
            }
        }
        if (docMap.size() > 0) {
            result.put("teamDoctors", new JSONArray(docMap.values()));
        } else {
            result.put("teamDoctors", new JSONArray());
        }
        return result;
    }
    /**
     * 查询患者对应医生
     *

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

@ -1075,6 +1075,26 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        }
    }
    /**
     * 查询患者责任医生、团队医生
     * @return
     */
    @RequestMapping(value = "/consult_doctors", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getPatientConsultDoctor(@RequestParam String sessionId) {
        try {
            if (StringUtils.isEmpty(sessionId)) {
                return error(-1, "咨询会话ID不能为空");
            }
            JSONObject result = familyContractService.getTeamDoctors(sessionId, getUID());
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询患者签约医生
     *