Parcourir la source

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

lyr il y a 8 ans
Parent
commit
f76fdc2025

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

@ -4,13 +4,16 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeamMember;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -42,6 +45,9 @@ public class AdminTeamService extends BaseService {
    @Autowired
    DoctorTeamMemberDao signingTeamMemberDao;
    @Autowired
    SignFamilyDao signFamilyDao;
    /**
     * 获取团队数量。
     *
@ -322,4 +328,31 @@ public class AdminTeamService extends BaseService {
        return teamsTogether;
    }
    /**
     * 查询居民与医生的签约团队
     *
     * @param patient 居民
     * @param doctor  医生
     * @return
     */
    public JSONArray findPatientDoctorTeam(String patient, String doctor) {
        JSONArray result = new JSONArray();
        SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
        SignFamily jtSign = signFamilyDao.findSignByPatient(patient, 2);
        if (ssSign != null && (doctor.equals(ssSign.getDoctor())
                || doctor.equals(ssSign.getDoctorHealth()))) {
            AdminTeam team = getTeam(ssSign.getAdminTeamId());
            result.put(new JSONObject(team));
        }
        if (jtSign != null && (doctor.equals(jtSign.getDoctor())
                || doctor.equals(jtSign.getDoctorHealth()))) {
            AdminTeam team = getTeam(jtSign.getAdminTeamId());
            result.put(new JSONObject(team));
        }
        return result;
    }
}

+ 23 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -15,6 +15,7 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
@ -74,7 +75,7 @@ public class AdminTeamController extends BaseController {
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    @ApiOperation(value = "删除团队信息")
    public String deleteTeam(@RequestParam("teamId") long teamId){
    public String deleteTeam(@RequestParam("teamId") long teamId) {
        try {
            teamService.deleteTeam(teamId);
@ -162,7 +163,7 @@ public class AdminTeamController extends BaseController {
//  @ApiOperation(value = "获取团队成员,排除自己和专科医生")
    public String getTeamMembersExcludedThisAndLevel3(@PathVariable("team_id") long teamId) {
        try {
            List<Doctor> members = memberService.getMembers(teamId,super.getUID());
            List<Doctor> members = memberService.getMembers(teamId, super.getUID());
            return write(200, "OK", "data", new JSONArray(copyBeans(members, "id", "code", "name", "hospital",
                    "jobName", "level", "sex", "photo")));
@ -211,7 +212,7 @@ public class AdminTeamController extends BaseController {
    public String getLeaderTeam(@PathVariable("doctor_code") String doctorCode) {
        try {
            AdminTeam team = teamService.findByLeaderCode(doctorCode);
            if(team == null){
            if (team == null) {
                return error(-2, "没有找到数据!");
            }
            return write(200, "OK", "data", new JSONObject(team));
@ -238,7 +239,7 @@ public class AdminTeamController extends BaseController {
    @ApiOperation(value = "根据患者代码,获取医生团队信息")
    public String getTeam(@PathVariable("patient_code") String patientCode) {
        try {
           Map<String, Object> team = teamService.getPatientSigningTeam(patientCode,super.getUID());
            Map<String, Object> team = teamService.getPatientSigningTeam(patientCode, super.getUID());
            return write(200, "OK", "data", new JSONObject(team));
        } catch (Exception e) {
@ -272,7 +273,7 @@ public class AdminTeamController extends BaseController {
            page = page <= 0 ? 0 : page - 1;
            List<Patient> patients = memberService.getMemberSigningPatients(teamId, healthDoctorCode, page, size);
            List<Map<String, Object>> simplifiedPatients = new ArrayList<>();
            for (Patient patient : patients){
            for (Patient patient : patients) {
                Map<String, Object> simplified = new HashMap<>();
                simplified.put("code", patient.getCode());
                simplified.put("name", patient.getName());
@ -280,7 +281,7 @@ public class AdminTeamController extends BaseController {
                simplified.put("photo", patient.getPhoto());
                simplified.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));
                List<SignPatientLabelInfo>  diseases = signPatientLabelInfoService.getPatientLabelByLabelType(patient.getCode(),"3");
                List<SignPatientLabelInfo> diseases = signPatientLabelInfoService.getPatientLabelByLabelType(patient.getCode(), "3");
                List<String> simplifiedDisease = diseases.stream().map(SignPatientLabelInfo::getLabelName).collect(Collectors.toList());
@ -296,4 +297,20 @@ public class AdminTeamController extends BaseController {
        }
    }
    @RequestMapping(value = "/teams/patient", method = RequestMethod.GET)
    @ApiOperation(value = "查询居民与当前医生的签约团队")
    public String getPatientAndDoctorTeam(@RequestParam String patient) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "居民不能为空");
            }
            JSONArray result = teamService.findPatientDoctorTeam(patient, getUID());
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}