فهرست منبع

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

trick9191 7 سال پیش
والد
کامیت
e332eccc35

+ 48 - 1
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -10,6 +10,11 @@ import com.yihu.hos.device.common.http.HttpResponse;
import com.yihu.hos.device.common.util.*;
import com.yihu.hos.device.model.*;
import com.yihu.hos.device.task.PushMsgTask;
import com.yihu.wlyy.entity.patient.PatientAimBloodPressure;
import com.yihu.wlyy.entity.patient.PatientAimBloodSugger;
import com.yihu.wlyy.repository.doctor.PatientAimBloodPressureDao;
import com.yihu.wlyy.repository.doctor.PatientAimBloodSuggerDao;
import com.yihu.wlyy.service.BaseService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
@ -27,7 +32,7 @@ import java.util.*;
 * Created by lingfeng on 2016/8/19.
 */
@Service("DeviceService")
public class DeviceService {
public class DeviceService extends BaseService{
    public static final String BEAN_ID = "DeviceService";
    @Autowired
    DeviceInfoDao deviceInfoDao;
@ -75,6 +80,10 @@ public class DeviceService {
    private TrackPatientDao trackPatientDao;
    @Value("${systemConfig.server_url}")
    private String wlyyService;
    @Autowired
    private PatientAimBloodSuggerDao patientAimBloodSuggerDao;
    @Autowired
    private PatientAimBloodPressureDao patientAimBloodPressureDao;
    private ObjectMapper objectMapper = new ObjectMapper();
    private Integer aStart;
@ -576,6 +585,40 @@ public class DeviceService {
        }
    }
    /**
     * 设置默认监控方案
     * @param patient
     * @return
     */
    public String setDefaultAim(String patient){
        PatientAimBloodSugger patientAimBloodSugger = patientAimBloodSuggerDao.findByPatientcode(patient);
        PatientAimBloodPressure patientAimBloodPressure =  patientAimBloodPressureDao.findByPatientcode(patient);
        if(patientAimBloodSugger==null){
            PatientAimBloodSugger pa = new PatientAimBloodSugger();
            pa.setPatientcode(patient);
            pa.setCode(getCode());
            pa.setCreateTime(new Date());
            pa.setUnit("mmol/L");
            pa.setFbg("7.0");
            pa.setHpg("11.1");
            pa.setFbgMin("4.0");
            pa.setHpgMin("4.0");
            patientAimBloodSuggerDao.save(pa);
        }
        if(patientAimBloodPressure==null){
            PatientAimBloodPressure pa = new PatientAimBloodPressure();
            pa.setPatientcode(patient);
            pa.setCode(getCode());
            pa.setCreateTime(new Date());
            pa.setSbp("140");
            pa.setSbpMin("90");
            pa.setDbp("90");
            pa.setDbpMin("60");
            pa.setUnit("mmHg");
            patientAimBloodPressureDao.save(pa);
        }
        return "1";
    }
    /**
     * 设置
     * @param patient
@ -673,6 +716,8 @@ public class DeviceService {
                    t.setPatientName(p.getName());
                    t.setDel("0");
                    trackPatientDao.save(t);
                    //设置默认控制目标
                    setDefaultAim(patient);
                }else{
                    trackPatient.setDel("0");
                    trackPatientDao.save(trackPatient);
@ -696,6 +741,8 @@ public class DeviceService {
                    t.setPatientName(p.getName());
                    t.setDel("0");
                    trackPatientDao.save(t);
                    //设置默认控制目标
                    setDefaultAim(patient);
                }else{
                    trackPatient.setDel("0");
                    trackPatientDao.save(trackPatient);

+ 45 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -15,6 +15,8 @@ import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorSwitchDao;
import com.yihu.wlyy.repository.doctor.PatientAimBloodPressureDao;
import com.yihu.wlyy.repository.doctor.PatientAimBloodSuggerDao;
import com.yihu.wlyy.repository.doctor.health.DoctorHealthStandardDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.*;
@ -96,6 +98,10 @@ public class PatientHealthIndexService extends BaseService {
    private TrackPatientDao trackPatientDao;
    @Autowired
    private IotDeviceService iotDeviceService;
    @Autowired
    private PatientAimBloodSuggerDao patientAimBloodSuggerDao;
    @Autowired
    private PatientAimBloodPressureDao patientAimBloodPressureDao;
    /**
     * 获取居民标准预警值
@ -915,6 +921,41 @@ public class PatientHealthIndexService extends BaseService {
	    //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
    }
    /**
     * 设置默认监控方案
     * @param patient
     * @return
     */
    public String setDefaultAim(String patient){
        PatientAimBloodSugger patientAimBloodSugger = patientAimBloodSuggerDao.findByPatientcode(patient);
        PatientAimBloodPressure patientAimBloodPressure =  patientAimBloodPressureDao.findByPatientcode(patient);
        if(patientAimBloodSugger==null){
            PatientAimBloodSugger pa = new PatientAimBloodSugger();
            pa.setPatientcode(patient);
            pa.setCode(getCode());
            pa.setCreateTime(new Date());
            pa.setUnit("mmol/L");
            pa.setFbg("7.0");
            pa.setHpg("11.1");
            pa.setFbgMin("4.0");
            pa.setHpgMin("4.0");
            patientAimBloodSuggerDao.save(pa);
        }
        if(patientAimBloodPressure==null){
            PatientAimBloodPressure pa = new PatientAimBloodPressure();
            pa.setPatientcode(patient);
            pa.setCode(getCode());
            pa.setCreateTime(new Date());
            pa.setSbp("140");
            pa.setSbpMin("90");
            pa.setDbp("90");
            pa.setDbpMin("60");
            pa.setUnit("mmHg");
            patientAimBloodPressureDao.save(pa);
        }
        return "1";
    }
    /**
     * 设置
     * @param patient
@ -950,6 +991,8 @@ public class PatientHealthIndexService extends BaseService {
                    t.setPatientName(p.getName());
                    t.setDel("1");
                    trackPatientDao.save(t);
                    //设置默认控制目标
                    setDefaultAim(patient);
                }else{
                    trackPatient.setDel("1");
                    trackPatientDao.save(trackPatient);
@ -973,6 +1016,8 @@ public class PatientHealthIndexService extends BaseService {
                    t.setPatientName(p.getName());
                    t.setDel("1");
                    trackPatientDao.save(t);
                    //设置默认控制目标
                    setDefaultAim(patient);
                }else{
                    trackPatient.setDel("1");
                    trackPatientDao.save(trackPatient);

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -16,6 +16,7 @@ import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
@ -77,6 +78,8 @@ public class SignPatientLabelInfoService extends BaseService {
    PatientInfoService patientInfoService;
    @Autowired
    TrackPatientDao trackPatientDao;
    @Autowired
    PatientHealthIndexService patientHealthIndexService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -288,6 +291,8 @@ public class SignPatientLabelInfoService extends BaseService {
                return "-1";
            }
            trackPatientDao.save(tkp);
            //设置默认控制目标
            patientHealthIndexService.setDefaultAim(patient);
        }
        return "1";
    }

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

@ -1489,7 +1489,6 @@ public class DoctorSchemeService extends BaseService{
                    patientAimSportsDao.delete(sport);
                }
                net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
                net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
                net.sf.json.JSONObject spj  = net.sf.json.JSONObject.fromObject(sportJson);

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

@ -425,6 +425,33 @@ public class PatientService extends TokenService {
        return rs;
    }
    public JSONObject checkCanRenewNew(String patient){
        JSONObject rs = new JSONObject();
        //判断是否有生效记录SQL
        String sql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0";
        List<Map<String,Object>> signs =  jdbcTemplate.queryForList(sql);
        if(!signs.isEmpty()){
            rs.put("mes", "当前年度已经签约");
            rs.put("code", "-2");
            return rs;
        }
        //判读是否有旧的已到期记录SQL
        String oldSignSql = "SELECT t.id,t.sign_year signYear,t.status FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND  t.expenses_status='1' AND t.sign_year ='" + (DateUtil.getSignYear() - 1) + "'";
        List<Map<String,Object>> oldSigns =  jdbcTemplate.queryForList(oldSignSql);
        if(!oldSigns.isEmpty()){
            rs.put("mes", "可以续签(已到期)");
            rs.put("code", "2");
            return rs;
        }else{
            //没有签约记录,不允许续签,提示前往签约
            rs.put("mes", "没有签约记录,请前往签约");
            rs.put("code", "-4");
            return rs;
        }
    }
    /**
     * 判断是否可以续签
     *
@ -1099,5 +1126,4 @@ public class PatientService extends TokenService {
        }
        return true;
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -861,7 +861,7 @@ public class DateUtil {
	public static int getSignYear(){
		Calendar ca = Calendar.getInstance();
		if(getNowMonth()>=4){
		if(getNowMonth()>=7){
			return getNowYear();
		}
		return getNowYear()-1;
@ -1234,4 +1234,5 @@ public class DateUtil {
		int week = c.get(Calendar.DAY_OF_WEEK);
		return week;
	}
}

+ 37 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -496,30 +496,9 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = false) Long teamCode,
                             @RequestParam(required = false) String expenses){
        try{
            //判断是否存在下个年度续签
            int isNowYearSign = signWebService.checkNowYearSign(getUID(),patient);
            if(isNowYearSign==0){
                //设置代码为已读
                signWebService.setMessState(mesId);
                return  write(200, "已经存在下个年度的签约关系", "data", -1);
            }
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR);
            int month = cal.get(Calendar.MONTH)+1;
            //屏蔽了预签约
            int rs = 0;
            if(month<7){
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
            }else{
//                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//                //如果没有续签记录,走签约记录
//                if(rs!=0){
//                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//                }
                rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
            }
            rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
            if(rs != 1){
                //设置代码为已读
                signWebService.setMessState(mesId);
@ -527,6 +506,38 @@ public class DoctorSignController extends WeixinBaseController {
            }else{
                return write(200, "操作成功!", "data", rs);
            }
//            //判断是否存在下个年度续签
//            int isNowYearSign = signWebService.checkNowYearSign(getUID(),patient);
//            if(isNowYearSign==0){
//                //设置代码为已读
//                signWebService.setMessState(mesId);
//                return  write(200, "已经存在下个年度的签约关系", "data", -1);
//            }
//            Calendar cal = Calendar.getInstance();
//            int year = cal.get(Calendar.YEAR);
//            int month = cal.get(Calendar.MONTH)+1;
//            int rs = 0;
//            if(month<7){
//                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
////            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
//            }else{
////                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
////                //如果没有续签记录,走签约记录
////                if(rs!=0){
////                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
////                }
//                rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//
//            }
//            if(rs != 1){
//                //设置代码为已读
//                signWebService.setMessState(mesId);
//                return  write(200, "未找到签约记录", "data", rs);
//            }else{
//                return write(200, "操作成功!", "data", rs);
//            }
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
@ -621,7 +632,9 @@ public class DoctorSignController extends WeixinBaseController {
    @ResponseBody
    public String checkCanRenew(@RequestParam(required = true) String patient){
        try {
            JSONObject result = patientService.checkCanSignRenew(patient);
            //JSONObject result = patientService.checkCanSignRenew(patient);
            JSONObject result = patientService.checkCanRenewNew(patient);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败");

+ 12 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -473,16 +473,17 @@ public class FamilyContractController extends BaseController {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
            }
            Calendar cal = Calendar.getInstance();
            int month = cal.get(Calendar.MONTH)+1;
//            Calendar cal = Calendar.getInstance();
//            int month = cal.get(Calendar.MONTH)+1;
//            int result = -1;
//            if(month<7){
//                result = familyContractService.signRenew(doctor,healthDoctor,patient,reason,medicareNumber);
//            }else{
//                //1.3.5新增居委会字段
//                result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber);
//            }
            int result = -1;
            if(month<7){
                result = familyContractService.signRenew(doctor,healthDoctor,patient,reason,medicareNumber);
            }else{
                //1.3.5新增居委会字段
                result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber);
            }
            result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient,reason,countryCode,medicareNumber);
            if (result == -1) {
                return error(-1, "用户信息查询失败");
@ -698,7 +699,8 @@ public class FamilyContractController extends BaseController {
    @ApiOperation("验证是否允许签约")
    public String checkCanRenew(@RequestParam(required = true) String patient){
        try {
            JSONObject result = patientService.checkCanSignRenew(patient);
            //JSONObject result = patientService.checkCanSignRenew(patient);
            JSONObject result = patientService.checkCanRenewNew(patient);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            error(e);