import groovy.json.*
import java.text.SimpleDateFormat
class ResShell{
String message
String code
ResData result
}
class ResData{
int size
ResRecords[] records
}
class ResRecords{
String applyId
String hisId
String hospId
String applyType
String name
String idNumber
int sex
String birthday
String age
String height
String weight
String mobile
String companyName
String address
String applyTime
String applyStatus
String testItemType
String testItem
}
def paramConvert(param){
def data = param.data;
if(!param.succeed){
return JsonOutput.toJson(new ResShell(code:0,message:param.message,result:null))
}
def resArray = [];
for(d in data){
def applyTime = '';
if(d.billingTime != null){
applyTime = d.billingTime.format("yyyy-MM-dd HH:mm:ss")
}
def reqParam = new ResRecords(applyId:d.billingCode,hisId:d.checkNumber,hospId:d.checkNumber,applyType:2,
name:d.name,idNumber:d.idcard,sex:d.sex,birthday:d.birthday,age:d.age,height:d.height,weight:d.weight,mobile:d.phone,
companyName:d.companyName,address:d.address,applyTime:applyTime,applyStatus:0,testItemType:'13',testItem:'肺功能测定')
resArray.add(reqParam)
}
def resData = new ResData(size:resArray.size(),records:resArray)
return JsonOutput.toJson(new ResShell(code:1,message:param.message,result:resData))
}