|
@@ -36,6 +36,8 @@ public class InformedConsentTran extends TargetTran {
|
|
|
private List<String> stagesContrasts = Lists.newArrayList(
|
|
|
"科别=科室名称",
|
|
|
"科别=病区名称",
|
|
|
+ "科室=科室名称",
|
|
|
+ "科室=病区名称",
|
|
|
"床号=病房号",
|
|
|
"床号=病床号",
|
|
|
"病情告知=知情同意内容",
|
|
@@ -46,12 +48,16 @@ public class InformedConsentTran extends TargetTran {
|
|
|
private Map<String, String> cutWord(String text) {
|
|
|
Map<String, String> sourceMap = Maps.newHashMap();
|
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
|
- Lists.newArrayList("科别","床号","联系地址","具体如下","病情告知","知情选择","医师签名","医生签字"), text);
|
|
|
+ Lists.newArrayList("科别","科室","床号","病历号","住院号","住院号码","联系地址","具体如下","病情告知","知情选择","医师签名","医生签字"), text);
|
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
|
- if(sourceMap.containsKey("联系地址") || sourceMap.containsKey("医生签字")|| sourceMap.containsKey("医师签名")){
|
|
|
+ if(sourceMap.containsKey("联系地址") || sourceMap.containsKey("医生签字")|| sourceMap.containsKey("医师签名")
|
|
|
+ || sourceMap.containsKey("住院号")|| sourceMap.containsKey("住院号码")|| sourceMap.containsKey("病历号")){
|
|
|
sourceMap.remove("联系地址");
|
|
|
sourceMap.remove("医生签字");
|
|
|
sourceMap.remove("医师签名");
|
|
|
+ sourceMap.remove("住院号");
|
|
|
+ sourceMap.remove("住院号码");
|
|
|
+ sourceMap.remove("病历号");
|
|
|
}
|
|
|
return sourceMap;
|
|
|
}
|
|
@@ -116,12 +122,32 @@ public class InformedConsentTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (hero.contains("医生签字")) {
|
|
|
+ String doctorSign = "医生签字:";
|
|
|
+ if (hero.contains("医生签名")) {
|
|
|
+ doctorSign = "医生签名";
|
|
|
+ }
|
|
|
+ if (hero.contains("医生签名:")) {
|
|
|
+ doctorSign = "医生签名:";
|
|
|
+ }
|
|
|
+ if (hero.contains("医生签名:")) {
|
|
|
+ doctorSign = "医生签名:";
|
|
|
+ }
|
|
|
+ if (hero.contains("医生签字:")) {
|
|
|
+ doctorSign = "医生签字:";
|
|
|
+ }
|
|
|
+ if (hero.contains("医师签名:")) {
|
|
|
+ doctorSign = "医师签名:";
|
|
|
+ }
|
|
|
+ if (hero.contains("医师签名:")) {
|
|
|
+ doctorSign = "医师签名:";
|
|
|
+ }
|
|
|
+ String signDate = "签名时间";
|
|
|
+ if (hero.contains("签名日期")) {
|
|
|
+ signDate = "签名日期";
|
|
|
+ }
|
|
|
+ if (hero.contains(doctorSign)) {
|
|
|
if (StringUtil.isNotEmpty(hero)) {
|
|
|
- String firRet = "医生签字:";
|
|
|
- if (!hero.contains(firRet)) {
|
|
|
- firRet = "医生签字:";
|
|
|
- }
|
|
|
+ String firRet = doctorSign;
|
|
|
String firStr = hero.substring(hero.lastIndexOf(firRet) + firRet.length());
|
|
|
String date = extractDate(firStr);
|
|
|
String secStr = "";
|
|
@@ -133,16 +159,37 @@ public class InformedConsentTran extends TargetTran {
|
|
|
secStr = firStr.substring(0, firStr.lastIndexOf("年"));
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtil.isNotEmpty(secStr.trim())) {
|
|
|
+ if(hero.contains(signDate)){
|
|
|
+ secStr = hero.substring(hero.lastIndexOf(firRet) + firRet.length(), hero.lastIndexOf(signDate));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotEmpty(secStr)) {
|
|
|
+ secStr = parseString(secStr.trim());
|
|
|
+ if (StringUtil.isNotEmpty(secStr) && StringUtil.isNotEmpty(secStr.trim())) {
|
|
|
retMap.put("医师签名", secStr);
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if (hero.contains("患方签字")) {
|
|
|
- String firRet = "患方签字:";
|
|
|
- if (!hero.contains(firRet)) {
|
|
|
- firRet = "患方签字:";
|
|
|
- }
|
|
|
+
|
|
|
+ String hitSign = "患方签字:";
|
|
|
+
|
|
|
+ if (hero.contains("患者签名")) {
|
|
|
+ hitSign = "患者签名";
|
|
|
+ }
|
|
|
+ if (hero.contains("患方签字:")) {
|
|
|
+ hitSign = "患方签字:";
|
|
|
+ }
|
|
|
+ if (hero.contains("患方签名:")) {
|
|
|
+ hitSign = "患方签名:";
|
|
|
+ }
|
|
|
+ if (hero.contains("患方签名:")) {
|
|
|
+ hitSign = "患方签名:";
|
|
|
+ }
|
|
|
+ if (hero.contains("患者授权亲属签名")) {
|
|
|
+ hitSign = "患者授权亲属签名";
|
|
|
+ }
|
|
|
+ if (hero.contains(hitSign)) {
|
|
|
+ String firRet = hitSign;
|
|
|
String firStr = hero.substring(hero.lastIndexOf(firRet) + firRet.length());
|
|
|
String date = extractDate(firStr);
|
|
|
if (StringUtil.isNotEmpty(date)) {
|
|
@@ -150,25 +197,100 @@ public class InformedConsentTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
//知情同意内容&&医疗机构意见
|
|
|
- if (StringUtil.isNotEmpty(retMap.get("知情选择").trim())) {
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("知情选择"))&& StringUtil.isNotEmpty(retMap.get("知情选择").trim())) {
|
|
|
String choose = retMap.get("知情选择");
|
|
|
if(choose.contains("医生签字")){
|
|
|
choose = choose.substring(0, choose.lastIndexOf("医生签字"));
|
|
|
}
|
|
|
- if (StringUtil.isNotEmpty(retMap.get("病情告知").trim())) {
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("病情告知")) && StringUtil.isNotEmpty(retMap.get("病情告知").trim())) {
|
|
|
String tell = retMap.get("病情告知");
|
|
|
- retMap.put("病情告知",tell+"知情选择:"+choose);
|
|
|
+ retMap.put("病情告知",tell+" 知情选择:"+choose);
|
|
|
}else{
|
|
|
retMap.put("病情告知",choose);
|
|
|
}
|
|
|
retMap.remove("知情选择");
|
|
|
}
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(retMap.get("具体如下"))&& StringUtil.isNotEmpty(retMap.get("具体如下").trim())) {
|
|
|
+ String tell = retMap.get("具体如下");
|
|
|
+ if(tell.contains("医生签字")){
|
|
|
+ tell = tell.substring(0, tell.lastIndexOf("医生签字"));
|
|
|
+ }
|
|
|
+ String choose = "";
|
|
|
+ if (text.contains("患者知情选择")) {
|
|
|
+ choose = text.substring(text.indexOf("患者知情选择")+"患者知情选择".length());
|
|
|
+ }
|
|
|
+ if (choose.contains("患方签名")) {
|
|
|
+ choose = choose.substring(0,choose.indexOf("患方签名"));
|
|
|
+ }
|
|
|
+ if (choose.contains("医生签字")) {
|
|
|
+ choose = choose.substring(0,choose.indexOf("医生签字"));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(choose)){
|
|
|
+ retMap.put("病情告知",tell+" 患者知情选择:"+choose);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ retMap.put("病情告知",tell);
|
|
|
+ }
|
|
|
+ retMap.remove("具体如下");
|
|
|
+ }else{
|
|
|
+ String choose = "";
|
|
|
+ if (text.contains("患者知情选择")) {
|
|
|
+ choose = text.substring(text.indexOf("患者知情选择")+"患者知情选择".length());
|
|
|
+ }
|
|
|
+ if (choose.contains("患方签名")) {
|
|
|
+ choose = choose.substring(0,choose.indexOf("患方签名"));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(choose)){
|
|
|
+ retMap.put("病情告知",choose);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //镇静镇痛谈话 && 阿片类药物治疗知情同意书
|
|
|
+ if(text.contains("疾病介绍和治疗建议")){
|
|
|
+ String advice = "";
|
|
|
+ if (text.contains("疾病介绍和治疗建议")) {
|
|
|
+ advice = text.substring(text.indexOf("疾病介绍和治疗建议")+"疾病介绍和治疗建议".length());
|
|
|
+ }
|
|
|
+ String replaceName = "患方签名";
|
|
|
+ if (advice.contains("患者签名")) {
|
|
|
+ replaceName = "患者签名";
|
|
|
+ }
|
|
|
+ if (advice.contains(replaceName)) {
|
|
|
+ advice = advice.substring(0,advice.indexOf(replaceName));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(advice)){
|
|
|
+ retMap.put("病情告知",advice);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //特殊医用材料使用知情同意书
|
|
|
+ if(text.contains("材料内容")){
|
|
|
+ String record = "";
|
|
|
+ if (text.contains("材料内容")) {
|
|
|
+ record = text.substring(text.indexOf("材料内容")+"材料内容".length());
|
|
|
+ }
|
|
|
+ if (record.contains("患者(或授权人)签字")) {
|
|
|
+ record = record.substring(0,record.indexOf("患者(或授权人)签字"));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(record)){
|
|
|
+ retMap.put("病情告知",record);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtil.isNotEmpty(retMap.get("病情告知"))){
|
|
|
+ String tell = retMap.get("病情告知");
|
|
|
+ tell = lineFeed(tell);
|
|
|
+ tell = strFirLast(tell);
|
|
|
+ if(StringUtil.isNotEmpty(tell)){
|
|
|
+ retMap.put("病情告知",tell);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
// 取/前
|
|
|
public static String parseStr(String text){
|
|
@@ -179,9 +301,56 @@ public class InformedConsentTran extends TargetTran {
|
|
|
return text;
|
|
|
}
|
|
|
|
|
|
+ // 取/后
|
|
|
+ public static String parseString(String text){
|
|
|
+ if(text.contains("/")){
|
|
|
+ text = text.substring(text.lastIndexOf("/")+1);
|
|
|
+ text= parseString(text);
|
|
|
+ }
|
|
|
+ return text;
|
|
|
+ }
|
|
|
+
|
|
|
+ //去换行符
|
|
|
+ public static String lineFeed(String firStr){
|
|
|
+ if(StringUtil.isNotEmpty(firStr)){
|
|
|
+ if(firStr.contains("\n")){
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ String[] split = firStr.split("\n");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ sb.append(split[i]+" ");
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(sb.toString())){
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return firStr;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //去首尾字符串字符
|
|
|
+ public static String strFirLast(String firStr){
|
|
|
+ if(StringUtil.isNotEmpty(firStr)){
|
|
|
+ String flag = ":";
|
|
|
+ String flagReplace = ":";
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (int i = 0; i < firStr.length(); i++) {
|
|
|
+ String str = String.valueOf(firStr.charAt(i));
|
|
|
+ if(i <=2 && str.contains(flag)||str.contains(flagReplace)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(i<=firStr.length()-1 && i>2 && str.contains(flag)||str.contains(flagReplace)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ sb.append(str);
|
|
|
+ }
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 抽取文本中的第一个时间
|
|
|
- *
|
|
|
* @param top
|
|
|
* @return
|
|
|
*/
|