Browse Source

医保对接

csx 4 years ago
parent
commit
5401725d92

+ 19 - 0
controllers/his_api_controller.go View File

@@ -75,6 +75,8 @@ func HisManagerApiRegistRouters() {
75 75
 
76 76
 	beego.Router("/api/unregister/list", &HisApiController{}, "get:GetHisUnRegisterPatientList")
77 77
 
78
+	beego.Router("/api/orderdetail/get", &HisApiController{}, "get:GetAllOrderDetail")
79
+
78 80
 }
79 81
 
80 82
 func (c *HisApiController) Sscard() {
@@ -2687,3 +2689,20 @@ func (c *HisApiController) GetHisChargePatientInfo() {
2687 2689
 	return
2688 2690
 
2689 2691
 }
2692
+
2693
+func (c *HisApiController) GetAllOrderDetail() {
2694
+	order_id, _ := c.GetInt64("order_id", 0)
2695
+	order, _ := service.GetHisOrderByID(order_id)
2696
+	if order.ID == 0 {
2697
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
2698
+		return
2699
+	}
2700
+	order_info, _ := service.GetHisOrderInfoByNumber(order.Number)
2701
+
2702
+	c.ServeSuccessJSON(map[string]interface{}{
2703
+		"order":      order,
2704
+		"order_info": order_info,
2705
+	})
2706
+	return
2707
+
2708
+}

+ 1 - 2
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -26,11 +26,10 @@ func (c *MobileHisApiController) GetHisPrescriptionConfig() {
26 26
 	drugways, _, _ := service.GetDrugWayDics(adminInfo.Org.Id)
27 27
 	efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.Org.Id)
28 28
 	doctors, _ := service.GetHisAdminUserDoctors(adminInfo.Org.Id)
29
-	team, _ := service.GetAllProjectTeam(adminInfo.Org.Id)
29
+	team, _ := service.GetAllProjectTeamList(adminInfo.Org.Id)
30 30
 	projects, _ := service.GetHisProject(adminInfo.Org.Id)
31 31
 	//获取所有科室信息
32 32
 	department, _ := service.GetAllDepartMent(adminInfo.Org.Id)
33
-
34 33
 	c.ServeSuccessJSON(map[string]interface{}{
35 34
 		"drugs":            drugs,
36 35
 		"advices_template": advices,

+ 4 - 0
enums/error_code.go View File

@@ -226,6 +226,8 @@ const ( // ErrorCode
226 226
 	ErrorCodeHisRegisterException = 300001
227 227
 
228 228
 	ErrorCodeNoBloodPatientException = 300002
229
+
230
+	ErrorCodeOrderParamWrong = 300003
229 231
 )
230 232
 
231 233
 var ErrCodeMsgs = map[int]string{
@@ -442,6 +444,8 @@ var ErrCodeMsgs = map[int]string{
442 444
 	ErrorCodeHisRegisterException: "一天只能挂一个号",
443 445
 
444 446
 	ErrorCodeNoBloodPatientException: "找不到该患者,请先在系统录入患者信息或检查患者身份证信息",
447
+
448
+	ErrorCodeOrderParamWrong: "结算记录不存在",
445 449
 }
446 450
 
447 451
 type SGJError struct {

+ 55 - 0
service/his_service.go View File

@@ -3,6 +3,7 @@ package service
3 3
 import (
4 4
 	"XT_New/models"
5 5
 	"github.com/jinzhu/gorm"
6
+	"strings"
6 7
 	"time"
7 8
 )
8 9
 
@@ -1082,3 +1083,57 @@ func GetHisPrescriptionByPatientID(patientID int64, orgID int64) (info models.Hi
1082 1083
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND patient_id = ? AND status = 1", orgID, patientID).Preload("XtHisDepartment", "status = 1").Last(&info).Error
1083 1084
 	return
1084 1085
 }
1086
+
1087
+type VMHisProjectTeam struct {
1088
+	ID           int64   `gorm:"column:id" json:"id" form:"id"`
1089
+	ProjectTeam  string  `gorm:"column:project_team" json:"project_team" form:"project_team"`
1090
+	Price        float64 `gorm:"column:price" json:"price" form:"price"`
1091
+	Pinyin       string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
1092
+	Wubi         string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
1093
+	TubeColor    int64   `gorm:"column:tube_color" json:"tube_color" form:"tube_color"`
1094
+	TeamType     int64   `gorm:"column:team_type" json:"team_type" form:"team_type"`
1095
+	Remark       string  `gorm:"column:remark" json:"remark" form:"remark"`
1096
+	UserOrgId    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1097
+	Status       int64   `gorm:"column:status" json:"status" form:"status"`
1098
+	CreatedTime  int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
1099
+	UpdatedTime  int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1100
+	ProjectId    string  `gorm:"column:project_id" json:"project_id" form:"project_id"`
1101
+	VMHisProject []*VMHisProject
1102
+}
1103
+
1104
+func (VMHisProjectTeam) TableName() string {
1105
+	return "xt_his_project_team"
1106
+}
1107
+
1108
+type VMHisProject struct {
1109
+	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
1110
+	ProjectName               string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
1111
+	Price                     float64 `gorm:"column:price" json:"price" form:"price"`
1112
+	Unit                      string  `gorm:"column:unit" json:"unit" form:"unit"`
1113
+	CostClassify              int64   `gorm:"column:cost_classify" json:"cost_classify" form:"cost_classify"`
1114
+	StatisticalClassification int64   `gorm:"column:statistical_classification" json:"statistical_classification" form:"statistical_classification"`
1115
+	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1116
+	Status                    int64   `gorm:"column:status" json:"status" form:"status"`
1117
+	SingleDose                string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1118
+	ExecutionFrequency        string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1119
+	DeliveryWay               string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1120
+	NumberDays                string  `gorm:"column:number_days" json:"number_days" form:"number_days"`
1121
+	MedicalCode               string  `gorm:"column:medical_code" json:"medical_code" form:"medical_code"`
1122
+}
1123
+
1124
+func (VMHisProject) TableName() string {
1125
+	return "xt_his_project"
1126
+}
1127
+
1128
+func GetAllProjectTeamList(orgid int64) (project []*VMHisProjectTeam, err error) {
1129
+	err = XTReadDB().Model(&VMHisProjectTeam{}).Where("user_org_id = ? and status = 1", orgid).Find(&project).Error
1130
+	for _, item := range project {
1131
+		var project_item *VMHisProject
1132
+		ids := strings.Split(item.ProjectId, ",")
1133
+		for _, id := range ids {
1134
+			XTReadDB().Model(&VMSchedule{}).Where("user_org_id = ? and status = 1 AND id = ?", id).First(&project_item)
1135
+			item.VMHisProject = append(item.VMHisProject, project_item)
1136
+		}
1137
+	}
1138
+	return
1139
+}