Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

chenweida 8 years ago
parent
commit
2d9e8e617d

BIN
patient-co-service/wlyy_service/src/main/resources/libsehr.crypto.so


+ 38 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java

@ -2,12 +2,19 @@ package com.yihu.wlyy.adapter;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.system.Icd10DictServcie;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
 * Created by Trick on 2017/8/10.
@ -15,6 +22,11 @@ import java.util.Iterator;
@Component
public class PresModeAdapter {
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    @Autowired
    private ZyDictService zyDictService;
    /**
     * 续方模板适配器
     * @param json
@ -88,15 +100,14 @@ public class PresModeAdapter {
    }
    /**
     * 处方模板解析
     * 处方列表解析
     * @param json
     * @return
     * @throws Exception
     */
    public JSONArray modeToPrescription(String json)throws Exception{
        JSONObject oldJson = JSONObject.parseObject(json);
        String dataStr = oldJson.getString("data");
        JSONObject data = JSONObject.parseObject(dataStr);
        JSONObject data = oldJson.getJSONObject("data");
        JSONArray returnData = data.getJSONArray("returnData");
        String code = data.getString("CODE");
        if(StringUtils.isNotBlank(code)&&"1".equals(code)){
@ -108,15 +119,30 @@ public class PresModeAdapter {
                Prescription p  = new Prescription();
                p.setCode(mode.getInteger("RECIPE_NO")+"");
                p.setCreateTime(mode.getDate("APPLY_TIME"));
                //     "APPLY_OPERATOR_NAME": "开单医生姓名",
//                "HEALTH_ORG_CODE": "开单机构编码",
//                        "DIAGNOSE_CODE": "诊断代码",
//                        "DIAGNOSE_NAME": "诊断名称",
                Doctor doctor =  zyDictService.getDoctByJw(mode.getString("APPLY_OPERATOR"),mode.getString("HEALTH_ORG_CODE"));
                // "APPLY_OPERATOR_NAME": 开单医生姓名","HEALTH_ORG_CODE": "开单机构编码",
                p.setDoctor(doctor.getCode());
                p.setDoctorName(doctor.getName());
                p.setHospitalName(doctor.getHospitalName());
                p.setHospital(doctor.getHospital());
                JSONArray infos = mode.getJSONArray("TEMPLATE_DETAIL");
                PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
                diagnosis.setCode(mode.getString("DIAGNOSE_CODE"));//诊断代码
                diagnosis.setName(mode.getString("DIAGNOSE_NAME"));//诊断名称
                String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(mode.getString("DIAGNOSE_CODE"));
                if(!StringUtils.isEmpty(icd10)){
                    JSONObject icd = JSONObject.parseObject(icd10);
                    diagnosis.setHealthProblemName(icd.getString("value"));//诊断名称
                    diagnosis.setHealthProblem(icd.getString("key"));//诊断代码
                }else{
                    diagnosis.setHealthProblemName(mode.getString("DIAGNOSE_CODE"));//诊断名称
                    diagnosis.setHealthProblem(mode.getString("DIAGNOSE_NAME"));//诊断代码
                }
                JSONArray infos = mode.getJSONArray("RECIPE_DETAIL");
                Iterator infoIt = infos.iterator();
                JSONArray is = new JSONArray();
                List<PrescriptionInfo> prescriptionInfos = new ArrayList<>();
                while (infoIt.hasNext()){
                    JSONObject info = (JSONObject) infoIt.next();
                    PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
@ -149,10 +175,10 @@ public class PresModeAdapter {
                    prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                    prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                    prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                    is.add(prescriptionInfo);
                    prescriptionInfos.add(prescriptionInfo);
                }
//                m.put("prescriptionInfo",is);
//                rs.add(m);
                p.setPrescriptionInfo(prescriptionInfos);
                rs.add(p);
            }
            return rs;
        }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -98,6 +98,7 @@ public class SwaggerConfig {
                        regex("/wx/.*"),
                        regex("/area/.*"),
                        regex("/login/.*"),
                        regex("/loginPC/.*"),
                        regex("/qrcode/.*"),
                        regex("/onepay/.*"),
                        regex("/wlyy_service/.*"),

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -21,8 +21,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("update Prescription p set p.status=?2 where p.code=?1")
    void updateStatus(String prescriptionCode,Integer status);
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode,Integer status);
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 and p.patient=?3 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode,Integer status,String patient);
    //根据处方code得到患者信息
    @Query("select p from Prescription pt,Patient p where p.code=pt.patient  and pt.code=?1")
    Patient findPatientByPrescriptionCode(String prescriptionCode);

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1475,7 +1475,7 @@ public class DoctorInfoService extends BaseService {
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    String[] str = data.split("||");
                    String[] str = data.split("\\|\\|");
//                    String strSignData = str[0];
//                    String strCertData = str[1];
                    JSONObject jsonObject = new JSONObject();
@ -1486,6 +1486,7 @@ public class DoctorInfoService extends BaseService {
                    prescription.setCaMessage(str[0]);
                    prescription.setCaCertData(str[1]);
                    prescription.setDigitalSignNo(str[2]);
                    prescription.setStrOriginalData(strOriginalData);
                    prescription.setOriginalDataAbstract(originalDataAbstract);
                    prescriptionDao.save(prescription);
//                    String srcBusinessStreamNO = str[2];//CA 数字签名唯一流水号

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -878,7 +878,7 @@ public class ConsultTeamService extends ConsultService {
        synchronized (jwCode.intern()){
//            PrescriptionReviewed p = prescriptionReviewedDao.findByPrescriptionCodeAndStatus()
            List<Prescription> prescriptionList = prescriptionDao.fingdByJwCodeAndStatus(jwCode,0);
            List<Prescription> prescriptionList = prescriptionDao.fingdByJwCodeAndStatus(jwCode,0,patient);
            if(prescriptionList!=null&&prescriptionList.size()>0){//存在未审核的续方
                return -1;
            }

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

@ -128,6 +128,18 @@ public class PrescriptionInfoService extends BaseService {
                String rp= jwPrescriptionService.getLastRecipe(p.getSsc(),null,null,null);
                com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
                Iterator iterator = pres.iterator();
                while(iterator.hasNext()){
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject)iterator.next();
                    StringBuffer sql = new StringBuffer(" SELECT pr.code FORM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND r.status = 0");
                    List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),new Object[]{r.getString("code")});
                    if(mp!=null&&mp.size()>0){
                        r.put("reviewedState",'0');
                    }else{
                        r.put("reviewedState",'1');
                    }
                }
                return pres;
//                //基卫接口
//                List<Map<String,Object>> prescriptions = new ArrayList<>();

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -73,6 +73,7 @@ public class JwPrescriptionService {
        params.add(new BasicNameValuePair("applyTimeFrom", applyTimeFrom));
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.third.jw;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
@ -45,6 +46,31 @@ public class ZyDictService {
        return charaString.matches("^[a-zA-Z]*");
    }
    /**
     * 根据基位code返回医院名称
     * @param jwHospital
     * @return
     */
    public String findByHospital(String jwHospital){
        return hospitalMappingDao.getNameByMapping(jwHospital,"1");
    }
    /**
     * 根据基位code 获取医生
     * @param jwDoctor
     * @param jwHospital
     * @return
     */
    public Doctor getDoctByJw(String jwDoctor,String jwHospital){
        return doctorMappingDao.getDoctorByJw(jwHospital,jwDoctor);
    }
    /**
     * 获取药品字典
     * @param doctor
     * @param name
     * @return
     */
    public List<Map<String, Object>> findDictByDoctorAndName(String doctor,String name){
        String sql = "select " +
                        "p.physic_code drugCode," +

+ 9 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1873,7 +1873,7 @@ public class DoctorController extends BaseController {
    public String isAuthentication(){
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication("0de6a26a62dd11e69faffa163e8aee56");
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
@ -1890,8 +1890,8 @@ public class DoctorController extends BaseController {
            @RequestParam(value = "strOldCalledPasswd",required = true) String strOldCalledPasswd,
            @RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode("0de6a26a62dd11e69faffa163e8aee56");
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,"0de6a26a62dd11e69faffa163e8aee56");
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getRepUID());
            if(b){
                return write(200, "修改密码成功!", "data", b);
            }
@ -1911,8 +1911,8 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/installAuthenticationPassword", method = RequestMethod.POST)
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode("0de6a26a62dd11e69faffa163e8aee56");
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),"11111111",strNewCalledPasswd,"0de6a26a62dd11e69faffa163e8aee56");
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),"11111111",strNewCalledPasswd,getRepUID());
            if(b){
                return write(200, "设置密码成功!", "data", b);
            }
@ -1933,8 +1933,8 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/resetAuthenticationPassword", method = RequestMethod.POST)
    public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode("0de6a26a62dd11e69faffa163e8aee56");
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,"0de6a26a62dd11e69faffa163e8aee56");
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,getRepUID());
            if(b){
                return write(200, "重置密码成功!", "data", b);
            }
@ -1979,11 +1979,12 @@ public class DoctorController extends BaseController {
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/checkCertificate", method = RequestMethod.GET)
    @ApiOperation("校验医师输入的CA证书是否正确")
    public String checkCertificate(
            @ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum",required = true) String certificateNum){
        try {
            boolean b = doctorInfoService.checkCertificate("0de6a26a62dd11e69faffa163e8aee56",certificateNum);
            boolean b = doctorInfoService.checkCertificate(getRepUID(),certificateNum);
            return write(200, "获取信息成功!", "data", b);
        }catch (Exception e) {
            error(e);

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -84,6 +84,8 @@ public class BookingController extends WeixinBaseController {
     * @return
     */
    @RequestMapping(value = "test", method = RequestMethod.GET)
    @ApiOperation("获取智业字典列表")
    @ResponseBody
    public String test() {
        try {
//            zyDictJob.synchronizeZyCommonDict();
@ -95,10 +97,10 @@ public class BookingController extends WeixinBaseController {
//            zyDictJob.synchronizeZy_iv_staff_reg_type_allot_dict();//
//            zyDictJob.synchronizeZy_iv_subject_class_dict();
            zyDictJob.synchronizeZy_iv_dept_dict();
            return success("启动成功!");
            return success("获取智业字典列表成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
            return invalidUserException(e, -1, "获取智业字典列表失败:" + e.getMessage());
        }
    }