소스 검색

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

yeshijie 7 년 전
부모
커밋
4e6135de09

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

@ -491,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));
                    
                            /******************* 医生机构映射 ****************/
                    

+ 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");
        }

+ 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){