Browse Source

增加根据患者代码获取签约团队信息方法

Sand 8 years ago
parent
commit
c91e3cd44c

+ 6 - 0
src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -33,4 +33,10 @@ public interface DoctorAdminTeamDao extends
    Page<Patient> getHealthDoctorSigningPatients(@Param(value = "healthDoctorCode") String healthDoctorCode,
                                                 @Param(value = "generalDoctors") List<String> generalDoctors,
                                                 Pageable pageable);
    @Query("SELECT  t.id, t.name, d1.code, d1.name, d2.code, d2.name\n" +
            "FROM SignFamily f, Doctor d1, Doctor d2, AdminTeam t, AdminTeamMember m \n" +
            "WHERE d1.code = f.doctor AND f.doctorHealth = d2.code AND f.patient = :patientCode AND m.doctorCode = " +
            "d1.code AND m.teamId = t.id")
    Object getPatientSigningTeam(@Param("patientCode") String patientCode);
}

+ 15 - 0
src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -71,6 +71,21 @@ public class AdminTeamService extends BaseService {
        return team;
    }
    public Map<String, Object> getPatientSigningTeam(String patientCode){
        Object result[] = (Object[]) teamDao.getPatientSigningTeam(patientCode);
        if (result == null) return null;
        Map<String, Object> team = new HashMap<>();
        team.put("teamId", result[0]);
        team.put("teamName", result[1]);
        team.put("doctorCode", result[2]);
        team.put("doctorId", result[3]);
        team.put("healthDoctorCode", result[4]);
        team.put("healthDoctorId", result[5]);
        return team;
    }
    /**
     * 更新团队名称。
     *

+ 13 - 1
src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -10,7 +10,6 @@ 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.beanutils.BeanUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -181,6 +180,19 @@ public class AdminTeamController extends BaseController {
        }
    }
    @RequestMapping(value = "/team/members/{patient_code}", method = RequestMethod.GET)
    @ApiOperation(value = "根据患者代码,获取医生团队信息")
    public String getTeam(@PathVariable("patient_code") String patientCode) {
        try {
           Map<String, Object> team = teamService.getPatientSigningTeam(patientCode);
            return write(200, "OK", "data", new JSONObject(team));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/teams/{team_id}/signing/count", method = RequestMethod.GET)
    @ApiOperation(value = "获取团队医生的队内签约数量")
    public String getDoctorSignPatientCount(@PathVariable("team_id") long teamId) {