Browse Source

微信消息修改

lyr 8 years ago
parent
commit
4133cdda57

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -6,6 +6,8 @@
 *******************************************************************************/
package com.yihu.wlyy.repository.patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -56,6 +58,6 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
	@Query(" select p from Patient p where password is null ")
	List<Patient> findAllIdCardPatientAndNoPassword();
	@Query("select p from Patient p where p.status = 1 and p.openid = ?1 order by p.czrq desc limit 0,1")
	Patient findPatientByOpenid(String openid);
	@Query("select p from Patient p where p.status = 1 and p.openid = ?1 order by p.czrq desc")
	Page<Patient> findPatientByOpenid(String openid, Pageable pageable);
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -890,6 +890,7 @@ public class DoctorInfoService extends BaseService {
        operatorLogDao.save(operatorLog);
    }
    @Transactional
    public int updateTeamHealthDoctorsAll(String newDoctorCode, String doctor) throws Exception {
        List<String> patients = signFamilyDao.findNohealthByDoctor(doctor);
        boolean hasNoTeam = false;

+ 11 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -20,11 +20,15 @@ import com.yihu.wlyy.util.IdcardInfoExtractor;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
import java.util.Date;
import java.util.List;
/**
 * 患者基本信息类.
@ -94,9 +98,13 @@ public class PatientService extends TokenService {
     */
    public void updatePatient(Patient patient, String openid) {
        if (patientDao.countByOpenid(openid) >= 10) {
            Patient p = patientDao.findByOpenid(openid);
            p.setOpenid("");
            patientDao.save(p);
            Sort sort = new Sort(Sort.Direction.DESC, "czrq");
            PageRequest pageRequest = new PageRequest(0, 1, sort);
            Page<Patient> pPage = patientDao.findPatientByOpenid(openid, pageRequest);
            for (Patient p : pPage) {
                p.setOpenid("");
                patientDao.save(p);
            }
        }
        patientDao.save(patient);
        if (StringUtils.isNotEmpty(patient.getOpenid())) {

+ 19 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.account;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -21,6 +22,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -73,6 +75,8 @@ public class DoctorController extends BaseController {
    private HospitalDeptService deptService;
    @Autowired
    private DoctorWorkTimeService workTimeService;
    @Autowired
    StringRedisTemplate redisTemplate;
    /**
     * 社区医院下医生列表查询接口 没分页
@ -1560,8 +1564,18 @@ public class DoctorController extends BaseController {
                                          @RequestParam(required = false) String isAll) {
        try {
            if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                String status = redisTemplate.opsForValue().get("jianguanshifenpei:" + getUID());
                status = StringUtils.isEmpty(status) ? "0" : status;
                if(!status.equals("1")){
                    redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"1");
                    redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
                } else {
                    return error(-1,"正在分配,请勿重复分配");
                }
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(),"0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
                if (result == 1) {
                    return write(200, "分配健管师成功");
                } else if (result == 2) {
@ -1575,6 +1589,10 @@ public class DoctorController extends BaseController {
            }
            return write(200, "更新成功");
        } catch (Exception e) {
            if(isAll.equals("1")) {
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 20, TimeUnit.MINUTES);
            }
            e.printStackTrace();
            return error(-1, "更新失败");
        }