|
@@ -2,10 +2,12 @@ package cn.hnthyy.thmz.service.impl.his.mz;
|
|
|
|
|
|
import cn.hnthyy.thmz.Utils.PyWbUtil;
|
|
|
import cn.hnthyy.thmz.common.Constants;
|
|
|
+import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.zd.ZdIcdCode;
|
|
|
import cn.hnthyy.thmz.entity.thmz.TCommonParams;
|
|
|
import cn.hnthyy.thmz.enums.ParamsTypeEnum;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
+import cn.hnthyy.thmz.mapper.his.mz.MzBlRecordMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.mz.MzVisitTableMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.zd.ZdIcdCodeMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.TCommonParamsMapper;
|
|
@@ -33,6 +35,10 @@ public class TCommonParamsServiceImpl implements TCommonParamsService {
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
private MzVisitTableMapper mzVisitTableMapper;
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ private MzBlRecordMapper mzBlRecordMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public int saveTCommonParams(TCommonParams tCommonParams) {
|
|
@@ -123,9 +129,119 @@ public class TCommonParamsServiceImpl implements TCommonParamsService {
|
|
|
tCommonParams.setUsedTimes(Long.valueOf(num));
|
|
|
}
|
|
|
}
|
|
|
- tCommonParamsMapper.insertTCommonParams(tCommonParams);
|
|
|
+ try{
|
|
|
+ tCommonParamsMapper.insertTCommonParams(tCommonParams);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return zdIcdCodeList.size();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int initEmrChiefComplaint() throws MzException {
|
|
|
+ List<TCommonParams> tCommonParamsList =tCommonParamsMapper.selectTCommonParamsByParamsType(ParamsTypeEnum.SYMPTOM.code, null, null, null);
|
|
|
+ if (tCommonParamsList != null && tCommonParamsList.size() > 0) {
|
|
|
+ throw new MzException("已经初始化主诉记录,请勿重复操作");
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> emrChiefComplaintCountMap= mzBlRecordMapper.selectEmrChiefComplaintCount();
|
|
|
+ if(emrChiefComplaintCountMap!=null && emrChiefComplaintCountMap.size()>0){
|
|
|
+ TCommonParams tCommonParams = new TCommonParams();
|
|
|
+ tCommonParams.setParamsType(ParamsTypeEnum.SYMPTOM.code);
|
|
|
+ tCommonParams.setCreateTime(new Date());
|
|
|
+ for(Map<String,Object> map:emrChiefComplaintCountMap){
|
|
|
+ String emrChiefComplaint= (String) map.get("emr_chief_complaint");
|
|
|
+ if(StringUtils.isBlank(emrChiefComplaint)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tCommonParams.setParamsName(emrChiefComplaint);
|
|
|
+ tCommonParams.setCreateIdCode((String) map.get("doctor_code"));
|
|
|
+ tCommonParams.setWbCode(PyWbUtil.getWBCode(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setPyCode(PyWbUtil.toBigFirstChar(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setParamsStatus(YesNoEnum.NO.code);
|
|
|
+ tCommonParams.setUsedTimes(Long.valueOf((Integer)map.get("num")));
|
|
|
+ try{
|
|
|
+ tCommonParamsMapper.insertTCommonParams(tCommonParams);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return emrChiefComplaintCountMap.size();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int initEmrHpi() throws MzException {
|
|
|
+ List<TCommonParams> tCommonParamsList =tCommonParamsMapper.selectTCommonParamsByParamsType(ParamsTypeEnum.HISTORY_OF_PRESENT_ILLNESS.code, null, null, null);
|
|
|
+ if (tCommonParamsList != null && tCommonParamsList.size() > 0) {
|
|
|
+ throw new MzException("已经初始化现病史记录,请勿重复操作");
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> emrHpiCountMap= mzBlRecordMapper.selectEmrHpiCount();
|
|
|
+ if(emrHpiCountMap!=null && emrHpiCountMap.size()>0){
|
|
|
+ TCommonParams tCommonParams = new TCommonParams();
|
|
|
+ tCommonParams.setParamsType(ParamsTypeEnum.HISTORY_OF_PRESENT_ILLNESS.code);
|
|
|
+ tCommonParams.setCreateTime(new Date());
|
|
|
+ for(Map<String,Object> map:emrHpiCountMap){
|
|
|
+ String emrHpi= (String) map.get("emr_hpi");
|
|
|
+ if(emrHpi==null || StringUtils.isBlank(emrHpi)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tCommonParams.setParamsContent(emrHpi);
|
|
|
+ if(emrHpi.length()>20){
|
|
|
+ tCommonParams.setParamsName(emrHpi.substring(0,20));
|
|
|
+ }else {
|
|
|
+ tCommonParams.setParamsName(emrHpi);
|
|
|
+ }
|
|
|
+ tCommonParams.setCreateIdCode((String) map.get("doctor_code"));
|
|
|
+ tCommonParams.setWbCode(PyWbUtil.getWBCode(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setPyCode(PyWbUtil.toBigFirstChar(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setParamsStatus(YesNoEnum.NO.code);
|
|
|
+ tCommonParams.setUsedTimes(Long.valueOf((Integer)map.get("num")));
|
|
|
+ try{
|
|
|
+ tCommonParamsMapper.insertTCommonParams(tCommonParams);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return emrHpiCountMap.size();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int initEmrPs() throws MzException {
|
|
|
+ List<TCommonParams> tCommonParamsList =tCommonParamsMapper.selectTCommonParamsByParamsType(ParamsTypeEnum.FAMILY_HISTORY.code, null, null, null);
|
|
|
+ if (tCommonParamsList != null && tCommonParamsList.size() > 0) {
|
|
|
+ throw new MzException("已经初始化既往史记录,请勿重复操作");
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> emrPsCountMap= mzBlRecordMapper.selectEmrPsCount();
|
|
|
+ if(emrPsCountMap!=null && emrPsCountMap.size()>0){
|
|
|
+ TCommonParams tCommonParams = new TCommonParams();
|
|
|
+ tCommonParams.setParamsType(ParamsTypeEnum.FAMILY_HISTORY.code);
|
|
|
+ tCommonParams.setCreateTime(new Date());
|
|
|
+ for(Map<String,Object> map:emrPsCountMap){
|
|
|
+ String emrPs= (String) map.get("emr_ps");
|
|
|
+ if(emrPs==null || StringUtils.isBlank(emrPs)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tCommonParams.setParamsContent(emrPs);
|
|
|
+ if(emrPs.length()>20){
|
|
|
+ tCommonParams.setParamsName(emrPs.substring(0,20));
|
|
|
+ }else {
|
|
|
+ tCommonParams.setParamsName(emrPs);
|
|
|
+ }
|
|
|
+ tCommonParams.setCreateIdCode((String) map.get("doctor_code"));
|
|
|
+ tCommonParams.setWbCode(PyWbUtil.getWBCode(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setPyCode(PyWbUtil.toBigFirstChar(tCommonParams.getParamsName()));
|
|
|
+ tCommonParams.setParamsStatus(YesNoEnum.NO.code);
|
|
|
+ tCommonParams.setUsedTimes(Long.valueOf((Integer)map.get("num")));
|
|
|
+ try{
|
|
|
+ tCommonParamsMapper.insertTCommonParams(tCommonParams);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return emrPsCountMap.size();
|
|
|
+ }
|
|
|
}
|