Browse Source

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

yeshijie 7 years ago
parent
commit
0b677baff9

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

@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.FollowupDrugs;
import com.yihu.wlyy.entity.followup.FollowupMapping;
import com.yihu.wlyy.entity.followup.*;
import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
@ -15,10 +12,7 @@ import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
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.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.followup.*;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -644,7 +638,21 @@ public class JwPrescriptionService {
                    
                            //控制目标
                            followupContent7.put("CONTROL_DATE", json.getString("CONTROL_DATE"));//控制日期 V04
                            followupContent7.put("CONTROL_CONSTITUTOR", json.getString("CONTROL_CONSTITUTOR"));//制定者 V05
                            
                            String CONTROL_CONSTITUTOR = json.getString("CONTROL_CONSTITUTOR");
                            if(StringUtils.isNoneBlank(CONTROL_CONSTITUTOR) ){
                                if(jwdoctorCode.equals(CONTROL_CONSTITUTOR)){
                                    followupContent7.put("CONTROL_CONSTITUTOR", doctor.getName());//制定者姓名 V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", doctor.getCode());//制定者本地CODE V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", jwdoctorCode);//制定者本地CODE V05
                                }else{
                                    Doctor control_doctor = doctorDao.findMappingDoctor(CONTROL_CONSTITUTOR, jworgCode);
                                    followupContent7.put("CONTROL_CONSTITUTOR", control_doctor.getName());//制定者姓名 V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", control_doctor.getCode());//制定者本地CODE V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", CONTROL_CONSTITUTOR);//制定者本地CODE V05
                                }
                            }
                            
                            followupContent7.put("CONTROL_BP_U", json.getString("CONTROL_BP_U"));//血压收缩压 V06
                            followupContent7.put("CONTROL_BP_D", json.getString("CONTROL_BP_D"));//血压舒张压 V07
                            followupContent7.put("CONTROL_BS_FPG", json.getString("CONTROL_BS_FPG"));//空腹血糖 V08
@ -686,7 +694,7 @@ public class JwPrescriptionService {
                                followupContentDao.deleteByFollowupId(followup.getId());
                                //组装数据
                                List<FollowupContent> newList = new ArrayList<>();
                        
    
                                followupContent1.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -696,7 +704,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent2.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -706,7 +714,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent3.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -716,7 +724,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent4.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -726,7 +734,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent5.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -736,7 +744,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent6.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -746,7 +754,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent7.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -756,7 +764,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent8.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -766,7 +774,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent9.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -776,7 +784,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent10.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -786,7 +794,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContentDao.save(newList);
                        
                                List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
@ -883,11 +891,14 @@ public class JwPrescriptionService {
                    }
                    followupResultMap.put("OPERATOR",OPERATOR);
                    
                    String FOLLOWUP_ID = followup.getFollowupNo();//家庭医生服务随访主表ID
                    if (StringUtils.isBlank(FOLLOWUP_ID)) {
                        FOLLOWUP_ID = "0";
                    String FOLLOWUP_NO = followup.getFollowupNo();//家庭医生服务随访主表ID
                    if (StringUtils.isBlank(FOLLOWUP_NO)) {
                        FOLLOWUP_NO = "0";
                    }else{
                    
                    }
                    followupResultMap.put("FOLLOWUP_ID",FOLLOWUP_ID);
                    followupResultMap.put("FOLLOWUP_ID",String.valueOf(followup.getId()));
                    followupResultMap.put("FOLLOWUP_NO",FOLLOWUP_NO);
                    
                    String FAMILY_FOLLOWUP_TYPE = "3";//随访类型,必传值3 【必填】
                    String ORG_CODE = followup.getOrgCode();//本地机构编码
@ -904,7 +915,7 @@ public class JwPrescriptionService {
                    } else if ("2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "糖尿病";
                    } else if ("1,2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
                    } else {}
    
                    followupResultMap.put("FAMILY_FOLLOWUP_TYPE",FAMILY_FOLLOWUP_TYPE);
@ -920,6 +931,7 @@ public class JwPrescriptionService {
    
                    followupResultMap.put("THIS_FOLLOWUP_VISIT_DATE",THIS_FOLLOWUP_VISIT_DATE);
                    followupResultMap.put("NEXT_FOLLOWUP_DATE",NEXT_FOLLOWUP_DATE);
                    followupResultMap.put("FOLLOWUP_VISIT_DOCTOR_NAME",followup.getJwdoctorCode());
                    followupResultMap.put("VISIT_WAY_CODE",VISIT_WAY_CODE);
                    
                    String ARCHIVE_ID = "";//档案ID
@ -932,6 +944,32 @@ public class JwPrescriptionService {
                        ARCHIVE_ID = this.getSickArchiveFlag(IDENTITY_CARD_NO);
                        followupResultMap.put("ARCHIVE_ID",ARCHIVE_ID);
                    }
                    
                    //控制目标操作者CODE
                    String CONTROL_CONSTITUTOR_DOCTORCODE = "";
                    
                    if(followupResultMap.containsKey("CONTROL_CONSTITUTOR_JWDOCTORCODE")){
                        followupResultMap.put("CONTROL_CONSTITUTOR",followupResultMap.get("CONTROL_CONSTITUTOR_JWDOCTORCODE"));//基卫控制目标操作者
                    }else{
                        //基卫控制目标操作者,判断是否有控制者名称或者控制者CODE
                        if(followupResultMap.containsKey("CONTROL_CONSTITUTOR") || followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
        
                            String CONTROL_CONSTITUTOR = "";
                            if(followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
            
                                CONTROL_CONSTITUTOR_DOCTORCODE = followupResultMap.get("CONTROL_CONSTITUTOR_DOCTORCODE");
                                CONTROL_CONSTITUTOR = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(CONTROL_CONSTITUTOR_DOCTORCODE, followup.getOrgCode());
            
                                followupResultMap.put("CONTROL_CONSTITUTOR",CONTROL_CONSTITUTOR);//基卫控制目标操作者
                            }
                            
                        }else{
                            logger.info("随访记录上传失败,控制目标操作者CODE为空: 操作者为" + followupResultMap.containsKey("CONTROL_CONSTITUTOR"));
                            continue;
                        }
                    }
                    List<FollowupDrugs> followupDrugs = followupDrugsDao.findByFollowupId(followup.getId());
                    List<FollowupDrugs> followupDrugsNormal = new ArrayList<>();//其他药品
@ -953,15 +991,26 @@ public class JwPrescriptionService {
                    DecimalFormat df = new DecimalFormat("######0.00");
    
                    //普通药品
                    if(!followupDrugsNormal.isEmpty()){
                        for (int i = 0; i < followupDrugsNormal.size(); i++) {
//                    if(!followupDrugsNormal.isEmpty()){
                        for (int i = 0; i <= 6; i++) {
                            int tag = i+1;
                            followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
                            followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
                            followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
                            followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
                            if( !followupDrugsNormal.isEmpty() && followupDrugsNormal.size() >0 && followupDrugsNormal.size() <= tag){
                                followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
                                followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
                                followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
                                if(followupDrugsNormal.get(i).getDose() !=null){
                                    followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
                                }else{
                                    followupResultMap.put("PHYSIC_DOSE"+tag,"");
                                }
                            }else{
                                followupResultMap.put("PHYSIC_NAME"+tag,"");
                                followupResultMap.put("FREQUENCY"+tag,"");
                                followupResultMap.put("PHYSIC_UNIT"+tag,"");
                                followupResultMap.put("PHYSIC_DOSE"+tag,"");
                            }
                        }
                    }
//                    }
    
                    //胰岛素类药品
                    if(!followupDrugsInsulin.isEmpty()){
@ -970,7 +1019,12 @@ public class JwPrescriptionService {
                            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()));
                            if(followupDrugsInsulin.get(j).getDose() !=null){
                                followupResultMap.put("INSULIN_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                            }else{
                                followupResultMap.put("INSULIN_DOSE","");
                            }
                            
                        }
                    }
    
@ -980,6 +1034,7 @@ public class JwPrescriptionService {
    
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("OPERATOR", OPERATOR));
                    params.add(new BasicNameValuePair("ORG_CODE", ORG_CODE));
                    params.add(new BasicNameValuePair("data", jsonObject.toString()));
                    String response = httpClientUtil.post(url, params, "UTF-8");
    
@ -1014,7 +1069,7 @@ public class JwPrescriptionService {
                            }
            
                        } else {
                            logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败");
                            logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败"+errmsg);
                            continue;
                        }
                    } else {

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -86,7 +86,7 @@ images:
  sign_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml

@ -82,7 +82,7 @@ images:
sign:
  check_upload: http://172.19.103.85:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:

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

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

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

@ -128,7 +128,7 @@ public class FollowUpService extends BaseService {
        re.put("followupClass", followupClass);
    
        String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
        if(followupClass.contains(",")){
        if(StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")){
            String[] followupClassArray = followupClass.split(",");
            followupClassName = "";
            for (int i = 0; i < followupClassArray.length; i++) {

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

@ -48,6 +48,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访列表成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访列表失败!" + e.getMessage());
        }
    }
@ -81,7 +82,7 @@ public class DoctorFollowUpController extends BaseController {
            JSONArray result = followUpService.getListByPatientAndTeam(patient, teamCode, page, pagesize,type);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -103,6 +104,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访列表成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访列表失败!" + e.getMessage());
        }
    }
@ -126,6 +128,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "新增随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增随访计划失败!" + e.getMessage());
        }
    }
@ -145,6 +148,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "编辑随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "编辑随访计划失败!" + e.getMessage());
        }
    }
@ -194,6 +198,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "新增临时随访记录成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增临时随访记录失败!" + e.getMessage());
        }
    }
@ -209,6 +214,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "取消随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "取消随访计划失败!" + e.getMessage());
        }
    }
@ -224,6 +230,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "完成随访记录成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "完成随访记录失败!" + e.getMessage());
        }
    }
@ -239,6 +246,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访信息成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访信息失败!" + e.getMessage());
        }
    }
@ -253,6 +261,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访项目列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目列表失败!" + e.getMessage());
        }
    }
@ -269,6 +278,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访项目数据成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
        }
    }
@ -288,6 +298,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
        }
    }
@ -304,6 +315,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取电话随访内容成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取电话随访内容失败!" + e.getMessage());
        }
    }
@ -320,6 +332,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "记录电话随访内容成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "记录电话随访内容失败!" + e.getMessage());
        }
    }
@ -337,6 +350,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取上次随访成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取上次随访失败!" + e.getMessage());
        }
    }
@ -353,6 +367,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "复制上次随访成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "复制上次随访失败!" + e.getMessage());
        }
    }
@ -367,6 +382,7 @@ public class DoctorFollowUpController extends BaseController {
            followUpService.sendMessage(date);
            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/statistic/StatisticsController.java

@ -1589,7 +1589,7 @@ public class StatisticsController extends BaseController {
     * @param sort     0:升序 1:降序
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     * @param year     不管根据当前时间找年度
     * @param lowCode  如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param lowCode  如果是服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew")