Преглед изворни кода

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

chenweida пре 8 година
родитељ
комит
ca54d31d82

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -251,6 +251,7 @@ public class JobService {
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
            Thread.sleep(20000L);
        }
    }
@ -308,6 +309,7 @@ public class JobService {
        int day=daysBetween(startDate,endDate);
        for(int i=0;i<day;i++){
            productDataByOneDay(getYesterday(i,startDate));
        }
    }
    public static String getYesterday(Integer day,Date startDate) {

+ 12 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -7,6 +7,7 @@ package com.yihu.wlyy.repository.patient;
import java.util.List;
import com.yihu.wlyy.entity.patient.Patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@ -47,6 +48,16 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	@Query("select a from SignFamily a where a.doctorHealth = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
	SignFamily findByDoctorHealthPatient(String doctor, String patient);
	@Query("select p from Patient p,SignFamily a where a.doctorHealth = ?1 and a.patient =p.code and a.type = 2 and a.status >= 0")
	List<Patient> findByDoctorHealthPatient(String doctor);
	@Query("select p from Patient p,SignFamily a where (a.doctorHealth = ?1 or a.doctor=?2 ) and a.patient =p.code and a.type = 2 and a.status >= 0")
	List<Patient> findByDoctorOrDoctorHealthPatient(String doctorHealth,String doctor);
	@Query("select p from Patient p,SignFamily a where a.doctor = ?1 and a.patient =p.code and a.type = 2 and a.status >= 0")
	List<Patient> findByDoctorPatient(String doctor);
	@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 1 and a.status > 0")
	SignFamily findSsSignByDoctorPatient(String doctor, String patient);
@ -319,4 +330,5 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	 * @return
	 */
	List<SignFamily> findByAdminTeamIdAndStatus(long teamCode,int status);
}

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

@ -4,14 +4,11 @@ import java.util.*;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.doctor.team.sign.*;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.doctor.profile.DoctorService;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
@ -91,8 +88,6 @@ public class FamilyContractService extends BaseService {
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private WlyySignFamilyCodeDao wlyySignFamilyCodeDao;
    @Autowired
    private SystemDictDao systemDictDao;
@ -110,6 +105,14 @@ public class FamilyContractService extends BaseService {
    MessageService messageService;
    @Autowired
    AdminTeamService adminTeamService;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    SignPatientLabelLogDao labelLogDao;
    @Autowired
    SignPatientLabelInfoDao labelInfoDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCodeAndType(code, 2);
@ -2008,4 +2011,98 @@ public class FamilyContractService extends BaseService {
        return result;
    }
    public Map<String, List<Patient>> getPatientByLevel(String doctorCode) {
        Map<String, List<Patient>> returnMap = new HashMap<>();
        Doctor doctor = doctorDao.findByCode(doctorCode);
        //判断当前用户是健康管理师还是全科
        if (doctor.getLevel() == 3) {
            //健康管理师
            List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode);
            returnMap.put("jk", jkgl);
        } else if (doctor.getLevel() == 2) {
            //全科医生
            List<Patient> qkys = signFamilyDao.findByDoctorPatient(doctorCode);
            returnMap.put("qk", qkys);
            //健康管理师
            List<Patient> jkgl = signFamilyDao.findByDoctorHealthPatient(doctorCode);
            returnMap.put("jk", jkgl);
        }
        return returnMap;
    }
    public JSONObject getPatientByLable(String doctorCode, String labelType) throws Exception {
        JSONObject returnMap = new JSONObject();
        Doctor doctor = doctorDao.findByCode(doctorCode);
        //判断当前用户是健康管理师还是全科
        List<Map<String, Object>> datas = null;
        if (doctor.getLevel() == 3) {
            //健康管理师
            String sql = "SELECT sf. CODE signcode, " +
                    " p.`name` name, " +
                    " p. CODE `code`, " +
                    " case p.openid when null then 0 when \"\" then 0 else 1 end hasopenid, "+
                    " sp.id labelid, " +
                    " sp.label_name labelname, " +
                    " sp.label_type labeltype, "+
                    " p.idcard idcard " +
           " FROM " +
                    " wlyy_sign_family sf, " +
                    " wlyy_patient p, " +
                    " wlyy_sign_patient_label_info sp " +
           " WHERE" +
                    " sf.patient = p.CODE " +
                    " AND p. CODE = sp.patient " +
                    " AND sf.type = 2 " +
                    " AND sf. STATUS >= 0 " +
                    " and sp.`status`=1 " +
                    " and sf.doctor_health = ? " +
                    " and sp.label_type= ?";
            //查找居民
            datas = jdbcTemplate.queryForList(sql, doctorCode, labelType);
        } else if (doctor.getLevel() == 2) {
            //健康管理师
            String sql = "SELECT sf. CODE signcode, " +
                    " p.`name` name, " +
                    " p. CODE `code`, " +
                    " sp.id labelid, " +
                    " sp.label_name labelname, " +
                    " case p.openid when null then 0 when \"\" then 0 else 1 end hasopenid, "+
                    " sp.label_type labeltype, "+
                    " p.idcard idcard " +
            " FROM " +
                    " wlyy_sign_family sf, " +
                    " wlyy_patient p, " +
                    " wlyy_sign_patient_label_info sp " +
            " WHERE" +
                    " sf.patient = p.CODE " +
                    " AND p. CODE = sp.patient " +
                    " AND sf.type = 2 " +
                    " AND sf. STATUS >= 0 " +
                    " and sp.`status`=1 " +
                    " and ( sf.doctor = ? or sf.doctor_health = ? ) " +
                    " and sp.label_type= ?";
            //查找居民
            datas = jdbcTemplate.queryForList(sql, doctorCode,doctorCode, labelType);
        } else {
            throw new Exception("参数错误");
        }
        //根据类别查找标签
        List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatus(labelType, 1);
        if (s != null && s.size() > 0) {
            for (SignPatientLabel one : s) {
                returnMap.put(one.getLabelCode(), new JSONArray());
            }
            if (datas != null && datas.size() > 0) {
                for (Map<String, Object> map : datas) {
                    JSONObject jo=new JSONObject(map);
                    returnMap.getJSONArray(jo.get("labeltype").toString()).put(jo);;
                }
            }
        }
        return returnMap;
    }
}

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

@ -64,6 +64,65 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @Autowired
    AdminTeamService teamService;
    /**
     * 查看当前医生签约的居民
     */
    @RequestMapping(value = "getPatientByLevel")
    @ResponseBody
    public String getPatientByLevel() {
        try {
            JSONObject returnJO = new JSONObject();
            Map<String, List<Patient>> list = familyContractService.getPatientByLevel(getUID());
            if(list!=null&&list.size()>0){
                for(Map.Entry<String, List<Patient>> entyr:list.entrySet()) {
                    JSONArray array = new JSONArray();
                    addList(returnJO, entyr.getValue(), array, entyr.getKey());
                }
            }
            return write(200, "签约数据加载成功!", "data", returnJO);
        } catch (Exception e) {
            error(e);
            return error(-1, "签约数据加载失败!");
        }
    }
    private void addList(JSONObject returnJO, List<Patient> pts, JSONArray array, String key) {
        if (pts != null && pts.size() > 0) {
            for (Patient sf : pts) {
                if (sf == null) {
                    continue;
                }
                JSONObject json = new JSONObject();
                json.put("id", sf.getId());
                // 签约患者标识
                json.put("code", sf.getCode());
                // 签约患者名称
                json.put("name", sf.getName());
                // 签约患者头像
                json.put("photo", sf.getPhoto());
                // 签约患者性别
                json.put("sex", sf.getSex());
                // 签约患者性别
                json.put("age", IdCardUtil.getAgeForIdcard(sf.getIdcard()));
                array.put(json);
            }
            returnJO.put(key, array);
        }
    }
    /**
     * 根据标签查看当前医生签约的居民
     */
    @RequestMapping(value = "/getPatientByLable")
    @ResponseBody
    public String getPatientByLable(String labelType) {
        try {
            JSONObject list = familyContractService.getPatientByLable("D20161008002", labelType);
            return write(200, "查询成功", "data", list);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
    /**
     * 医生签约患者列表查询接口
     *

+ 1 - 1
patient-co-wlyy/src/main/resources/system.properties

@ -64,7 +64,7 @@ wechat_token=27eb3bb24f149a7760cf1bb154b08040
#是否签约检查和签约数据上传
sign_check_upload=http://172.19.103.87:8011/wlyy_service
#im一对一列表获取
im_list_get=http://192.168.131.102:3000/
im_list_get=http://localhost:3000/
#-------------测试------------#
#server_ip=ehr.yihu.com