|
@@ -39,7 +39,6 @@ export const addDiagnostic = (item) => {
|
|
|
const params = {
|
|
|
"age": emrData.age,
|
|
|
"featureType": "8",
|
|
|
- "disType": 1,
|
|
|
"diag": diag,
|
|
|
"diseaseId": item.id,
|
|
|
"lis": emrData.lis,
|
|
@@ -49,31 +48,61 @@ export const addDiagnostic = (item) => {
|
|
|
"symptom": emrData.current + emrData.main,
|
|
|
"vital": emrData.vital
|
|
|
};
|
|
|
+ //判断是否走慢病系统
|
|
|
+ const isChronic = state.diagnosticList.chronicMagItem && state.diagnosticList.chronicMagItem.name||state.mainSuit.chronicDesease && state.mainSuit.chronicDesease.name;
|
|
|
+ if (isChronic) {
|
|
|
+ let chronicList = JSON.parse(storageLocal.get('chronic'));
|
|
|
+ if(!chronicList){
|
|
|
+ getChronic().then(() =>{
|
|
|
+ chronicList = JSON.parse(storageLocal.get('chronic'));
|
|
|
+ for(let i=0; i<chronicList.length; i++){
|
|
|
+ if(chronicList[i].id==item.id&&chronicList[i].name==item.name){ //判断某个病是否为慢病
|
|
|
+ params.disType = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ hasTreatment(dispatch, state,item,url,params)
|
|
|
|
|
|
- json(url, params).then((data) =>{
|
|
|
- if (data.data.data) {
|
|
|
- item.treat = data.data.data.treat
|
|
|
- dispatch({
|
|
|
- type: ADD_DIAGNOSTIC,
|
|
|
- item: item
|
|
|
- })
|
|
|
+ });
|
|
|
} else {
|
|
|
- item.treat = null
|
|
|
- dispatch({
|
|
|
- type: ADD_DIAGNOSTIC,
|
|
|
- item: item
|
|
|
- })
|
|
|
+ for(let i=0; i<chronicList.length; i++){
|
|
|
+ if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
|
|
|
+ params.disType = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ hasTreatment(dispatch, state, item,url,params)
|
|
|
}
|
|
|
- dispatch({
|
|
|
- type: GET_DIAGNOSTIC_STR
|
|
|
- });
|
|
|
- dispatch(isAddMainSuit())
|
|
|
+ } else {
|
|
|
+ hasTreatment(dispatch, state, item,url,params)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- }).catch((e) =>{
|
|
|
- console.log(e)
|
|
|
+}
|
|
|
+
|
|
|
+function hasTreatment(dispatch, state,item,url, params) {
|
|
|
+ json(url, params).then((data) =>{
|
|
|
+ if (data.data.data) {
|
|
|
+ item.treat = data.data.data.treat
|
|
|
+ dispatch({
|
|
|
+ type: ADD_DIAGNOSTIC,
|
|
|
+ item: item
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ item.treat = null
|
|
|
+ dispatch({
|
|
|
+ type: ADD_DIAGNOSTIC,
|
|
|
+ item: item
|
|
|
})
|
|
|
}
|
|
|
+ dispatch({
|
|
|
+ type: GET_DIAGNOSTIC_STR
|
|
|
+ });
|
|
|
+ dispatch(isAddMainSuit())
|
|
|
|
|
|
+ }).catch((e) =>{
|
|
|
+ console.log(e)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
export const getTreatResult = (item) =>{
|
|
@@ -89,18 +118,6 @@ export const getTreatResult = (item) =>{
|
|
|
}
|
|
|
|
|
|
const emrData = getEMRParams();
|
|
|
- // const params = {
|
|
|
- // "age": emrData.age,
|
|
|
- // "featureType": "8",
|
|
|
- // "dis": emrData.dis,
|
|
|
- // "diseaseId": emrData.diseaeId,
|
|
|
- // "lis": emrData.lis,
|
|
|
- // "other": emrData.other,
|
|
|
- // "pacs": emrData.pacs,
|
|
|
- // "sex": emrData.sex,
|
|
|
- // "symptom": emrData.current||emrData.main,
|
|
|
- // "vital": emrData.vital
|
|
|
- // };
|
|
|
const diagnosticList = state.diagnosticList.diagnosticList;
|
|
|
let diag = '';
|
|
|
if(diagnosticList) {
|
|
@@ -118,7 +135,6 @@ export const getTreatResult = (item) =>{
|
|
|
"featureType": "8",
|
|
|
"diag": diag,
|
|
|
"diseaseId": item.id,
|
|
|
- "disType": 1,
|
|
|
"lis": emrData.lis,
|
|
|
"other": emrData.other,
|
|
|
"pacs": emrData.pacs,
|
|
@@ -139,52 +155,80 @@ export const getTreatResult = (item) =>{
|
|
|
// "symptom": "恶心,呕吐",
|
|
|
// "vital": ""
|
|
|
// }
|
|
|
-
|
|
|
- json(url, params).then((data) =>{
|
|
|
- let treat;
|
|
|
- if(data.data.data) {
|
|
|
- treat = data.data.data.treat || {}
|
|
|
+ const isChronic = state.diagnosticList.chronicMagItem && state.diagnosticList.chronicMagItem.name||state.mainSuit.chronicDesease && state.mainSuit.chronicDesease.name;
|
|
|
+ if (isChronic) {
|
|
|
+ let chronicList = JSON.parse(storageLocal.get('chronic'));
|
|
|
+ if(!chronicList){
|
|
|
+ getChronic().then(() =>{
|
|
|
+ chronicList = JSON.parse(storageLocal.get('chronic'));
|
|
|
+ for(let i=0; i<chronicList.length; i++){
|
|
|
+ if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
|
|
|
+ params.disType = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getTreatment(item, dispatch, state, url,params)
|
|
|
+
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ for(let i=0; i<chronicList.length; i++){
|
|
|
+ if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
|
|
|
+ params.disType = 1
|
|
|
+ }
|
|
|
}
|
|
|
- if(treat) {
|
|
|
- let adverseReactions = treat.adverseReactions
|
|
|
- dispatch({
|
|
|
- type: SET_TREATMENT,
|
|
|
- treatment: treat.treatment,
|
|
|
- generalTreat: treat.commonTreatment,
|
|
|
- surgeryTreat: treat.surgeryTreatment,
|
|
|
- })
|
|
|
- if (adverseReactions) { //如何之前存过不良反应,则替换成之前的不良反应
|
|
|
- const allAdversReactionList = state.treat.allAdversReactionList
|
|
|
- if(allAdversReactionList) {
|
|
|
- for(let i = 0; i < allAdversReactionList.length; i++) {
|
|
|
- if(item.id == allAdversReactionList[i].id) { //判断是否存过不良反应
|
|
|
- for (let j = 0; j < adverseReactions.length; j++) { //判断不良反应是否有相同的不良反应,如果有,替换
|
|
|
- for(let z = 0; z < allAdversReactionList[i].adversReactionList.length; z++) {
|
|
|
- if(adverseReactions[j].id == allAdversReactionList[i].adversReactionList[z].id) {
|
|
|
-
|
|
|
- adverseReactions[j] = allAdversReactionList[i].adversReactionList[z]
|
|
|
- }
|
|
|
- }
|
|
|
+ getTreatment(item, dispatch, state,url,params)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ getTreatment(item, dispatch, state,url,params)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function getTreatment(item, dispatch, state,url,params) {
|
|
|
+ json(url, params).then((data) =>{
|
|
|
+ let treat;
|
|
|
+ if(data.data.data) {
|
|
|
+ treat = data.data.data.treat || {}
|
|
|
+ }
|
|
|
+ if(treat) {
|
|
|
+ let adverseReactions = treat.adverseReactions
|
|
|
+ dispatch({
|
|
|
+ type: SET_TREATMENT,
|
|
|
+ treatment: treat.treatment,
|
|
|
+ generalTreat: treat.commonTreatment,
|
|
|
+ surgeryTreat: treat.surgeryTreatment,
|
|
|
+ })
|
|
|
+ if (adverseReactions) { //如何之前存过不良反应,则替换成之前的不良反应
|
|
|
+ const allAdversReactionList = state.treat.allAdversReactionList
|
|
|
+ if(allAdversReactionList) {
|
|
|
+ for(let i = 0; i < allAdversReactionList.length; i++) {
|
|
|
+ if(item.id == allAdversReactionList[i].id) { //判断是否存过不良反应
|
|
|
+ for (let j = 0; j < adverseReactions.length; j++) { //判断不良反应是否有相同的不良反应,如果有,替换
|
|
|
+ for(let z = 0; z < allAdversReactionList[i].adversReactionList.length; z++) {
|
|
|
+ if(adverseReactions[j].id == allAdversReactionList[i].adversReactionList[z].id) {
|
|
|
+
|
|
|
+ adverseReactions[j] = allAdversReactionList[i].adversReactionList[z]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
- adverseReactions = []
|
|
|
}
|
|
|
- dispatch({
|
|
|
- type: SET_ADVERSE_REACTIONS,
|
|
|
- adversReactionList: adverseReactions
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
- }).catch((e) =>{
|
|
|
- console.log(e)
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+ } else {
|
|
|
+ adverseReactions = []
|
|
|
+ }
|
|
|
+ dispatch({
|
|
|
+ type: SET_ADVERSE_REACTIONS,
|
|
|
+ adversReactionList: adverseReactions
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+}).catch((e) =>{
|
|
|
+ console.log(e)
|
|
|
+})
|
|
|
+}
|
|
|
|
|
|
export const saveAllAdverseReactions = (item) => {
|
|
|
return (dispatch, getState) => {
|