Browse Source

签约相关接口修改

lyr 8 years ago
parent
commit
d0e8a7858d

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

@ -98,8 +98,6 @@ public class FamilyContractService extends BaseService {
    private SocialSecurityInfoDao socialSecurityInfoDao;
    @Autowired
    private SignPatientLabelInfoService labelInfoService;
    @Autowired
    private DoctorAdminTeamDao doctorAdminTeamDao;

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

@ -82,7 +82,7 @@ public class AdminTeamService extends BaseService {
        return team;
    }
    public Map<String, Object> getPatientSigningTeam(String patientCode, String currentDoctor){
    public Map<String, Object> getPatientSigningTeam(String patientCode, String currentDoctor) {
        List<Object> results = teamDao.findAdminTeamByPatientSignTeam(patientCode, new PageRequest(0, 1));
        if (results == null || results.size() == 0) return null;
@ -172,21 +172,21 @@ public class AdminTeamService extends BaseService {
     * @param doctorCode
     */
    public Pair<Integer, String> removeMember(long teamId, String doctorCode) {
        if(signingTeamMemberDao.isSanShiSigning(doctorCode)){
        if (signingTeamMemberDao.isSanShiSigning(doctorCode)) {
            return new ImmutablePair<>(403, "三师签约医生,不能删除");
        }
        Doctor doctor = doctorDao.findByCode(doctorCode);
        if (!doctor.isProfessionalDoctor()){
            if (doctor.isGeneralDoctor()){
        if (!doctor.isProfessionalDoctor()) {
            if (doctor.isGeneralDoctor()) {
                List<Doctor> doctorList = new ArrayList<>();
                doctorList.add(doctor);
                Integer count = getMemberSigningCount(teamId, doctorList).get(doctorCode);
                if (count != null || count > 0){
                    if (doctor.isGeneralDoctor()){
                if (count != null || count > 0) {
                    if (doctor.isGeneralDoctor()) {
                        return new ImmutablePair<>(403, "全科医生有签约关系,不可删除");
                    } else if (doctor.isHealthDoctor()){
                    } else if (doctor.isHealthDoctor()) {
                        return new ImmutablePair<>(403, "健康管理师仍有签约居民,请先转移签约居民");
                    }
                }
@ -203,8 +203,8 @@ public class AdminTeamService extends BaseService {
        return memberDao.findAllMembers(teamId);
    }
    public List<Doctor> getMembers(long teamId,String doctorCode) {
        return memberDao.findAllHeathExcludeThis(teamId,doctorCode);
    public List<Doctor> getMembers(long teamId, String doctorCode) {
        return memberDao.findAllHeathExcludeThis(teamId, doctorCode);
    }
    /**
@ -288,7 +288,30 @@ public class AdminTeamService extends BaseService {
        memberDao.save(member);
    }
    public AdminTeam findByLeaderCode(String leaderCode){
    public AdminTeam findByLeaderCode(String leaderCode) {
        return teamDao.findByLeaderCode(leaderCode);
    }
    /**
     * 查询两个医生的共同团队
     *
     * @param doctorOne
     * @param doctorTwo
     * @return
     */
    public List<AdminTeam> findDoctorsTeams(String doctorOne, String doctorTwo) {
        List<AdminTeam> teams = memberDao.findDoctorTeams(doctorOne);
        List<AdminTeam> teamsTogether = new ArrayList<>();
        if (teams != null && teams.size() > 0) {
            for (AdminTeam team : teams) {
                if (memberDao.findByTeamIdAndDoctorCodeOrderByDoctorCodeAsc(team.getId(), doctorTwo) != null) {
                    teamsTogether.add(team);
                }
            }
        }
        return teamsTogether;
    }
}

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

@ -2,13 +2,16 @@ package com.yihu.wlyy.web.doctor.sign;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.sign.ExpensesRemindService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.*;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
@ -56,6 +59,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    MessageService messageService;
    @Autowired
    ExpensesRemindService expensesRemindService;
    @Autowired
    AdminTeamService teamService;
    /**
     * 医生签约患者列表查询接口
@ -341,10 +346,15 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @RequestMapping(value = "getSanshiSign")
    @ResponseBody
    public String getSanshiSign(
            String patientCode) {
            String patientCode, @RequestParam(required = false) String signDoctor) {
        try {
            Map<String, Object> res = familyContractService.getSanshiSignByPatientCode(patientCode);
            if(String.valueOf(res.get("hasSanshi")).equals("true") && StringUtils.isNotEmpty(signDoctor)){
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor,String.valueOf(res.get("qkCode")));
                res.put("team",teams != null ? teams : new ArrayList<AdminTeam>());
            }
            return write(200, "获取消息列表成功!", "data", res);
        } catch (Exception e) {
            error(e);
@ -492,7 +502,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "patient_sanshi_signinfo")
    @ResponseBody
    public String getPatientSanshiSignByIdCard(String idCard) {
    public String getPatientSanshiSignByIdCard(String idCard,@RequestParam(required = false) String signDoctor) {
        try {
            if (StringUtils.isEmpty(idCard)) {
                return error(-1, "请输入身份证号!");
@ -530,6 +540,11 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            result = familyContractService.getSanshiSingInfoByPatientIdCard(idCard);
            if(result.getString("signStatus").equals("1") && StringUtils.isNotEmpty(signDoctor)){
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor,result.getString("doctor"));
                result.put("team",teams != null ? new JSONArray(teams) : new JSONArray());
            }
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败!");

+ 14 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.web.patient.account;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.TokenService;
@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springside.modules.utils.Encodes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -48,6 +51,8 @@ public class PatientController extends WeixinBaseController {
    private DrHealthTeamService doctorTeamService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    AdminTeamService teamService;
    /**
     * 患者基本信息查询接口
@ -324,7 +329,7 @@ public class PatientController extends WeixinBaseController {
     */
    @RequestMapping(value = "teachers")
    @ResponseBody
    public String teachers() {
    public String teachers(@RequestParam(required = false,defaultValue = "") String signDoctor) {
        try {
            String code = getUID();//getUID();
            // 查询签约信息
@ -338,6 +343,7 @@ public class PatientController extends WeixinBaseController {
            // 查询三师医生信息
            List<Doctor> doctors = doctorTeamService.findSanshiTeamDoctors(code);
            JSONArray jsonArray = new JSONArray();
            String qkDoctor = "";
            if (doctors != null) {
                for (Doctor doctor : doctors) {
                    if (doctor == null) {
@ -356,6 +362,7 @@ public class PatientController extends WeixinBaseController {
                        json.put("typename", "专科医生");
                    } else if (type == 2) {
                        json.put("typename", "全科医生");
                        qkDoctor = doctor.getCode();
                    } else if (type == 3) {
                        json.put("typename", "健康管理师");
                    } else {
@ -365,6 +372,12 @@ public class PatientController extends WeixinBaseController {
                    jsonArray.put(json);
                }
            }
            if(StringUtils.isNotEmpty(signDoctor)){
                List<AdminTeam> teams = teamService.findDoctorsTeams(signDoctor,qkDoctor);
                doctorJson.put("team",teams != null ? new JSONArray(teams) : new ArrayList<AdminTeam>());
            }
            doctorJson.put("list", jsonArray);
            return write(200, "查询成功!", "data", doctorJson);
        } catch (Exception e) {