Pārlūkot izejas kodu

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

trick9191 8 gadi atpakaļ
vecāks
revīzija
951cd1383a

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 98 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java


+ 46 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -4,12 +4,14 @@ import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
@ -66,6 +68,8 @@ public class PrescriptionInfoService extends BaseService {
    private MessageDao messageDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -224,20 +228,40 @@ public class PrescriptionInfoService extends BaseService {
        return null;
    }
    public JSONObject  getPrescriptionProcess(String code){
    public com.alibaba.fastjson.JSONObject  getPrescriptionProcess(String code){
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        PrescriptionReviewed reviewed =  prescriptionReviewedDao.findByPrescriptionCode(code);
        List<PrescriptionAdjust> prescriptionAdjusts = prescriptionAdjustDao.findByPrescriptionCode(code);
        JSONObject rs = new JSONObject();
        com.alibaba.fastjson.JSONObject rs = new  com.alibaba.fastjson.JSONObject();
        if(prescription!=null&&StringUtils.isNotBlank(prescription.getPatient())){
            Patient p = patientDao.findByCode(prescription.getPatient());
            rs.put("patient",p);
            Map<String,Object> pp =new HashedMap();
            pp.put("code",p.getCode());
            pp.put("name",p.getName());
            pp.put("idcard",p.getIdcard());
            pp.put("ssc",p.getSsc());
            pp.put("mobile",p.getMobile());
            rs.put("patient",pp);
            SignFamily signFamily = signFamilyDao.findByIdcard(p.getIdcard());
            Map<String,Object> sf =new HashedMap();
            sf.put("doctor",signFamily.getDoctor());
            sf.put("hospital",signFamily.getHospital());
            sf.put("doctorName",signFamily.getDoctorName());
            sf.put("hospitalName",signFamily.getHospitalName());
            rs.put("signFamily",sf);
        }else{
            rs.put("patient","");
            rs.put("signFamily","");
        }
        if(prescription.getStatus()==10){
        if(prescription!=null&&prescription.getStatus()==10){
            Long s = (prescription.getCreateTime().getTime()-new Date().getTime())/1000;
            //rs.put("time",s);
            if(s>172800){
@ -313,15 +337,13 @@ public class PrescriptionInfoService extends BaseService {
            //疾病类型不为空,关联查询疾病类型表
            pre_sql.append(" ,wlyy_prescription_diagnosis s " +
                    " WHERE s.prescription_code = pr.code " +
                    " AND pr.admin_team_id =? AND s.code = ?");
            params.add(teamCode);
                    " AND s.code = ?");
            params.add(diseases);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,patient,page,size);
            setSQL(pre_sql,params,teamCode,state,startDate,endDate,nameKeyword,patient,page,size);
        }else{
            //查询所有疾病类型表
            pre_sql.append(" WHERE pr.admin_team_id =?");
            params.add(teamCode);
            setSQL(pre_sql,params,state,startDate,endDate,nameKeyword,patient,page,size);
            pre_sql.append(" WHERE 1=1 ");
            setSQL(pre_sql,params,teamCode,state,startDate,endDate,nameKeyword,patient,page,size);
        }
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
@ -334,7 +356,11 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate,String nameKeyword,String patient,Integer page,Integer size){
    public void setSQL(StringBuffer pre_sql,List<Object> params,Integer teamCode,String state,String startDate,String endDate,String nameKeyword,String patient,Integer page,Integer size){
        if(teamCode!=null&&teamCode>0){
            pre_sql.append(" AND pr.admin_team_id =?");
        }   params.add(teamCode);
        if(StringUtils.isNotBlank(state)){
            pre_sql.append(" AND pr.status IN ("+state+") ");
        }
@ -605,7 +631,7 @@ public class PrescriptionInfoService extends BaseService {
        }
        if(StringUtils.isNotBlank(endDate)){
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(startDate+" 23:59:59");
            param.add(endDate+" 23:59:59");
        }
        if(StringUtils.isNotBlank(hospital)){
            pre_sql.append(" AND e.hospital_code = ? ");
@ -764,7 +790,7 @@ public class PrescriptionInfoService extends BaseService {
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code " +
                " WHERE 1=1 " );
                " WHERE r.status=1 " );
        List<Object> params = new ArrayList<>();
        setDoctorExpressageSql(pre_sql,params, teamCode,  nameKey, startDate, endDate, hospital, state,dispensaryType,AllocationType, page, size);
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
@ -792,7 +818,7 @@ public class PrescriptionInfoService extends BaseService {
        }
        if(StringUtils.isNotBlank(endDate)){
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(startDate+" 23:59:59");
            param.add(endDate+" 23:59:59");
        }
        if(StringUtils.isNotBlank(hospital)){
            pre_sql.append(" AND e.hospital_code = ? ");
@ -900,4 +926,10 @@ public class PrescriptionInfoService extends BaseService {
        }
        return 0;
    }
    public JSONArray getIcd10Info(String nameKey){
        StringBuffer stringBuffer = new StringBuffer(" SELECT t.code,t.name FROM icd10_dict t WHERE t.name LIKE ?");
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(stringBuffer.toString(),new Object[]{"%"+nameKey+"%"});
        return new JSONArray(rs);
    }
}

+ 26 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.adapter.PresModeAdapter;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
@ -41,6 +42,8 @@ public class PrescriptionInfoController extends BaseController{
    private PrescriptionPayService prescriptionPayService;
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private PresModeAdapter adapter;
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
@ -56,7 +59,7 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生/建管师续方列表/搜索")
    public String getDoctorPrescription(@RequestParam(required = true)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
    public String getDoctorPrescription(@RequestParam(required = false)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false)@ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
@ -303,4 +306,26 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    @RequestMapping(value = "/testAdapter", method = RequestMethod.POST)
    @ApiOperation(value = "测试适配器")
    public String testAdapter(@RequestParam(required = true) @ApiParam(value = "字符串", name = "json") String json){
        try {
            return write(200, "操作成功!", "data",adapter.modeTopresInfo(json));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getIcd10Info", method = RequestMethod.GET)
    @ApiOperation(value = "获取诊断结果")
    public String getIcd10Info(@RequestParam(required = true) @ApiParam(value = "诊断结果关键字", name = "nameKey") String nameKey){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getIcd10Info(nameKey));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}