瀏覽代碼

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

lyr 8 年之前
父節點
當前提交
2012c5db71

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -44,6 +44,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
	SignFamily findByDoctorPatient(String doctor, String patient);
	@Query("select a from SignFamily a where a.doctorHealth = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
	SignFamily findByDoctorHealthPatient(String doctor, String patient);
	@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 1 and a.status > 0")
	SignFamily findSsSignByDoctorPatient(String doctor, String patient);

+ 21 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -232,7 +232,13 @@ public class FamilyContractService extends BaseService {
        json.put("expertise", d.getExpertise());
        json.put("level", d.getLevel());
        // 查询与当前医生的签约状态
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        SignFamily sf = null;
        if (d.getLevel() == 2) {
            sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        }else if(d.getLevel() == 3){
            sf = signFamilyDao.findByDoctorHealthPatient(doctor, patient);
        }
        if (sf == null) {
            // 没有签约信息
            json.put("sign", -1);
@ -564,9 +570,20 @@ public class FamilyContractService extends BaseService {
     * @param doctor  医生标识
     * @return
     */
    public int unsign(String patient, String doctor) {
    public int unsign(String patient, String doctor) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if(doc == null){
            throw new Exception("doctor info can not find");
        }
        //修改签约标识为无效
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        SignFamily sf = null;
        if(doc.getLevel() == 2){
            sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        } else if(doc.getLevel() == 3){
            sf = signFamilyDao.findByDoctorHealthPatient(doctor, patient);
        }
        Message message = messageDao.findByPatient(patient, doctor);
        if (sf.getStatus() != 0 && sf.getStatus() != 2) {
            return -2;
@ -1528,7 +1545,7 @@ public class FamilyContractService extends BaseService {
     * @param healthDoctor 健康管理师code
     * @return
     */
    public JSONObject updateSignInfo(String patient, String healthDoctor,String doctor, String expensesType) {
    public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType) {
        JSONObject result = new JSONObject();
        SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(patient);

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

@ -48,6 +48,7 @@ public class SignWebService extends BaseService {
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.idcard " +
                "    ,b.name " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
@ -56,12 +57,12 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                (status == 1? "    ,a.patient_apply_date as applyDate ":"    ,a.apply_date as applyDate ") +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2 order by begin desc ) a " +
                " ( select code,patient,doctor,status,id,apply_date,patient_apply_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";
@ -71,6 +72,7 @@ public class SignWebService extends BaseService {
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
@ -78,7 +80,7 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                "    ,a.apply_date as applyDate " +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
@ -93,6 +95,7 @@ public class SignWebService extends BaseService {
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
@ -100,12 +103,12 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                "    ,a.apply_unsign_date as applyDate" +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ( select code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";

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

@ -6,6 +6,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import com.yihu.wlyy.util.IdCardUtil;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -234,6 +235,7 @@ public class DoctorSignController extends BaseController {
                    json.put("doctorCode", temp.get("doctor"));
                    json.put("patientCode", temp.get("patient"));
                    json.put("patientName", temp.get("name"));
                    json.put("age", IdCardUtil.getAgeForIdcard(String.valueOf(temp.get("idcard"))));
                    json.put("provinceName", temp.get("provinceName"));
                    json.put("cityName", temp.get("cityName"));
                    json.put("townName", temp.get("townName"));