@ -10,10 +10,12 @@ import com.ynxbd.common.helper.common.JsonHelper;
import com.ynxbd.common.helper.http.OkHttpHelper ;
import com.ynxbd.common.result.JsonResult ;
import com.ynxbd.common.result.JsonResultEnum ;
import com.ynxbd.common.result.Result ;
import lombok.extern.slf4j.Slf4j ;
import okhttp3.MediaType ;
import okhttp3.RequestBody ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
@ -36,12 +38,19 @@ public class MeTechnologyReConfig {
public static final MediaType JSON
= MediaType . parse ( "application/json; charset=utf-8" ) ;
static {
ProperHelper config = new ProperHelper ( ) . read ( "medical-technology-reserve.properties" ) ;
MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL = config . getString ( "medical_technology_reserve_webservice_url" ) ;
MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO = config . getString ( "medical_technology_reserve_terminal_no" ) ;
MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID = config . getString ( "medical_technology_reserve_test_patientId" ) ;
MEDICAL_TECHNOLOGY_RESERVE_JSON_URL = config . getString ( "medical_technology_reserve_json_url" ) ;
if ( config = = null ) {
MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL = null ;
MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO = null ;
MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID = null ;
MEDICAL_TECHNOLOGY_RESERVE_JSON_URL = null ;
}
else {
MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL = config . getString ( "medical_technology_reserve_webservice_url" ) ;
MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO = config . getString ( "medical_technology_reserve_terminal_no" ) ;
MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID = config . getString ( "medical_technology_reserve_test_patientId" ) ;
MEDICAL_TECHNOLOGY_RESERVE_JSON_URL = config . getString ( "medical_technology_reserve_json_url" ) ;
}
}
public static void reserveRun ( String patientId ) {
@ -93,7 +102,7 @@ public class MeTechnologyReConfig {
* 预约平台提供 , 终端调用 , 主要用来获取患者申请单列表 , 用于预约改约
* @return 根据患者身份获得开立检查单情况
* /
public static List < BookOrder > getCanBookOrders ( String patientId , String startDate , String endDate ) {
public static Result getCanBookOrders ( String patientId , String startDate , String endDate ) {
Map < String , String > params = new HashMap < > ( ) ;
params . put ( "PatientId" , patientId ) ;
params . put ( "StartDate" , startDate ) ;
@ -108,13 +117,13 @@ public class MeTechnologyReConfig {
JSONObject jsonObject = JsonHelper . parseObject ( result ) ;
if ( jsonObject = = null ) {
log . info ( "[天助预约平台] patientId-{},startDate-{},endDate-{} 获取患者申请信息失败,result-{}" , patientId , startDate , endDate , result ) ;
return null ;
return Result . error ( ) ;
}
if ( ! "0" . equals ( jsonObject . getString ( "ResultCode" ) ) ) {
log . info ( "[天助预约平台] 获取患者申请信息失败,失败原因-{}" , jsonObject . getString ( "ResultContent" ) ) ;
return null ;
return Result . error ( jsonObject . getString ( "ResultCode" ) ) ;
}
return jsonObject . getJSONArray ( "OrderLists" ) . toJavaList ( BookOrder . class ) ;
return Result . success ( jsonObject . getJSONArray ( "OrderLists" ) . toJavaList ( BookOrder . class ) ) ;
}
/ * *
@ -126,7 +135,7 @@ public class MeTechnologyReConfig {
* @param intervalTimeType 上午或者下午
* @return 日期范围获得可使用资源概况
* /
public static List < NumberSourceStatistics > getNumberSourceStatistics ( String patientId , String startDate , String endDate , String docDetailedNo , String intervalTimeType ) {
public static Result getNumberSourceStatistics ( String patientId , String startDate , String endDate , String docDetailedNo , String intervalTimeType ) {
Map < String , String > params = new HashMap < > ( ) ;
params . put ( "PatientId" , patientId ) ;
params . put ( "StartDate" , startDate ) ;
@ -142,13 +151,13 @@ public class MeTechnologyReConfig {
JSONObject jsonObject = JsonHelper . parseObject ( result ) ;
if ( jsonObject = = null ) {
log . info ( "[天助预约平台] patientId-{},startDate-{},endDate-{},docDetailedNo-{},intervalTimeType-{} 根据日期范围获得可使用资源概况失败,result-{}" , patientId , startDate , endDate , docDetailedNo , intervalTimeType , result ) ;
return null ;
return Result . error ( ) ;
}
if ( ! "0" . equals ( jsonObject . getString ( "resultCode" ) ) ) {
log . info ( "[天助预约平台] 根据日期范围获得可使用资源概况失败,失败原因-{}" , jsonObject . getString ( "resultContent" ) ) ;
return null ;
return Result . error ( jsonObject . getString ( "resultCode" ) ) ;
}
return jsonObject . getJSONArray ( "numberSourceStatisticsApplyDTO" ) . toJavaList ( NumberSourceStatistics . class ) ;
return Result . success ( jsonObject . getJSONArray ( "numberSourceStatisticsApplyDTO" ) . toJavaList ( NumberSourceStatistics . class ) ) ;
}
/ * *
@ -159,7 +168,7 @@ public class MeTechnologyReConfig {
* @param appFromID 医嘱申请单号
* @return 号池明细信息
* /
public static List < NumberSourceDetails > getNumberSourceDetails ( String examRoomOrQueue , String startDate , String endDate , String appFromID ) {
public static Result getNumberSourceDetails ( String examRoomOrQueue , String startDate , String endDate , String appFromID ) {
JSONObject jsonParams = new JSONObject ( ) ;
jsonParams . put ( "examRoomOrQueue" , examRoomOrQueue ) ;
@ -174,13 +183,13 @@ public class MeTechnologyReConfig {
JSONObject jsonObject = JsonHelper . parseObject ( result ) ;
if ( jsonObject = = null ) {
log . info ( "[天助预约平台] examRoomOrQueue-{},startDate-{},endDate-{},appFromID-{}, 获取号池明细失败,result-{}" , examRoomOrQueue , startDate , endDate , appFromID , result ) ;
return null ;
return Result . error ( ) ;
}
if ( ! "0" . equals ( jsonObject . getString ( "resultCode" ) ) ) {
log . info ( "[天助预约平台] 获取号池明细失败,失败原因-{}" , jsonObject . getString ( "resultContent" ) ) ;
return null ;
return Result . error ( jsonObject . getString ( "resultCode" ) ) ;
}
return jsonObject . getJSONArray ( "numPoolDetailsDTOList" ) . toJavaList ( NumberSourceDetails . class ) ;
return Result . success ( jsonObject . getJSONArray ( "numPoolDetailsDTOList" ) . toJavaList ( NumberSourceDetails . class ) ) ;
}
/ * *
@ -215,30 +224,33 @@ public class MeTechnologyReConfig {
return true ;
}
public static BookedInfo getBookedDateTime ( String appFormID , String examRoomOrQueue , String beginDateTime , String endDateTime , String patientId , String patientName ) {
public static Result getBookedDateTime ( String appFormID , String examRoomOrQueue , String beginDateTime , String endDateTime , String patientId , String patientName ) {
Map < String , String > param = new HashMap < > ( ) ;
param . put ( "AppFormID" , appFormID ) ;
param . put ( "ExamRoomOrQueue" , examRoomOrQueue ) ;
param . put ( "BeginDateTime" , beginDateTime ) ;
param . put ( "EndDateTime" , endDateTime ) ;
List < Map < String , String > > paramList = new ArrayList < > ( ) ;
paramList . add ( param ) ;
Map < String , Object > params = new HashMap < > ( ) ;
params . put ( "BookedDateTimeDTOList" , param ) ;
params . put ( "BookedDateTimeDTOList" , paramList ) ;
params . put ( "ScheduleUserId" , patientId ) ;
params . put ( "ScheduleUser" , patientName ) ;
RequestBody requestBody = RequestBody . create ( JSON , JsonHelper . toJsonString ( params ) ) ;
log . info ( "[天助预约平台] 确定预约json={}" , JsonHelper . toProJsonString ( params ) ) ;
RequestBody requestBody = RequestBody . create ( JSON , JsonHelper . toProJsonString ( params ) ) ;
String result = OkHttpHelper . post ( MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetBookedDateTime" , requestBody , headers - > {
headers . add ( "token" , getToken ( ) ) ;
} ) ;
JSONObject jsonObject = JsonHelper . parseObject ( result ) ;
if ( jsonObject = = null ) {
log . info ( "[天助预约平台] examRoomOrQueue-{},startDate-{},endDate-{},appFromID-{}, patientId-{},patientName-{}, 提交预约具体时间失败,result-{}" , examRoomOrQueue , beginDateTime , endDateTime , appFormID , patientId , patientName , result ) ;
return null ;
return Result . error ( ) ;
}
if ( ! "0" . equals ( jsonObject . getString ( "resultCode" ) ) ) {
log . info ( "[天助预约平台] 提交预约具体时间失败,失败原因-{}" , jsonObject . getString ( "resultContent" ) ) ;
return null ;
return Result . error ( jsonObject . getString ( "resultCode" ) ) ;
}
return jsonObject . getJSONArray ( "bookedInfos" ) . toJavaList ( BookedInfo . class ) . get ( 0 ) ;
return Result . success ( jsonObject . getJSONArray ( "bookedInfos" ) . toJavaList ( BookedInfo . class ) . get ( 0 ) ) ;
}