function consulta(checkId, inputId, valor) {
const input = document.getElementById(inputId);
if (document.getElementById(checkId).checked) {
input.value = valor;
input.disabled = true;
} else {
input.value = "";
input.readOnly = true;
input.disabled = false;
}
}
<form>
<fieldset>
<legend>
<font color="darkblue">Serviços</font>
</legend><br>
<table width="80%" border="0" style="border-color: Gainsboro" cellpadding="10">
<tr>
<td>
<input type="checkbox" name="servico1" id="checkBA" onclick='consulta("checkBA","consT","R$ 75,00")' ;> Consulta
<td><input type="text" id="consT" size="20" maxlength="35" readonly/></td>
</tr>
<tr>
<td>
<input type="checkbox" name="servico2" id="checkBB" onclick='consulta("checkBB","interT","R$ 510,00")' ; /> Internação
<td><input type="text" id="interT" size="20" maxlength="35" readonly/></td>
</tr>
<tr>
<td>
<input type="checkbox" name="servico3" id="checkBC" onclick='consulta("checkBC","examT","R$ 150,00")' ; /> Exames Laboratoriais
<td><input type="text" id="examT" size="20" maxlength="35" readonly /></td>
</tr>
</table><br>
</fieldset>
</form>
Utilizando operadores ternários e dupla atribuição dá para compactar bastante mais:
function consulta(check, inputId, valor) {
const input = document.getElementById(inputId);
input.value = check.checked ? valor : "";
input.readOnly = input.disabled = check.checked;
}
<form>
<fieldset>
<legend>
<font color="darkblue">Serviços</font>
</legend><br>
<table width="80%" border="0" style="border-color: Gainsboro" cellpadding="10">
<tr>
<td>
<input type="checkbox" name="servico1" id="checkBA" onclick='consulta(this,"consT","R$ 75,00")' ;> Consulta
<td><input type="text" id="consT" size="20" maxlength="35" readonly/></td>
</tr>
<tr>
<td>
<input type="checkbox" name="servico2" id="checkBB" onclick='consulta(this,"interT","R$ 510,00")' ; /> Internação
<td><input type="text" id="interT" size="20" maxlength="35" readonly/></td>
</tr>
<tr>
<td>
<input type="checkbox" name="servico3" id="checkBC" onclick='consulta(this,"examT","R$ 150,00")' ; /> Exames Laboratoriais
<td><input type="text" id="examT" size="20" maxlength="35" readonly /></td>
</tr>
</table><br>
</fieldset>
</form>