Przeglądaj źródła

通过患者得到的行政团队增加当前团队长判断

Sand 8 lat temu
rodzic
commit
b0c885f532

+ 1 - 1
src/main/java/com/yihu/wlyy/job/consult/ConsultCleaner.java

@ -64,7 +64,7 @@ public class ConsultCleaner {
            System.out.println("计算下次任务执行时间,下次执行在" + nextTriggerTime.toString());
            //quartzHelper.startAt(nextTriggerTime, ConsultCleanerJob.class, ConsultTerminatorJobKey, null);
            quartzHelper.startAt(nextTriggerTime, ConsultCleanerJob.class, ConsultTerminatorJobKey, null);
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 9 - 8
src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -5,16 +5,13 @@ import com.yihu.wlyy.entity.patient.Patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
 * 行政团队DAO。
 * 
 *
 * @author Sand
 */
public interface DoctorAdminTeamDao extends
@ -61,14 +58,18 @@ public interface DoctorAdminTeamDao extends
     * @param patientCode
     * @return
     */
    @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" +
    @Query("SELECT t.id, t.name, t.leaderCode, d1.code, d1.name, d2.code," +
            " d2.name FROM SignFamily f, Doctor d1, Doctor d2, AdminTeam t, AdminTeamMember m " +
            "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);
    /**
     * 获取领导医生的行政团队。
     *
     * @param leaderCode
     * @return
     */
    @Query("SELECT t.id from AdminTeam t WHERE t.leaderCode = :leaderCode")
    Long findIdByLeaderCode(@Param("leaderCode") String leaderCode);
}

+ 6 - 5
src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -81,17 +81,18 @@ public class AdminTeamService extends BaseService {
        return team;
    }
    public Map<String, Object> getPatientSigningTeam(String patientCode){
    public Map<String, Object> getPatientSigningTeam(String patientCode, String currentDoctor){
        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("doctorName", result[3]);
        team.put("healthDoctorCode", result[4]);
        team.put("healthDoctorName", result[5]);
        team.put("isLeader", currentDoctor == null ? false : result[2].equals(currentDoctor));
        team.put("doctorCode", result[3]);
        team.put("doctorName", result[4]);
        team.put("healthDoctorCode", result[5]);
        team.put("healthDoctorName", result[6]);
        return team;
    }

+ 8 - 7
src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -192,7 +192,8 @@ public class AdminTeamController extends BaseController {
    @ApiOperation(value = "根据患者代码,获取医生团队信息")
    public String getTeam(@PathVariable("patient_code") String patientCode) {
        try {
           Map<String, Object> team = teamService.getPatientSigningTeam(patientCode);
            Map<String, Object> team = teamService.getPatientSigningTeam(patientCode, super.getUID());
            return write(200, "OK", "data", new JSONObject(team));
        } catch (Exception e) {
@ -226,7 +227,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());
@ -249,9 +250,9 @@ public class AdminTeamController extends BaseController {
        }
    }
    private List<Map<String, Object>> copyBeans(Collection<? extends Object> beans, String...propertyNames){
    private List<Map<String, Object>> copyBeans(Collection<? extends Object> beans, String... propertyNames) {
        List<Map<String, Object>> result = new ArrayList<>();
        for (Object bean : beans){
        for (Object bean : beans) {
            result.add(copyBeanProperties(bean, propertyNames));
        }
@ -265,11 +266,11 @@ public class AdminTeamController extends BaseController {
     * @param propertyNames
     * @return
     */
    private Map<String, Object> copyBeanProperties(Object bean, String...propertyNames){
    private Map<String, Object> copyBeanProperties(Object bean, String... propertyNames) {
        Map<String, Object> simplifiedBean = new HashMap<>();
        for (String propertyName : propertyNames){
        for (String propertyName : propertyNames) {
            Field field = ReflectionUtils.findField(bean.getClass(), propertyName);
            if (field != null){
            if (field != null) {
                field.setAccessible(true);
                Object value = ReflectionUtils.getField(field, bean);
                simplifiedBean.put(propertyName, value == null ? "" : value);