Kaynağa Gözat

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

trick9191 7 yıl önce
ebeveyn
işleme
b86497d1aa

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

@ -19,9 +19,6 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -675,7 +672,7 @@ public class DeviceService {
            String value1 = data.getValue1();
            // 餐后
            if (index % 2 == 0) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter ,minValueAfter )) {
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L),请处理";
                    //体征异常,更新体征数据状态
@ -683,7 +680,7 @@ public class DeviceService {
                    patientHealthIndexDao.save(data);
                }
            } else { //餐前
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L),请处理";
                    //体征异常,更新体征数据状态

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftService.java

@ -869,7 +869,7 @@ public class ZysoftService {
        
        com.alibaba.fastjson.JSONObject json = JSON.parseObject(data);
        
        String response = postSecond("getEhrChroDaysFollowUpInfoRecord","上传家庭医生服务日常随访信息",json,header);
        String response = postSecond("uploadEhrSickChroDaysFollowUpRecord ","上传家庭医生服务日常随访信息",json,header);
        
        return response;
	}

+ 9 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -178,6 +178,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            } else {
                logger.info("patient_followup_syb_job  job exist");
            }
    
            //居民随访信息上传基卫,每天凌晨4点执行一次
            if (!quartzHelper.isExistJob("patient_followup_upload_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("patient_followup_upload_job");
                quartzHelper.addJob(FollowUpUploadJob.class, trigger, "patient_followup_upload_job", new HashMap<String, Object>());
                logger.info("patient_followup_upload_job  job success");
            } else {
                logger.info("patient_followup_upload_job  job exist");
            }
            //老年人体检消息发送记录,每天凌晨1点执行一次
            if (!quartzHelper.isExistJob("patient_physical_examination_job")) {

+ 6 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpMappingDao.java

@ -2,6 +2,8 @@ package com.yihu.wlyy.repository.followup;
import com.yihu.wlyy.entity.followup.FollowupMapping;
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 java.util.List;
@ -14,4 +16,8 @@ import java.util.List;
public interface FollowUpMappingDao extends PagingAndSortingRepository<FollowupMapping, Long>, JpaSpecificationExecutor<FollowupMapping> {
	
	List<FollowupMapping> findByNeedUpload(Integer needupload);
	
	@Modifying
	@Query("update FollowupMapping p set p.needUpload=?1 where p.followupId=?2")
	void updateNeedUploadByFollowupId(Integer needUpload,Integer followupId);
}

+ 18 - 11
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -34,11 +34,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.text.DecimalFormat;
@ -488,6 +491,7 @@ public class JwPrescriptionService {
                            String followupPlanDate = "";//随访计划时间
                            String followupNextDate = json.getString("NEXT_FOLLOWUP_DATE");//计划下次随访时间:下次随访时间
                            followup.setFollowupNextDate(DateUtil.strToDate(followupNextDate));
                            followup.setFollowupPlanDate(DateUtil.strToDate(followupDate));
                    
                            /******************* 医生机构映射 ****************/
                    
@ -852,6 +856,7 @@ public class JwPrescriptionService {
    /**
     * 上传居民随访记录到基卫
     */
    @Transactional
    public void uploadFollowUpRecordToJW() throws Exception {
        //查找出需要上传的随访映射记录
        List<Followup> followupMappings = followUpDao.findByFollowMappingNeedUpload(1);
@ -962,16 +967,16 @@ public class JwPrescriptionService {
                    if(!followupDrugsInsulin.isEmpty()){
                        for (int  j= 0; j < followupDrugsInsulin.size(); j++) {
                            int tag = j+1;
                            followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsInsulin.get(j).getDrugsName());
                            followupResultMap.put("FREQUENCY"+tag,followupDrugsInsulin.get(j).getFrequency());
                            followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsInsulin.get(j).getUnit());
                            followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                            followupResultMap.put("INSULIN_NAME"+tag,followupDrugsInsulin.get(j).getDrugsName());
                            followupResultMap.put("INSULIN_FREQUENCY"+tag,followupDrugsInsulin.get(j).getFrequency());
                            followupResultMap.put("INSULIN_UNIT"+tag,followupDrugsInsulin.get(j).getUnit());
                            followupResultMap.put("INSULIN_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                        }
                    }
    
                    jsonObject = JSONObject.parseObject(JSON.toJSONString(followupResultMap));
                    
                    String url = jwUrl + "/third/archives/uploadEhrSickChroDaysFollowUpRecord";
                    String url = jwUrl + "/third/sign/uploadEhrSickChroDaysFollowUpRecord";
    
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("OPERATOR", OPERATOR));
@ -989,8 +994,6 @@ public class JwPrescriptionService {
                                JSONArray dataArray = jwData.getJSONArray("DATA");
                                for (int i = 0; i < dataArray.size(); i++) {
                    
                                    OldPeoplePhysicalExaminationEntity oldPeoplePhysicalExaminationEntity = new OldPeoplePhysicalExaminationEntity();
                    
                                    JSONObject json = dataArray.getJSONObject(i);
                                    
                                    String jw_followup_no = json.getString("FOLLOWUP_NO");
@ -998,24 +1001,28 @@ public class JwPrescriptionService {
                                    followup.setFollowupNo(jw_followup_no);
    
                                    followUpDao.save(followup);//获取的基卫随访主表ID,更新回数据库
    
                                    String strid = String.valueOf(followup.getId());
                                    
                                    followUpMappingDao.updateNeedUploadByFollowupId(0,Integer.parseInt(strid));
                                }
                                
                            } else {
                                String jwMessage = jwData.getString("MESSAGE");
                                logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err:"+jwMessage);
                                logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:"+jwMessage);
                                continue;
                            }
            
                        } else {
                            logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err:请求失败");
                            logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败");
                            continue;
                        }
                    } else {
                        logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",无返回值");
                        logger.info("随访记录上传失败:" + followup.getId().toString()+",无返回值");
                        continue;
                    }
                } catch (Exception e) {
                    logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err"+e.getMessage());
                    logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err"+e.getMessage());
                    continue;
                }
            }

+ 23 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -641,6 +641,29 @@ public class JobController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    
    /**
     * 居民随访记录上传(上传到基卫)
     *@author huangwenjie
     *@date 2017/10/23 08:45
     */
    @RequestMapping(value = "/executeFollowUpUploadJob", method = RequestMethod.POST)
    @ApiOperation("居民随访记录上传(上传到基卫)")
    public String executeFollowUpSynByTime() {
        try {
            try {
                //上传居民随访记录到基卫
                jwPrescriptionService.uploadFollowUpRecordToJW();
            }catch (Exception e){
                e.printStackTrace();
            }
            
            return write(200, "执行成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
     *老年人体检系统发送提醒,每天早上8点执行一次

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

@ -113,9 +113,12 @@ onepay_query_job=0 0/3 * * * ?
# 老年人体检记录同步,每天凌晨1点执行一次
old_people_tijian_syb_job=0 0 1 * * ?
# 老年人体检记录同步,每天凌晨1点执行一次
# 同步居民随访记录,每天凌晨3点执行一次
patient_followup_syb_job=0 0 3 * * ?
# 居民随访记录上传(上传到基卫),每天凌晨4点执行一次
patient_followup_upload_job=0 0 3 * * ?
# 老年人体检系统发送提醒记录,每天8点执行一次
patient_physical_examination_job=0 0 8 * * ?

+ 25 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpMappingDao.java

@ -0,0 +1,25 @@
package com.yihu.wlyy.repository.followup;
import com.yihu.wlyy.entity.followup.FollowupMapping;
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 java.util.List;
/**
 * 随访记录映射表
 * @author huangwenjie
 * @date 2017/10/23 14:05
 */
public interface FollowUpMappingDao extends PagingAndSortingRepository<FollowupMapping, Long>, JpaSpecificationExecutor<FollowupMapping> {
	
	List<FollowupMapping> findByNeedUpload(Integer needupload);
	
	FollowupMapping findByFollowupId(Integer followupid);
	
	@Modifying
	@Query("update FollowupMapping p set p.needUpload=?1 where p.followupId=?2")
	void updateNeedUploadByFollowupId(Integer needUpload, Integer followupId);
}

+ 49 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -6,11 +6,13 @@ import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupMapping;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowUpMappingDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -82,6 +84,8 @@ public class FollowUpService extends BaseService {
    private PatientService patientService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private FollowUpMappingDao followUpMappingDao;
    /**
@ -267,7 +271,7 @@ public class FollowUpService extends BaseService {
                }else{
                    if(objArr[4].toString().equals("1")){
                        followup.put("followupClassName", "高血压");
                    }else if(objArr[4].toString().equals("1")){
                    }else if(objArr[4].toString().equals("2")){
                        followup.put("followupClassName", "糖尿病");
                    }else if(objArr[4].toString().equals("1,2")){
                        followup.put("followupClassName", "高血压,糖尿病");
@ -406,6 +410,32 @@ public class FollowUpService extends BaseService {
            //计划下次随访时间--huangwenjie.2017.10.19
            if(StringUtils.isNoneBlank(plandate)){
                followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                Followup nextFollowup = new Followup();
                nextFollowup.setDataFrom(followup.getDataFrom());
                nextFollowup.setStatus("2");
                nextFollowup.setFollowupType(followupType);
                nextFollowup.setFollowupNo(followup.getFollowupNo());
                nextFollowup.setFollowupDate(DateUtil.strToDate(plandate));
                nextFollowup.setFollowupPlanDate(DateUtil.strToDate(plandate));
                nextFollowup.setJwdoctorCode(followup.getJwdoctorCode());
                nextFollowup.setJworgCode(followup.getJworgCode());
                nextFollowup.setOrgCode(followup.getOrgCode());
                nextFollowup.setOrgName(followup.getOrgName());
                nextFollowup.setCreater(followup.getCreater());
                nextFollowup.setSignCode(followup.getSignCode());
                nextFollowup.setAdminTeamCode(followup.getAdminTeamCode());
                nextFollowup.setFollowupClass(followupClass);
                nextFollowup.setFollowupManagerStatus(followupManagerStatus);
                nextFollowup.setPatientName(followup.getPatientName());
                nextFollowup.setPatientCode(followup.getPatientCode());
                nextFollowup.setCreateTime(new Date());
                nextFollowup.setUpdateTime(new Date());
                nextFollowup.setDoctorCode(followup.getDoctorCode());
                nextFollowup.setDoctorName(followup.getDoctorName());
                nextFollowup.setIdcard(followup.getIdcard());
                nextFollowup.setSignType(followup.getSignType());
                followupDao.save(nextFollowup);
                
            }
            followup.setFollowupType(followupType);
            followup.setFollowupClass(followupClass);
@ -490,10 +520,24 @@ public class FollowUpService extends BaseService {
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if (followup != null) {
            followup.setStatus("1");  //状态 0取消 1已完成 2未开始 3进行中
            followupDao.save(followup);
            //上传随访计划
            new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
            followup = followupDao.save(followup);
    
            //上传随访计划映射表记录
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            
            if(followupMapping == null){
                followupMapping = new FollowupMapping();
            }
    
            followupMapping.setFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            followupMapping.setCode(UUID.randomUUID().toString());
            followupMapping.setCreateTime(DateUtil.getNowTimestamp());
            followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
            followupMapping.setNeedUpload(1);
            
            followUpMappingDao.save(followupMapping);
           
//            new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
        } else {
            throw new Exception("not exit follow:" + id + ".\r\n");
        }

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -139,8 +139,6 @@ public class PhysicalExaminationRemindService extends BaseService {
                    break;
                }
            }
        } else {
            re = 1;
        }
        return re;
    }

+ 36 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -223,26 +223,43 @@ public class PrescriptionInfoService extends BaseService {
                    Iterator iterator = pres.iterator();
                    while (iterator.hasNext()) {
                        com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) iterator.next();
                        String dis = gxy;
                        if("1".equals(diagnosisCode)){
                            dis = gxy;
                        }else if("2".equals(diagnosisCode)){
                            dis = tnb;
                        }
                        com.alibaba.fastjson.JSONArray des = (com.alibaba.fastjson.JSONArray) r.getJSONArray("prescriptionDt");
                        boolean flag = false;
                        for (int i = 0; i < des.size(); i++) {
                            PrescriptionDiagnosis ds = des.getObject(i, PrescriptionDiagnosis.class);
                            //如果含有选择病症,标记为true
                            if (dis.equals(ds.getHealthProblem())) {
                                //含有选择的病症
                                flag = true;
                        if("3".equals(diagnosisCode)){
                            com.alibaba.fastjson.JSONArray des = (com.alibaba.fastjson.JSONArray) r.getJSONArray("prescriptionDt");
                            boolean flag = false;
                            for (int i = 0; i < des.size(); i++) {
                                PrescriptionDiagnosis ds = des.getObject(i, PrescriptionDiagnosis.class);
                                //如果含有选择病症,标记为true
                                if (gxy.equals(ds.getHealthProblem()) || tnb.equals(ds.getHealthProblem())) {
                                    //含有选择的病症
                                    flag = true;
                                }
                            }
                            //如果未含有选择的病症,则删除
                            if (!flag){
                                iterator.remove();
                            }
                        }else{
                            String dis = gxy;
                            if("1".equals(diagnosisCode)){
                                dis = gxy;
                            }else if("2".equals(diagnosisCode)){
                                dis = tnb;
                            }
    
                            com.alibaba.fastjson.JSONArray des = (com.alibaba.fastjson.JSONArray) r.getJSONArray("prescriptionDt");
                            boolean flag = false;
                            for (int i = 0; i < des.size(); i++) {
                                PrescriptionDiagnosis ds = des.getObject(i, PrescriptionDiagnosis.class);
                                //如果含有选择病症,标记为true
                                if (dis.equals(ds.getHealthProblem())) {
                                    //含有选择的病症
                                    flag = true;
                                }
                            }
                            //如果未含有选择的病症,则删除
                            if (!flag){
                                iterator.remove();
                            }
                        }
                        //如果未含有选择的病症,则删除
                        if (!flag){
                            iterator.remove();
                        }
                    }
                }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -170,6 +170,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "开始随访记录成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "开始随访记录失败!" + e.getMessage());
        }
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -81,7 +81,7 @@ public class PrescriptionInfoController extends BaseController {
                                       @RequestParam(required = false)@ApiParam(name="recipeNo",value="医嘱号,第一次获取上一方时传入0,第二次获取上一方时传入第一次返回的医嘱号,以此类推")String recipeNo,
                                       @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                       @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate,
                                       @RequestParam(required = false,defaultValue = "0")@ApiParam(name="diagnosisCode",value="所有诊断(0 全部 1高血压 2糖尿病)")String diagnosisCode,
                                       @RequestParam(required = false,defaultValue = "0")@ApiParam(name="diagnosisCode",value="所有诊断(0 全部 1高血压 2糖尿病 3高血压或糖尿病)")String diagnosisCode,
                                       @RequestParam(required = false)@ApiParam(name="page",value="起始页")Integer page,
                                       @RequestParam(required = false)@ApiParam(name="size",value="每页记录数")Integer size,
                                       @RequestParam(required = true)@ApiParam(name="patientCode",value="居民CODE")String patientCode){