Explorar o código

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

lyr %!s(int64=8) %!d(string=hai) anos
pai
achega
5ad4712205

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SignPatientLabelInfoDao.java

@ -58,4 +58,14 @@ public interface SignPatientLabelInfoDao extends
     * @return
     */
    int deleteByPatientAndLabelTypeAndStatus(String patient, String labelType, Integer status);
    /**
     * 更新某个标签名称
     *
     * @param labelName
     * @param labelCode
     * @return
     */
    @Query("update SignPatientLabelInfo a set a.labelName = ?1 where a.label= ?2 and a.labelType = '4' ")
    int updateLabelName(String labelName,String labelCode);
}

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

@ -321,7 +321,7 @@ public class SignPatientLabelInfoService extends BaseService {
            if (diseaseSs != null && diseaseSs.size() > 0) {
                String[] diseaseArr = disease.split(",");
                if(diseaseArr == null || diseaseArr.length < 1){
                if (diseaseArr == null || diseaseArr.length < 1) {
                    return -3;
                }
@ -620,6 +620,38 @@ public class SignPatientLabelInfoService extends BaseService {
    }
    /**
     * 新增标签并添加患者
     *
     * @param labelName
     * @param creator
     * @param teamCode
     * @param patients
     * @return
     */
    public int addLabelAndPatient(String labelName, String creator, Long teamCode, String patients) {
        if(labelService.isLabelNameExist(labelName,teamCode) != null){
            return -4;
        }
        SignPatientLabel label = labelService.addLabel(labelName, creator, teamCode);
        if (StringUtils.isNotEmpty(patients)) {
            String[] patientArr = patients.split(",");
            for (String p : patientArr) {
                int result = addPatientLabel(p, label.getLabelCode(), "4");
                if (result != 1) {
                    return result;
                }
            }
        }
        return 1;
    }
    /**
     * 疾病转标签
     *

+ 9 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelService.java

@ -1,9 +1,13 @@
package com.yihu.wlyy.service.app.label;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelLog;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelLogDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -29,7 +33,8 @@ public class SignPatientLabelService extends BaseService {
    SignPatientLabelDao labelDao;
    @Autowired
    SignPatientLabelLogDao labelLogDao;
    @Autowired
    SignPatientLabelInfoDao labelInfoDao;
    /**
     * 新增自定义标签
@ -61,8 +66,8 @@ public class SignPatientLabelService extends BaseService {
     * @param teamCode
     * @return
     */
    public SignPatientLabel isLabelNameExist(String labelName, long teamCode){
        return labelDao.findByLabelNameAndLabelTypeAndTeamCode(labelName,"4",teamCode);
    public SignPatientLabel isLabelNameExist(String labelName, long teamCode) {
        return labelDao.findByLabelNameAndLabelTypeAndTeamCode(labelName, "4", teamCode);
    }
    /**
@ -97,6 +102,7 @@ public class SignPatientLabelService extends BaseService {
        label.setCzrq(new Date());
        labelLogDao.save(log);
        labelInfoDao.updateLabelName(newName,labelCode);
        return 1;
    }

+ 31 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -212,6 +212,37 @@ public class SignPatientLabelInfoController extends BaseController {
        }
    }
    /**
     * 新增标签并分配患者
     *
     * @param labelName 标签名称
     * @param teamCode  团队Code
     * @param patients  患者
     * @return
     */
    @RequestMapping(value = "/label_and_patients_add")
    public String addLabelAndPatient(String labelName, Long teamCode, @RequestParam(required = false) String patients) {
        try {
            if (StringUtils.isEmpty(labelName)) {
                return error(-1, "标签名称不能为空");
            }
            if (teamCode == null || teamCode < 1) {
                return error(-1, "团队code不能为空");
            }
            int result = labelInfoService.addLabelAndPatient(labelName, "fa4dd8565f0f11e68344fa163e8aee56", teamCode, patients);
            if (result != 1) {
                return error(-1, "添加失败");
            }
            return write(200, "添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "添加失败");
        }
    }
    /**
     * 删除居民某个标签
     *