Browse Source

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

trick9191 7 years ago
parent
commit
1a4621cb7a

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -1717,7 +1717,7 @@ public class SignWebService extends BaseService {
                        setSevId(renew, sevId);
                        //1.3.3.2新增需求
                        //设置居民标签
                        signPatientLabelInfoService.setPatientLabels(renew.getPatient(), renew.getIdcard(), "", health, disease, custom, renew.getDoctor(), renew.getDoctor());
                        signPatientLabelInfoService.setRenewPatientLabels(renew.getPatient(), health, disease, custom, renew.getDoctor(), renew.getDoctor());
                        //1.3.3.2设置可修改健康管理师
                        if (StringUtils.isNotBlank(healthDoctor)) {
                            updateHealthDoctor(renew, healthDoctor);

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

@ -8,7 +8,6 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.vo.PatientCodeDeviceType;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
@ -22,6 +21,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -71,6 +71,8 @@ public class SignPatientLabelInfoService extends BaseService {
    SignPatientLabelDao labelDao;
    @Autowired
    SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    SignPatientLabelInfoDao signPatientLabelInfoDao;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -4486,4 +4488,108 @@ public class SignPatientLabelInfoService extends BaseService {
        return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
    }
    /**
     * 设置患者标签
     *
     * @param patient     患者名称
     * @param health      健康情况标签
     * @param disease     疾病类型标签
     * @param custom      自定义标签
     * @return
     */
    public int resetPatientLabels(String patient,String health, String disease, String custom) {
        Patient p = patientDao.findByCode(patient);
        //1.清空居民标签
        String delSql = " DELETE FROM wlyy_sign_patient_label_info WHERE patient ='"+patient+"'";
        jdbcTemplate.execute(delSql);
        //2.新增健康情况标签
        String healths[] = health.split(",");
        //获取所有健康情况标签
        List<Map<String,Object>> healthList = getLabelsByType("2");
        //减低循环层级
        Map<String,Map<String,Object>> healthMap = new HashedMap();
        for(Map<String,Object> map : healthList){
            String code = (String)map.get("code");
            healthMap.put(code,map);
        }
        if(healths!=null&&healths.length>0){
            for(int i=0;i<healths.length;i++){
                SignPatientLabelInfo info = new SignPatientLabelInfo();
                info.setCzrq(new Date());
                info.setLabelType("2");
                info.setPatient(patient);
                info.setPname(p.getName());
                info.setLabel(healths[i]);
                info.setStatus(1);
                String name = (String)healthMap.get(healths[i]).get("name");
                info.setLabelName(name);
                signPatientLabelInfoDao.save(info);
            }
        }
        //2.新增疾病标签
        String diseases[] = disease.split(",");
        //获取所有健康情况标签
        List<Map<String,Object>> diseaseList = getLabelsByType("3");
        //减低循环层级
        Map<String,Map<String,Object>> diseaseMap = new HashedMap();
        for(Map<String,Object> map : diseaseList){
            String code = (String)map.get("code");
            diseaseMap.put(code,map);
        }
        if(diseases!=null&&diseases.length>0){
            for(int i=0;i<diseases.length;i++){
                SignPatientLabelInfo info = new SignPatientLabelInfo();
                info.setCzrq(new Date());
                info.setLabelType("3");
                info.setPatient(patient);
                info.setPname(p.getName());
                info.setLabel(diseases[i]);
                String name = (String)diseaseMap.get(diseases[i]).get("name");
                info.setLabelName(name);
                info.setStatus(1);
                signPatientLabelInfoDao.save(info);
            }
        }
        //3.新增自定义标签
        String customs[] = custom.split(",");
        //获取所有健康情况标签
        List<Map<String,Object>> customList = getLabelsByType("4");
        //减低循环层级
        Map<String,Map<String,Object>> customMap = new HashedMap();
        for(Map<String,Object> map : customList){
            String code = (String)map.get("code");
            customMap.put(code,map);
        }
        if(customs!=null&&customs.length>0){
            for(int i=0;i<customs.length;i++){
                SignPatientLabelInfo info = new SignPatientLabelInfo();
                info.setCzrq(new Date());
                info.setLabelType("4");
                info.setPatient(patient);
                info.setPname(p.getName());
                info.setLabel(customs[i]);
                String name = (String)customMap.get(customs[i]).get("name");
                info.setLabelName(name);
                info.setStatus(1);
                signPatientLabelInfoDao.save(info);
            }
        }
        return 1;
    }
    public List<Map<String,Object>> getLabelsByType(String labelType){
        String sql = " SELECT b.label_code AS code ,b.label_name AS name FROM wlyy_sign_patient_label b WHERE b.label_type= ?";
        return jdbcTemplate.queryForList(sql,new Object[]{labelType});
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -1559,7 +1559,7 @@ public class SignWebService extends BaseService {
                        }
                        //1.3.3.2新增需求
                        //设置居民标签
                        signPatientLabelInfoService.setRenewPatientLabels(renew.getPatient(), health, disease, custom, renew.getDoctor(), renew.getDoctor());
                        signPatientLabelInfoService.resetPatientLabels(renew.getPatient(), health, disease, custom);
                        //1.3.3.2设置可修改健康管理师
                        if (StringUtils.isNotBlank(healthDoctor)) {
                            updateHealthDoctor(renew, healthDoctor);
@ -1725,7 +1725,7 @@ public class SignWebService extends BaseService {
                        setSevId(renew, sevId);
                        //1.3.3.2新增需求
                        //设置居民标签
                        signPatientLabelInfoService.setPatientLabels(renew.getPatient(), renew.getIdcard(), "", health, disease, custom, renew.getDoctor(), renew.getDoctor());
                        signPatientLabelInfoService.resetPatientLabels(renew.getPatient(), health, disease, custom);
                        //1.3.3.2设置可修改健康管理师
                        if (StringUtils.isNotBlank(healthDoctor)) {
                            updateHealthDoctor(renew, healthDoctor);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -469,7 +469,7 @@ public class AdminTeamService extends BaseService {
            return result.put(new JSONObject(doctorTeam));
        }
        //判断签约关系
        if (jtSign.getAdminTeamId()!=null&&jtSign != null && (doctor.equals(jtSign.getDoctor()) || doctor.equals(jtSign.getDoctorHealth()))) {
        if (jtSign != null&&jtSign.getAdminTeamId()!=null&& (doctor.equals(jtSign.getDoctor()) || doctor.equals(jtSign.getDoctorHealth()))) {
            AdminTeam team = getTeam(jtSign.getAdminTeamId());
            result.put(new JSONObject(team));
        }

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

@ -36,7 +36,8 @@ public class SignPatientLabelInfoController extends BaseController {
    PatientService patientService;
    @Autowired
    private DoctorSchemeService doctorSchemeService;
    @Autowired
    private SignPatientLabelInfoService signPatientLabelService;
    /**
     * 根据姓名,地址,身份证号搜索团队内居民
@ -855,4 +856,21 @@ public class SignPatientLabelInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/resetPatientLabels", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String resetPatientLabels(@RequestParam(required = true)String patient,
                                     @RequestParam(required = true)String health,
                                     @RequestParam(required = true)String disease,
                                     @RequestParam(required = true)String custom,
                                     @RequestParam(required = true)String doctor){
        try {
            return write(200, "保存成功", "data", signPatientLabelService.resetPatientLabels(patient,health,disease,custom));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}

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

@ -784,6 +784,4 @@ public class DoctorSignController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
}